Skip to content

Commit 7c076c1

Browse files
static build
1 parent ba36b21 commit 7c076c1

2 files changed

Lines changed: 20 additions & 12 deletions

File tree

lvgl_micropython

scripts/build_mpos.sh

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -155,24 +155,30 @@ elif [ "$target" == "unix" -o "$target" == "macOS" ]; then
155155
manifest=$(readlink -f "$codebasedir"/manifests/manifest.py)
156156
frozenmanifest="FROZEN_MANIFEST=$manifest"
157157

158-
# Ensure WebREPL native module is enabled for unix/macOS builds.
158+
# Ensure WebREPL and dupterm are enabled for unix/macOS builds.
159159
mpconfig_unix="$codebasedir"/lvgl_micropython/lib/micropython/ports/unix/mpconfigport.h
160-
if ! grep -q "MICROPY_PY_WEBREPL" "$mpconfig_unix"; then
161-
echo "Enabling MICROPY_PY_WEBREPL in $mpconfig_unix"
162-
python3 - "$mpconfig_unix" <<'PY'
160+
ensure_mpconfig_define() {
161+
local name="$1"
162+
if ! grep -q "$name" "$mpconfig_unix"; then
163+
echo "Enabling $name in $mpconfig_unix"
164+
python3 - "$mpconfig_unix" "$name" <<'PY'
163165
import pathlib
164166
import sys
165167
166168
path = pathlib.Path(sys.argv[1])
169+
name = sys.argv[2]
167170
text = path.read_text()
168171
needle = '#include "mpconfigvariant.h"'
169-
insert = "\n\n#ifndef MICROPY_PY_WEBREPL\n#define MICROPY_PY_WEBREPL (1)\n#endif\n"
170-
if needle in text and "MICROPY_PY_WEBREPL" not in text:
171-
path.write_text(text.replace(needle, needle + insert))
172+
insert = f"\n\n#ifndef {name}\n#define {name} (1)\n#endif\n"
173+
if needle in text and name not in text:
174+
path.write_text(text.replace(needle, needle + insert))
172175
PY
173-
else
174-
echo "MICROPY_PY_WEBREPL already configured in $mpconfig_unix"
175-
fi
176+
else
177+
echo "$name already configured in $mpconfig_unix"
178+
fi
179+
}
180+
ensure_mpconfig_define MICROPY_PY_WEBREPL
181+
ensure_mpconfig_define MICROPY_PY_OS_DUPTERM
176182

177183
# Comment out @micropython.viper decorator for Unix/macOS builds
178184
# (cross-compiler doesn't support Viper native code emitter)
@@ -186,7 +192,9 @@ PY
186192
# STRIP= makes it so that debug symbols are kept
187193
pushd "$codebasedir"/lvgl_micropython/
188194
# USER_C_MODULE doesn't seem to work properly so there are symlinks in lvgl_micropython/extmod/
189-
python3 make.py "$target" LV_CFLAGS="-g -O0 -ggdb" STRIP= DISPLAY=sdl_display INDEV=sdl_pointer "$frozenmanifest"
195+
# python3 make.py "$target" LV_CFLAGS="-g -O0 -ggdb" STRIP= DISPLAY=sdl_display INDEV=sdl_pointer "$frozenmanifest"
196+
python3 make.py "$target" LV_CFLAGS="-g -O0 -ggdb" STRIP= DISPLAY=sdl_display INDEV=sdl_pointer SDL_FLAGS="-DSDL_OPENGL=OFF -DSDL_OPENGLES=OFF -DSDL_VULKAN=OFF -DSDL_X11=ON -DSDL_WAYLAND=ON" FROZEN_MANIFEST=../manifests/manifest.py
197+
190198
popd
191199

192200
# Restore @micropython.viper decorator after build

0 commit comments

Comments
 (0)