travis: support OS X builds
[cascardo/ovs.git] / .travis / osx-build.sh
diff --git a/.travis/osx-build.sh b/.travis/osx-build.sh
new file mode 100755 (executable)
index 0000000..4db9c8d
--- /dev/null
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+set -o errexit
+
+CFLAGS="-Werror -Wno-error=format $CFLAGS"
+EXTRA_OPTS=""
+
+function configure_ovs()
+{
+    ./boot.sh && ./configure $*
+}
+
+configure_ovs $EXTRA_OPTS $*
+
+if [ "$CC" = "clang" ]; then
+    make CFLAGS="$CFLAGS -Wno-error=unused-command-line-argument"
+else
+    make CFLAGS="$CFLAGS $BUILD_ENV"
+fi
+if [ "$TESTSUITE" ] && [ "$CC" != "clang" ]; then
+    if ! make distcheck RECHECK=yes; then
+        # testsuite.log is necessary for debugging.
+        cat */_build/tests/testsuite.log
+        exit 1
+    fi
+fi
+
+exit 0