Skip to content

Commit 2e04a4c

Browse files
Fix build on macOS
1 parent 32d28da commit 2e04a4c

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

scripts/build_mpos.sh

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,17 @@ elif [ "$target" == "unix" -o "$target" == "macOS" ]; then
159159
mpconfig_unix="$codebasedir"/lvgl_micropython/lib/micropython/ports/unix/mpconfigport.h
160160
if ! grep -q "MICROPY_PY_WEBREPL" "$mpconfig_unix"; then
161161
echo "Enabling MICROPY_PY_WEBREPL in $mpconfig_unix"
162-
sed -i.backup '/#include "mpconfigvariant.h"/a \
163-
\n#ifndef MICROPY_PY_WEBREPL\n#define MICROPY_PY_WEBREPL (1)\n#endif\n' "$mpconfig_unix"
162+
python3 - "$mpconfig_unix" <<'PY'
163+
import pathlib
164+
import sys
165+
166+
path = pathlib.Path(sys.argv[1])
167+
text = path.read_text()
168+
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+
PY
164173
else
165174
echo "MICROPY_PY_WEBREPL already configured in $mpconfig_unix"
166175
fi

0 commit comments

Comments
 (0)