[Openvpn-devel] travis: fix CFLAGS assignment error and add -Werror only when compiling on Linux for Linux

Message ID 20191110195622.28177-1-a@unstable.cc
State New
Headers show
Series
  • [Openvpn-devel] travis: fix CFLAGS assignment error and add -Werror only when compiling on Linux for Linux
Related show

Commit Message

Antonio Quartulli Nov. 10, 2019, 7:56 p.m.
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)

Signed-off-by: Antonio Quartulli <a@unstable.cc>
---

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(-)

Comments

Antonio Quartulli Nov. 10, 2019, 8:07 p.m. | #1
NAK to myself!

Even though travis was green, this patch does not properly activate
-Werror......

v2 incoming..

Cheers,

Patch

diff --git a/.travis/build-check.sh b/.travis/build-check.sh
index 250bb454..c2a4904c 100755
--- a/.travis/build-check.sh
+++ b/.travis/build-check.sh
@@ -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:-}