Fix quoting of CXXFLAGS passed to make

Use arrays to simplify passing CXXFLAGS and LDFLAGS, both of them may
contain spaces, separately on make command line.

Simpler solution of just using individual variable doesn't work because
of bash/POSIX word splitting behaviour (zsh should be blamed for
spoiling me with its much more reasonable behaviour and allowing me
to forget about this insanity in the first place). In principle, we
could work around this by temporarily resetting IFS, but using arrays is
arguably more clear and this script already uses bashisms, in spite of
its shebang line.
This commit is contained in:
Vadim Zeitlin
2020-07-06 17:38:11 +02:00
parent 589e043358
commit 403884e1d8

View File

@@ -84,25 +84,28 @@ case $wxTOOLSET in
error_opts="-Werror $allow_warn_opt"
wxMAKEFILE_CXXFLAGS="$wxMAKEFILE_CXXFLAGS $error_opts"
wxMAKEFILE_ERROR_CXXFLAGS="CXXFLAGS=$error_opts"
wxMAKEFILE_ERROR_CXXFLAGS=("CXXFLAGS=$error_opts")
else
wxMAKEFILE_ERROR_CXXFLAGS=()
fi
wxMAKEFILE_FLAGS=()
if [ -n "$wxMAKEFILE_CXXFLAGS" ]; then
wxMAKEFILE_FLAGS="CXXFLAGS=$wxMAKEFILE_CXXFLAGS"
wxMAKEFILE_FLAGS+=("CXXFLAGS=$wxMAKEFILE_CXXFLAGS")
fi
if [ -n "$wxMAKEFILE_LDFLAGS" ]; then
wxMAKEFILE_FLAGS="$wxMAKEFILE_FLAGS LDFLAGS=$wxMAKEFILE_LDFLAGS"
wxMAKEFILE_FLAGS+=("LDFLAGS=$wxMAKEFILE_LDFLAGS")
fi
echo 'travis_fold:start:building'
echo 'Building...'
make -k $wxBUILD_ARGS $wxMAKEFILE_ERROR_CXXFLAGS
make -k $wxBUILD_ARGS "${wxMAKEFILE_ERROR_CXXFLAGS[@]}"
echo 'travis_fold:end:building'
echo 'travis_fold:start:tests'
echo 'Building tests...'
[ "$wxSKIP_GUI" = 1 ] || make -C tests $wxBUILD_ARGS failtest
make -k -C tests $wxBUILD_ARGS $wxMAKEFILE_FLAGS
make -k -C tests $wxBUILD_ARGS "${wxMAKEFILE_FLAGS[@]}"
echo 'travis_fold:end:tests'
if [ "$wxSKIP_TESTING" = 1 ]; then
@@ -129,7 +132,7 @@ case $wxTOOLSET in
echo 'travis_fold:start:samples'
echo 'Building samples...'
(test "$wxSKIP_SAMPLES" && echo 'SKIPPED') || make -k $wxMAKEFILE_FLAGS samples
(test "$wxSKIP_SAMPLES" && echo 'SKIPPED') || make -k "${wxMAKEFILE_FLAGS[@]}" samples
echo 'travis_fold:end:samples'
echo 'travis_fold:start:install'
@@ -140,7 +143,7 @@ case $wxTOOLSET in
echo 'travis_fold:start:testinstall'
echo 'Testing installation...'
make -C samples/minimal -f makefile.unx clean
make -C samples/minimal -f makefile.unx $wxMAKEFILE_FLAGS
make -C samples/minimal -f makefile.unx "${wxMAKEFILE_FLAGS[@]}"
echo 'travis_fold:end:testinstall'
;;
esac