build_style/meson.sh: export CFLAGS and CXXFLAGS from host

meson when compiling something with 'native: true' (for building
executables that are meant to be run on the host system) uses CFLAGS
and CXXFLAGS environment variables, we "pollute" them with
TARGET system cflags/cxxflags, such as -march= for the cross-compiled
arch.

so to fix it we export CFLAGS and CXXFLAGS to be CFLAGS_host and
CXXFLAGS_host respectively, they are set by XBPS and correspond to
the XBPS_CFLAGS/XBPS_CXXFLAGS. This same set of changes is also done
with CC and CXX see L#61

this was found when cross-compiling lighttpd which created the
'lemon' executable to generate inputs

thanks to @Cogitri from Exherbo for helping me debug this

[ci skip]
This commit is contained in:
maxice8 2018-08-14 06:43:07 -03:00
parent d95613c56c
commit 6580c8d657
No known key found for this signature in database
GPG Key ID: 543B9D4F4299F06B
1 changed files with 5 additions and 0 deletions

View File

@ -60,6 +60,11 @@ EOF
# compiling, we need to set those to the host versions.
export CC=${CC_host} CXX=${CXX_host}
# Meson tries to use CFLAGS and CPPFLAGS when compiling under
# native: true, so we use XBPS_CFLAGS and XBPS_CPPFLAGS which
# are set to (C|CXX)FLAGS_host
export CFLAGS=${CFLAGS_host} CXXFLAGS=${CXXFLAGS_host}
unset _MESON_TARGET_CPU _MESON_TARGET_ENDIAN
fi