blob: c5161eff68cbbf5a6afc1672cfdddede8cfe1935 [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")
Oliver Smith799d9722023-05-23 16:21:04 +02008# * IS_MASTER_BUILD: set to 1 when running from master-builds (not gerrit-verifications)
Oliver Smith42a6c392018-11-29 14:31:32 +01009#
Harald Weltee2e41c12017-07-10 15:00:00 +020010
11if ! [ -x "$(command -v osmo-build-dep.sh)" ]; then
12 echo "Error: We need to have scripts/osmo-deps.sh from http://git.osmocom.org/osmo-ci/ in PATH !"
13 exit 2
14fi
15
Oliver Smith799d9722023-05-23 16:21:04 +020016exit_tar_workspace() {
Oliver Smith799d9722023-05-23 16:21:04 +020017 if [ "$IS_MASTER_BUILD" = "1" ]; then
18 tar -cJf "/tmp/workspace.tar.xz" "$base"
19 mv /tmp/workspace.tar.xz "$base"
20 fi
21
Vadim Yanitskiy912f3502023-05-28 03:03:13 +070022 cat-testlogs.sh
Oliver Smith799d9722023-05-23 16:21:04 +020023}
Holger Hans Peter Freythera47b4012016-04-13 19:03:38 -040024
25set -ex
26
Neels Hofmeyra3d93ed2016-07-11 19:39:51 +020027base="$PWD"
28deps="$base/deps"
29inst="$deps/install"
Neels Hofmeyrf1a56de2016-10-07 00:58:22 +020030export deps inst
Holger Hans Peter Freythera47b4012016-04-13 19:03:38 -040031
Neels Hofmeyr7f5ab9e2017-10-27 22:54:40 +020032osmo-clean-workspace.sh
33
Neels Hofmeyra3d93ed2016-07-11 19:39:51 +020034mkdir "$deps" || true
Neels Hofmeyra3d93ed2016-07-11 19:39:51 +020035
Neels Hofmeyrf1a56de2016-10-07 00:58:22 +020036osmo-build-dep.sh libosmocore "" ac_cv_path_DOXYGEN=false
Neels Hofmeyra3d93ed2016-07-11 19:39:51 +020037
Neels Hofmeyr6ecdbc92017-08-26 21:19:35 +020038verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]")
Neels Hofmeyrac27a992017-03-01 15:06:16 +010039
Neels Hofmeyra3d93ed2016-07-11 19:39:51 +020040export PKG_CONFIG_PATH="$inst/lib/pkgconfig:$PKG_CONFIG_PATH"
Neels Hofmeyrf1a56de2016-10-07 00:58:22 +020041export LD_LIBRARY_PATH="$inst/lib"
Oliver Smith42a6c392018-11-29 14:31:32 +010042export PATH="$inst/bin:$PATH"
Neels Hofmeyra3d93ed2016-07-11 19:39:51 +020043
Neels Hofmeyrf1a56de2016-10-07 00:58:22 +020044osmo-build-dep.sh libosmo-abis
Neels Hofmeyr4aa75e72017-03-31 14:03:39 +020045osmo-build-dep.sh libosmo-netif
Philipp Maierfbf66102017-04-09 12:32:51 +020046osmo-build-dep.sh libosmo-sccp
Vadim Yanitskiy088043f2022-08-29 00:42:02 +070047osmo-build-dep.sh libsmpp34
Neels Hofmeyrcf6a4872017-09-03 22:47:51 +020048osmo-build-dep.sh osmo-mgw
Harald Welte1ea6baf2018-07-31 19:40:52 +020049osmo-build-dep.sh osmo-hlr
Neels Hofmeyra3d93ed2016-07-11 19:39:51 +020050
Neels Hofmeyr97593742016-07-11 19:44:58 +020051if [ "x$IU" = "x--enable-iu" ]; then
Neels Hofmeyrf1a56de2016-10-07 00:58:22 +020052 osmo-build-dep.sh libasn1c
53 #osmo-build-dep.sh asn1c aper-prefix # only needed for make regen in osmo-iuh
Philipp Maierfbf66102017-04-09 12:32:51 +020054 osmo-build-dep.sh osmo-iuh
Neels Hofmeyr97593742016-07-11 19:44:58 +020055fi
56
Oliver Smith42a6c392018-11-29 14:31:32 +010057# Additional configure options and depends
58CONFIG=""
59if [ "$WITH_MANUALS" = "1" ]; then
Oliver Smith42a6c392018-11-29 14:31:32 +010060 CONFIG="--enable-manuals"
61fi
62
Neels Hofmeyrf1a56de2016-10-07 00:58:22 +020063set +x
64echo
65echo
66echo
Neels Hofmeyrf29ff882017-07-12 23:37:05 +020067echo " =============================== osmo-msc ==============================="
Neels Hofmeyrf1a56de2016-10-07 00:58:22 +020068echo
69set -x
70
Neels Hofmeyra3d93ed2016-07-11 19:39:51 +020071cd "$base"
Holger Hans Peter Freythera47b4012016-04-13 19:03:38 -040072autoreconf --install --force
Oliver Smithf5a0c4b2022-11-15 12:57:24 +010073./configure --enable-sanitize --enable-werror --enable-smpp $IU --enable-external-tests $CONFIG
Neels Hofmeyra3d93ed2016-07-11 19:39:51 +020074$MAKE $PARALLEL_MAKE
Neels Hofmeyrf1a56de2016-10-07 00:58:22 +020075LD_LIBRARY_PATH="$inst/lib" $MAKE check \
Oliver Smith799d9722023-05-23 16:21:04 +020076 || exit_tar_workspace
Neels Hofmeyr53edff32017-07-20 17:57:37 +020077LD_LIBRARY_PATH="$inst/lib" \
Oliver Smithf5a0c4b2022-11-15 12:57:24 +010078 DISTCHECK_CONFIGURE_FLAGS="--enable-werror --enable-smpp $IU --enable-external-tests $CONFIG" \
Pau Espin Pedrol5a58cef2020-10-12 19:37:24 +020079 $MAKE $PARALLEL_MAKE distcheck \
Oliver Smith799d9722023-05-23 16:21:04 +020080 || exit_tar_workspace
Neels Hofmeyr7f5ab9e2017-10-27 22:54:40 +020081
Oliver Smith42a6c392018-11-29 14:31:32 +010082if [ "$WITH_MANUALS" = "1" ] && [ "$PUBLISH" = "1" ]; then
83 make -C "$base/doc/manuals" publish
84fi
85
Pau Espin Pedrol5a58cef2020-10-12 19:37:24 +020086$MAKE $PARALLEL_MAKE maintainer-clean
Neels Hofmeyr7f5ab9e2017-10-27 22:54:40 +020087osmo-clean-workspace.sh