travis: fix CFLAGS assignment error and add -Werror only when compiling on Linux for Linux
PATCH 1/1 travis: fix CFLAGS assignment error and add -Werror only when compiling on Linux for Linux
CFLAGS may not resolve to anything and the build-check.sh script would just fail.
Use proper substitution so that the script won't error out when CFLAGS is uninitialized.
At the same time ensure that such flag is set only when compiling *for* linux (we use linux to also compile *for* windows)
---
Test on travis-ci with my personal openvpn repo:
https://travis-ci.org/ordex/openvpn
.travis/build-check.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
.travis/build-check.sh +4 -2
@@ -8,7 +8,6 @@ fi if [ "${TRAVIS_OS_NAME}" = "linux" ]; then export LD_LIBRARY_PATH="${PREFIX}/lib:${LD_LIBRARY_PATH:-}" - export CFLAGS="${CFLAGS} -Werror" fi if [ "${TRAVIS_OS_NAME}" = "osx" ]; then
@@ -21,7 +20,10 @@ if [ -z ${CHOST+x} ]; then ./configure --with-crypto-library="${SSLLIB}" ${EXTRA_CONFIG:-} || (cat config.log && exit 1) make -j$JOBS src/openvpn/openvpn --version || true - if [ "${TRAVIS_OS_NAME}" = "linux" ]; then ldd src/openvpn/openvpn; fi + if [ "${TRAVIS_OS_NAME}" = "linux" ]; then + ldd src/openvpn/openvpn; + export CFLAGS="${CFLAGS:-} -Werror" + fi if [ "${TRAVIS_OS_NAME}" = "osx" ]; then otool -L src/openvpn/openvpn; fi make check ${EXTRA_SCRIPT:-}
Signature · 1 line
2.24.0
NAK to myself!
Even though travis was green, this patch does not properly activate -Werror......
v2 incoming..
Cheers,
Signature · 1 line
Antonio Quartulli
PATCH v2 1/1 travis: fix CFLAGS assignment error and add -Werror only when compiling on Linux for Linux
In reply to Antonio QuartulliCFLAGS may not resolve to anything and the build-check.sh script would just fail.
Switch to EXTRA_FLAGS and use proper substitution so that the script won't error out when EXTRA_FLAGS is uninitialized.
At the same time ensure that such flag is set only when compiling *for* linux (we use linux to also compile *for* windows)
---
Tested on travis: https://travis-ci.org/ordex/openvpn/builds/610047381
Changes from v1:
- use EXTRA_CONFIG with --enable-werror instead of adding -Werror manually to the CFLAGS
- make sure to add werror directive *before* executing ./configure command
.travis/build-check.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
.travis/build-check.sh +6 -2
@@ -8,7 +8,6 @@ fi if [ "${TRAVIS_OS_NAME}" = "linux" ]; then export LD_LIBRARY_PATH="${PREFIX}/lib:${LD_LIBRARY_PATH:-}" - export CFLAGS="${CFLAGS} -Werror" fi if [ "${TRAVIS_OS_NAME}" = "osx" ]; then
@@ -18,10 +17,15 @@ fi autoreconf -vi if [ -z ${CHOST+x} ]; then + if [ "${TRAVIS_OS_NAME}" = "linux" ]; then + export EXTRA_CONFIG="${EXTRA_CONFIG:-} --enable-werror" + fi ./configure --with-crypto-library="${SSLLIB}" ${EXTRA_CONFIG:-} || (cat config.log && exit 1) make -j$JOBS src/openvpn/openvpn --version || true - if [ "${TRAVIS_OS_NAME}" = "linux" ]; then ldd src/openvpn/openvpn; fi + if [ "${TRAVIS_OS_NAME}" = "linux" ]; then + ldd src/openvpn/openvpn; + fi if [ "${TRAVIS_OS_NAME}" = "osx" ]; then otool -L src/openvpn/openvpn; fi make check ${EXTRA_SCRIPT:-}
Signature · 1 line
2.24.0
Am 10.11.19 um 21:17 schrieb Antonio Quartulli:
Quoted 9 lines
CFLAGS may not resolve to anything and the
build-check.shscript would just fail.Switch to
EXTRA_FLAGSand use proper substitution so that the script won't error out whenEXTRA_FLAGSis uninitialized.At the same time ensure that such flag is set only when compiling *for* linux (we use linux to also compile *for* windows)
Tested it and verified that --enable-werror is used.
Arne
Your patch has been applied to the master branch.
I have not done any sort of test, except "now pushing to master, which will make travis either explode or happy" :-) - as the patch does not touch anything but travis config, it's fairly save for the rest.
thanks,
commit e0fbb584b8c4acba15feed7e30a778dde6389677
Author: Antonio Quartulli Date: Sun Nov 10 21:17:18 2019 +0100
travis: fix CFLAGS assignment error and add -Werror only when compiling on Linux for Linux
Signed-off-by: Antonio Quartulli <[email protected]...>
Acked-by: Arne Schwabe <[email protected]...>
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg19109.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering