blob: 558b6dc1743e4035029ff3a81dc998a7d757c8f5 [file] [log] [blame]
Holger Hans Peter Freythera47b4012016-04-13 19:03:38 -04001#!/usr/bin/env bash
Harald Weltee2e41c12017-07-10 15:00:00 +02002# jenkins build helper script for openbsc. This is how we build on jenkins.osmocom.org
Oliver Smith42a6c392018-11-29 14:31:32 +01003#
4# environment variables:
5# * IU: configure 3G support (values: "--enable-iu", "--disable-iu")
6# * WITH_MANUALS: build manual PDFs if set to "1"
7# * PUBLISH: upload manuals after building if set to "1" (ignored without WITH_MANUALS = "1")
8#
Harald Weltee2e41c12017-07-10 15:00:00 +02009
10if ! [ -x "$(command -v osmo-build-dep.sh)" ]; then
11 echo "Error: We need to have scripts/osmo-deps.sh from http://git.osmocom.org/osmo-ci/ in PATH !"
12 exit 2
13fi
14
Holger Hans Peter Freythera47b4012016-04-13 19:03:38 -040015
16set -ex
17
Neels Hofmeyra3d93ed2016-07-11 19:39:51 +020018base="$PWD"
19deps="$base/deps"
20inst="$deps/install"
Neels Hofmeyrf1a56de2016-10-07 00:58:22 +020021export deps inst
Holger Hans Peter Freythera47b4012016-04-13 19:03:38 -040022
Neels Hofmeyr7f5ab9e2017-10-27 22:54:40 +020023osmo-clean-workspace.sh
24
Neels Hofmeyra3d93ed2016-07-11 19:39:51 +020025mkdir "$deps" || true
Neels Hofmeyra3d93ed2016-07-11 19:39:51 +020026
Neels Hofmeyrf1a56de2016-10-07 00:58:22 +020027osmo-build-dep.sh libosmocore "" ac_cv_path_DOXYGEN=false
Neels Hofmeyra3d93ed2016-07-11 19:39:51 +020028
Neels Hofmeyr6ecdbc92017-08-26 21:19:35 +020029verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]")
Neels Hofmeyrac27a992017-03-01 15:06:16 +010030
Neels Hofmeyra3d93ed2016-07-11 19:39:51 +020031export PKG_CONFIG_PATH="$inst/lib/pkgconfig:$PKG_CONFIG_PATH"
Neels Hofmeyrf1a56de2016-10-07 00:58:22 +020032export LD_LIBRARY_PATH="$inst/lib"
Oliver Smith42a6c392018-11-29 14:31:32 +010033export PATH="$inst/bin:$PATH"
Neels Hofmeyra3d93ed2016-07-11 19:39:51 +020034
Neels Hofmeyrf1a56de2016-10-07 00:58:22 +020035osmo-build-dep.sh libosmo-abis
Neels Hofmeyr4aa75e72017-03-31 14:03:39 +020036osmo-build-dep.sh libosmo-netif
Philipp Maierfbf66102017-04-09 12:32:51 +020037osmo-build-dep.sh libosmo-sccp
Vadim Yanitskiy088043f2022-08-29 00:42:02 +070038osmo-build-dep.sh libsmpp34
Neels Hofmeyrcf6a4872017-09-03 22:47:51 +020039osmo-build-dep.sh osmo-mgw
Harald Welte1ea6baf2018-07-31 19:40:52 +020040osmo-build-dep.sh osmo-hlr
Neels Hofmeyra3d93ed2016-07-11 19:39:51 +020041
Neels Hofmeyr97593742016-07-11 19:44:58 +020042if [ "x$IU" = "x--enable-iu" ]; then
Neels Hofmeyrf1a56de2016-10-07 00:58:22 +020043 osmo-build-dep.sh libasn1c
44 #osmo-build-dep.sh asn1c aper-prefix # only needed for make regen in osmo-iuh
Philipp Maierfbf66102017-04-09 12:32:51 +020045 osmo-build-dep.sh osmo-iuh
Neels Hofmeyr97593742016-07-11 19:44:58 +020046fi
47
Oliver Smith42a6c392018-11-29 14:31:32 +010048# Additional configure options and depends
49CONFIG=""
50if [ "$WITH_MANUALS" = "1" ]; then
Oliver Smith42a6c392018-11-29 14:31:32 +010051 CONFIG="--enable-manuals"
52fi
53
Neels Hofmeyrf1a56de2016-10-07 00:58:22 +020054set +x
55echo
56echo
57echo
Neels Hofmeyrf29ff882017-07-12 23:37:05 +020058echo " =============================== osmo-msc ==============================="
Neels Hofmeyrf1a56de2016-10-07 00:58:22 +020059echo
60set -x
61
Neels Hofmeyra3d93ed2016-07-11 19:39:51 +020062cd "$base"
Holger Hans Peter Freythera47b4012016-04-13 19:03:38 -040063autoreconf --install --force
Oliver Smithf5a0c4b2022-11-15 12:57:24 +010064./configure --enable-sanitize --enable-werror --enable-smpp $IU --enable-external-tests $CONFIG
Neels Hofmeyra3d93ed2016-07-11 19:39:51 +020065$MAKE $PARALLEL_MAKE
Neels Hofmeyrf1a56de2016-10-07 00:58:22 +020066LD_LIBRARY_PATH="$inst/lib" $MAKE check \
67 || cat-testlogs.sh
Neels Hofmeyr53edff32017-07-20 17:57:37 +020068LD_LIBRARY_PATH="$inst/lib" \
Oliver Smithf5a0c4b2022-11-15 12:57:24 +010069 DISTCHECK_CONFIGURE_FLAGS="--enable-werror --enable-smpp $IU --enable-external-tests $CONFIG" \
Pau Espin Pedrol5a58cef2020-10-12 19:37:24 +020070 $MAKE $PARALLEL_MAKE distcheck \
Neels Hofmeyrf1a56de2016-10-07 00:58:22 +020071 || cat-testlogs.sh
Neels Hofmeyr7f5ab9e2017-10-27 22:54:40 +020072
Oliver Smith42a6c392018-11-29 14:31:32 +010073if [ "$WITH_MANUALS" = "1" ] && [ "$PUBLISH" = "1" ]; then
74 make -C "$base/doc/manuals" publish
75fi
76
Pau Espin Pedrol5a58cef2020-10-12 19:37:24 +020077$MAKE $PARALLEL_MAKE maintainer-clean
Neels Hofmeyr7f5ab9e2017-10-27 22:54:40 +020078osmo-clean-workspace.sh