22
33mydir=$( readlink -f" $0 " )
44mydir=$( dirname" $mydir " )
5- twoup=$( readlink -f" $mydir " /../..) # build process needs absolute paths
6- oneup=$( readlink -f" $mydir " /..) # build process needs absolute paths
5+ codebasedir=$( readlink -f" $mydir " /..) # build process needs absolute paths
76
87target=" $1 "
98buildtype=" $2 "
@@ -23,8 +22,46 @@ if [ -z "$target" -o -z "$buildtype" ]; then
2322exit 1
2423fi
2524
25+
26+ # This assumes all the git submodules have been checked out recursively
27+
28+ echo " Fetch tags for lib/SDL, otherwise lvgl_micropython's make.py script can't checkout a specific tag..."
29+ pushd " $codebasedir " /lvgl_micropython/lib/SDL
30+ git fetch --unshallow origin
31+ # Or fetch all refs without unshallowing (keeps it shallow but adds refs)
32+ git fetch origin' refs/*:refs/*'
33+ popd
34+
35+ echo " Check need to add esp32-camera..."
36+ idfile=" $codebasedir " /lvgl_micropython/lib/micropython/ports/esp32/main/idf_component.yml
37+ if grep -v esp32-camera" $idfile " ; then
38+ echo " Adding esp32-camera to$idfile "
39+ echo " espressif/esp32-camera:
40+ git: https://github.com/MicroPythonOS/esp32-camera" >> " $idfile "
41+ else
42+ echo " No need to add esp32-camera to$idfile "
43+ fi
44+
45+ echo " Check need to add asyncio..."
46+ manifile=" $codebasedir " /lib/micropython/ports/unix/variants/manifest.py
47+ if grep -v asyncio" $manifile " ; then
48+ echo " Adding asyncio to$manifile "
49+ echo ' include("$(MPY_DIR)/extmod/asyncio") # needed to have asyncio, which is used by aiohttp, which has used by websockets' >> " $manifile "
50+ else
51+ echo " No need to add asyncio to$manifile "
52+ fi
53+
54+ # unix and macOS builds need these symlinks because make.py doesn't handle USER_C_MODULE arguments for them:
55+ echo " Symlinking secp256k1-embedded-ecdh for unix and macOS builds..."
56+ ln -sf ../../secp256k1-embedded-ecdh" $codebasedir " /lvgl_micropython/ext_mod/secp256k1-embedded-ecdh
57+ echo " Symlinking c_mpos for unix and macOS builds..."
58+ ln -sf ../../c_mpos" $codebasedir " /lvgl_micropython/ext_mod/c_mpos
59+
60+
2661if [" $buildtype " == " prod" ]; then
27- ./scripts/freezefs_mount_builtin.sh
62+ freezefs=" $codebasedir " /scripts/freezefs_mount_builtin.sh
63+ echo " It's a$buildtype build, running$freezefs "
64+ $freezefs
2865fi
2966
3067
@@ -55,8 +92,8 @@ if [ "$target" == "esp32" ]; then
5592# CONFIG_FREERTOS_VTASKLIST_INCLUDE_COREID=y
5693# CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS=y
5794[! -z " $manifest " ]&& frozenmanifest=" FROZEN_MANIFEST=" $( readlink -f" $manifest " )
58- pushd lvgl_micropython
59- python3 make.py --ota --partition-size=4194304 --flash-size=16 esp32 BOARD=ESP32_GENERIC_S3 BOARD_VARIANT=SPIRAM_OCT DISPLAY=st7789 INDEV=cst816s USER_C_MODULE=" $mydir " /micropython-camera-API/src/micropython.cmake USER_C_MODULE=" $mydir " /secp256k1-embedded-ecdh/micropython.cmake USER_C_MODULE=" $mydir " /c_mpos/micropython.cmake CONFIG_FREERTOS_USE_TRACE_FACILITY=y CONFIG_FREERTOS_VTASKLIST_INCLUDE_COREID=y CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS=y" $frozenmanifest "
95+ pushd " $codebasedir " / lvgl_micropython/
96+ python3 make.py --ota --partition-size=4194304 --flash-size=16 esp32 BOARD=ESP32_GENERIC_S3 BOARD_VARIANT=SPIRAM_OCT DISPLAY=st7789 INDEV=cst816s USER_C_MODULE=" $codebasedir " /micropython-camera-API/src/micropython.cmake USER_C_MODULE=" $codebasedir " /secp256k1-embedded-ecdh/micropython.cmake USER_C_MODULE=" $codebasedir " /c_mpos/micropython.cmake CONFIG_FREERTOS_USE_TRACE_FACILITY=y CONFIG_FREERTOS_VTASKLIST_INCLUDE_COREID=y CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS=y" $frozenmanifest "
6097popd
6198elif [" $target " == " unix" -o " $target " == " macOS" ]; then
6299if [" $buildtype " == " prod" ]; then
@@ -67,7 +104,7 @@ elif [ "$target" == "unix" -o "$target" == "macOS" ]; then
67104# LV_CFLAGS are passed to USER_C_MODULES
68105# STRIP= makes it so that debug symbols are kept
69106[! -z " $manifest " ]&& frozenmanifest=" FROZEN_MANIFEST=" $( readlink -f" $manifest " )
70- pushd lvgl_micropython/
107+ pushd " $codebasedir " / lvgl_micropython/
71108# USER_C_MODULE doesn't seem to work properly so there are symlinks in lvgl_micropython/extmod/
72109python3 make.py" $target " LV_CFLAGS=" -g -O0 -ggdb -ljpeg" STRIP= DISPLAY=sdl_display INDEV=sdl_pointer INDEV=sdl_keyboard" $manifest "
73110popd