Skip to content

Commit a63cb9c

Browse files
Richard Taylorclaude
authored andcommitted
Only apply Clang warning suppression on macOS, not Linux
GCC on Linux doesn't have -Wgnu-folding-constant, so applying these flags breaks the Linux build. Guard the Makefile patch with a Darwin check so it only runs on macOS. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
1 parent 2f19b4f commit a63cb9c

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

scripts/build_mpos.sh

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -195,10 +195,13 @@ PY
195195
stream_wav_file="$codebasedir"/internal_filesystem/lib/mpos/audio/stream_wav.py
196196
sed -i.backup 's/^@micropython\.viper$/#@micropython.viper/' "$stream_wav_file"
197197

198-
# Suppress warnings that newer Clang (17+) treats as errors
199-
echo "Temporarily suppressing Clang warnings for unix/macOS build..."
198+
# Suppress warnings that newer Clang (17+) treats as errors on macOS.
199+
# GCC on Linux doesn't have -Wgnu-folding-constant so this must be skipped there.
200200
unix_makefile="$codebasedir"/lvgl_micropython/lib/micropython/ports/unix/Makefile
201-
sed -i.backup 's/^CWARN = -Wall -Werror$/CWARN = -Wall -Werror -Wno-error=gnu-folding-constant -Wno-error=missing-field-initializers/' "$unix_makefile"
201+
if [ "$(uname -s)" = "Darwin" ]; then
202+
echo "Temporarily suppressing Clang warnings for macOS build..."
203+
sed -i.backup 's/^CWARN = -Wall -Werror$/CWARN = -Wall -Werror -Wno-error=gnu-folding-constant -Wno-error=missing-field-initializers/' "$unix_makefile"
204+
fi
202205

203206
# If it's still running, kill it, otherwise "text file busy"
204207
pkill -9 -f /lvgl_micropy_unix
@@ -223,9 +226,11 @@ PY
223226
sed -i.backup 's/^#@micropython\.viper$/@micropython.viper/' "$stream_wav_file"
224227
rm "$stream_wav_file".backup
225228

226-
# Restore original Makefile CWARN
227-
echo "Restoring unix Makefile CWARN..."
228-
mv "$unix_makefile".backup "$unix_makefile"
229+
# Restore original Makefile CWARN (only if we patched it on macOS)
230+
if [ -f "$unix_makefile".backup ]; then
231+
echo "Restoring unix Makefile CWARN..."
232+
mv "$unix_makefile".backup "$unix_makefile"
233+
fi
229234
else
230235
echo "invalid target $target"
231236
fi

0 commit comments

Comments
 (0)