ci: sync jenkins scripts with NFD

Change-Id: I43689bcf51bbe7a1c3118d8b0c226b56077fb4ed
diff --git a/.jenkins.d/10-build.sh b/.jenkins.d/10-build.sh
new file mode 100755
index 0000000..8886aca
--- /dev/null
+++ b/.jenkins.d/10-build.sh
@@ -0,0 +1,40 @@
+#!/usr/bin/env bash
+set -e
+
+JDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
+source "$JDIR"/util.sh
+
+set -x
+
+# Cleanup
+sudo ./waf -j1 --color=yes distclean
+
+if [[ "$JOB_NAME" != *"limited-build" ]]; then
+  # Configure/build in optimized mode with tests
+  ./waf -j1 --color=yes configure --with-tests
+  ./waf -j1 --color=yes build
+
+  # Cleanup
+  sudo ./waf -j1 --color=yes distclean
+
+  # Configure/build in optimized mode without tests
+  ./waf -j1 --color=yes configure
+  ./waf -j1 --color=yes build
+
+  # Cleanup
+  sudo ./waf -j1 --color=yes distclean
+fi
+
+# Configure/build in debug mode with tests
+if [[ "$JOB_NAME" == *"code-coverage" ]]; then
+    COVERAGE="" # TODO add code coverage support
+elif ! has OSX-10.9 $NODE_LABELS && ! has OSX-10.11 $NODE_LABELS; then
+    ASAN="--with-sanitizer=address"
+fi
+./waf -j1 --color=yes configure --debug --with-tests $COVERAGE $ASAN
+./waf -j1 --color=yes build
+
+# (tests will be run against debug version)
+
+# Install
+sudo ./waf -j1 --color=yes install