blob: 0b978dca2f7f76bbdb05ccce76d2d8157ee96480 [file] [log] [blame]
Holger Hans Peter Freythera47b4012016-04-13 19:03:38 -04001#!/usr/bin/env bash
Harald Welte5f4c3572017-07-10 15:00:00 +02002# jenkins build helper script for openbsc. This is how we build on jenkins.osmocom.org
Oliver Smithab9a2592018-11-28 11:33:39 +01003#
4# environment variables:
5# * WITH_MANUALS: build manual PDFs if set to "1"
6# * PUBLISH: upload manuals after building if set to "1" (ignored without WITH_MANUALS = "1")
7#
Harald Welte5f4c3572017-07-10 15:00:00 +02008
9if ! [ -x "$(command -v osmo-build-dep.sh)" ]; then
10 echo "Error: We need to have scripts/osmo-deps.sh from http://git.osmocom.org/osmo-ci/ in PATH !"
11 exit 2
12fi
13
Holger Hans Peter Freythera47b4012016-04-13 19:03:38 -040014
15set -ex
16
Neels Hofmeyra3d93ed2016-07-11 19:39:51 +020017base="$PWD"
18deps="$base/deps"
19inst="$deps/install"
Neels Hofmeyrf1a56de2016-10-07 00:58:22 +020020export deps inst
Holger Hans Peter Freythera47b4012016-04-13 19:03:38 -040021
Neels Hofmeyrc7523512017-10-27 22:54:22 +020022osmo-clean-workspace.sh
23
Neels Hofmeyra3d93ed2016-07-11 19:39:51 +020024mkdir "$deps" || true
Neels Hofmeyra3d93ed2016-07-11 19:39:51 +020025
Maxad1e3cd2017-12-21 15:00:33 +010026osmo-build-dep.sh libosmocore "" '--disable-doxygen --enable-gnutls'
Neels Hofmeyra3d93ed2016-07-11 19:39:51 +020027
Neels Hofmeyr33c59942017-08-26 21:19:35 +020028verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]")
Neels Hofmeyrac27a992017-03-01 15:06:16 +010029
Neels Hofmeyra3d93ed2016-07-11 19:39:51 +020030export PKG_CONFIG_PATH="$inst/lib/pkgconfig:$PKG_CONFIG_PATH"
Neels Hofmeyrf1a56de2016-10-07 00:58:22 +020031export LD_LIBRARY_PATH="$inst/lib"
Oliver Smithab9a2592018-11-28 11:33:39 +010032export PATH="$inst/bin:$PATH"
Neels Hofmeyra3d93ed2016-07-11 19:39:51 +020033
Neels Hofmeyrf1a56de2016-10-07 00:58:22 +020034osmo-build-dep.sh libosmo-abis
Neels Hofmeyr4aa75e72017-03-31 14:03:39 +020035osmo-build-dep.sh libosmo-netif
Philipp Maier39f62bb2017-04-09 12:32:51 +020036osmo-build-dep.sh libosmo-sccp
Neels Hofmeyr174e5dc2017-09-03 22:45:09 +020037osmo-build-dep.sh osmo-mgw
Neels Hofmeyra3d93ed2016-07-11 19:39:51 +020038
Oliver Smithab9a2592018-11-28 11:33:39 +010039# Additional configure options and depends
40CONFIG=""
41if [ "$WITH_MANUALS" = "1" ]; then
Oliver Smithab9a2592018-11-28 11:33:39 +010042 CONFIG="--enable-manuals"
43fi
44
Neels Hofmeyrf1a56de2016-10-07 00:58:22 +020045set +x
46echo
47echo
48echo
Max9cc70442017-09-23 14:15:46 +020049echo " =============================== osmo-bsc ==============================="
Neels Hofmeyrf1a56de2016-10-07 00:58:22 +020050echo
51set -x
52
Neels Hofmeyra3d93ed2016-07-11 19:39:51 +020053cd "$base"
Holger Hans Peter Freythera47b4012016-04-13 19:03:38 -040054autoreconf --install --force
Oliver Smithab9a2592018-11-28 11:33:39 +010055./configure --enable-sanitize --enable-external-tests --enable-werror $CONFIG
Neels Hofmeyra3d93ed2016-07-11 19:39:51 +020056$MAKE $PARALLEL_MAKE
Neels Hofmeyrf1a56de2016-10-07 00:58:22 +020057LD_LIBRARY_PATH="$inst/lib" $MAKE check \
58 || cat-testlogs.sh
Neels Hofmeyr1ea43f82017-07-20 17:57:37 +020059LD_LIBRARY_PATH="$inst/lib" \
Oliver Smithab9a2592018-11-28 11:33:39 +010060 DISTCHECK_CONFIGURE_FLAGS="--enable-vty-tests --enable-external-tests --enable-werror $CONFIG" \
Pau Espin Pedrol8ab883b2020-10-12 19:39:40 +020061 $MAKE $PARALLEL_MAKE distcheck \
Neels Hofmeyrf1a56de2016-10-07 00:58:22 +020062 || cat-testlogs.sh
Neels Hofmeyrc7523512017-10-27 22:54:22 +020063
Oliver Smithab9a2592018-11-28 11:33:39 +010064if [ "$WITH_MANUALS" = "1" ] && [ "$PUBLISH" = "1" ]; then
65 make -C "$base/doc/manuals" publish
66fi
67
Pau Espin Pedrol8ab883b2020-10-12 19:39:40 +020068$MAKE $PARALLEL_MAKE maintainer-clean
Neels Hofmeyrc7523512017-10-27 22:54:22 +020069osmo-clean-workspace.sh