-
Notifications
You must be signed in to change notification settings - Fork 72
Expand file tree
/
Copy pathcompile_dir.sh
More file actions
executable file
·42 lines (35 loc) · 1.32 KB
/
compile_dir.sh
File metadata and controls
executable file
·42 lines (35 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/sh
mydir=$(readlink -f "$0")
mydir=$(dirname "$mydir")
indir="$1"
outdir="$2"
if [ -z "$indir" -o -z "$outdir" ]; then
echo "Usage: $0 <inputdir> <outdir>"
exit 1
fi
mkdir "$outdir"
cp -R "$indir"/* "$outdir"
find "$outdir" -iname "*.py" | while read pyfile; do
if [ -L "$pyfile" ]; then
oldtarget=$(readlink -f "$pyfile")
newtarget=$(echo "$oldtarget" | sed "s/.py\$/.mpy/g")
newname=$(echo "$pyfile" | sed "s/.py\$/.mpy/g")
echo "Symlinking $newname to $newtarget"
ln -s "$newtarget" "$newname"
else
echo "Compiling $pyfile"
#"$mydir"/../lvgl_micropython/lib/micropython/mpy-cross/build/mpy-cross -s "" "$pyfile"
# -march= is needed to fix @viper stuff, but host is probably wrong because the host is x64 while it's running on esp32 (xtensawin)
# this is fine for builtin/apps because they don't use viper, but lib/mpos/ does (audio) so that might not work
"$mydir"/../lvgl_micropython/lib/micropython/mpy-cross/build/mpy-cross -s "" -march=host "$pyfile"
#"$mydir"/../lvgl_micropython/lib/micropython/mpy-cross/build/mpy-cross -s "" -march=xtensawin "$pyfile"
#"$mydir"/../lvgl_micropython/lib/micropython/mpy-cross/build/mpy-cross -s "" -march=x64 "$pyfile"
result=$?
if [ $result -ne 0 ]; then
echo "error: $result"
exit 2
fi
fi
#echo "Removing it from the target folder..."
rm "$pyfile"
done