Pass through CFLAGS_EXTRA for Micropython (#2007)

Co-authored-by: Ivan Pozdeev <vano@mail.mipt.ru>
This commit is contained in:
yggdr 2022-05-31 18:47:06 +02:00 committed by GitHub
parent 845e08eb2f
commit cd5522965b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 1 deletions

View file

@ -899,7 +899,7 @@ build_package_micropython() {
"$MAKE" $MAKE_OPTS
cd ../ports/unix
"$MAKE" $MAKE_OPTS axtls
"$MAKE" $MAKE_OPTS CFLAGS_EXTRA="-DMICROPY_PY_SYS_PATH_DEFAULT='\"${PREFIX_PATH}/lib/micropython\"'"
"$MAKE" $MAKE_OPTS CFLAGS_EXTRA="-DMICROPY_PY_SYS_PATH_DEFAULT='\"${PREFIX_PATH}/lib/micropython\"' $CFLAGS_EXTRA"
"$MAKE" install $MAKE_INSTALL_OPTS PREFIX="${PREFIX_PATH}"
ln -fs micropython "${PREFIX_PATH}/bin/python"
mkdir -p "${PREFIX_PATH}/lib/micropython"

View file

@ -97,3 +97,24 @@ make -j 2
make install
OUT
}
@test "passthrough CFLAGS_EXTRA to micropython compiler" {
mkdir -p "$INSTALL_ROOT/mpy-cross"
mkdir -p "$INSTALL_ROOT/ports/unix"
mkdir -p "$INSTALL_ROOT/bin"
# touch "$INSTALL_ROOT/bin/python"
cd "$INSTALL_ROOT"
stub make true true '(for a in "$@"; do echo $a; done)|grep -E "^CFLAGS_EXTRA="' true
stub ln true
stub mkdir true
run_inline_definition <<DEF
exec 4<&1
CFLAGS_EXTRA='-Wno-floating-conversion' build_package_micropython
DEF
#assert_success
assert_output <<OUT
CFLAGS_EXTRA=-DMICROPY_PY_SYS_PATH_DEFAULT='"${TMP}/install/lib/micropython"' -Wno-floating-conversion
OUT
}