blob: 7c620b927f2f0bee7d1501423512be46444f6687 [file] [log] [blame]
Max062dfa12017-06-13 18:39:52 +02001#!/bin/sh
Harald Welte8c8027c2017-07-10 15:03:27 +02002# jenkins build helper script for osmo-pcu. This is how we build on jenkins.osmocom.org
Oliver Smith64bc9402018-11-29 14:57:28 +01003#
4# environment variables:
5# * with_dsp: the DSP to configure ("sysmo", "lc15" or "none")
6# * with_vty: enable VTY tests if set to "True"
7# * WITH_MANUALS: build manual PDFs if set to "1"
8# * PUBLISH: upload manuals after building if set to "1" (ignored without WITH_MANUALS = "1")
9#
Harald Welte8c8027c2017-07-10 15:03:27 +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
Holger Hans Peter Freyther1aa75272016-04-13 19:05:52 -040016
17set -ex
18
Neels Hofmeyr0b4da052016-08-10 14:35:51 +020019if [ -z "$MAKE" ]; then
20 echo 'The $MAKE variable is not defined, cannot build'
21 exit 1
22fi
23
Neels Hofmeyr6bae2d12016-08-10 14:42:16 +020024base="$PWD"
25deps="$base/deps"
26inst="$deps/install"
Neels Hofmeyrf868bdb2016-10-10 00:55:12 +020027export deps inst
Neels Hofmeyr6bae2d12016-08-10 14:42:16 +020028
Neels Hofmeyr49beba42017-10-27 22:54:44 +020029osmo-clean-workspace.sh
30
Neels Hofmeyrf868bdb2016-10-10 00:55:12 +020031mkdir "$deps" || true
Neels Hofmeyr2d912602016-08-10 14:46:49 +020032
Neels Hofmeyr7fd177b2016-08-10 15:29:31 +020033# Collect configure options for osmo-pcu
34PCU_CONFIG=""
35if [ "$with_dsp" = sysmo ]; then
Pau Espin Pedrole176a4d2018-06-20 23:30:36 +020036 PCU_CONFIG="$PCU_CONFIG --enable-werror --enable-sysmocom-dsp --with-sysmobts=$inst/include/"
Neels Hofmeyr7fd177b2016-08-10 15:29:31 +020037
38 # For direct sysmo DSP access, provide the SysmoBTS Layer 1 API
39 cd "$deps"
Max062dfa12017-06-13 18:39:52 +020040 osmo-layer1-headers.sh sysmo
Max186206c2018-01-15 16:43:22 +010041 mkdir -p "$inst/include/sysmocom/femtobts"
42 ln -s $deps/layer1-headers/include/* "$inst/include/sysmocom/femtobts/"
Neels Hofmeyrf868bdb2016-10-10 00:55:12 +020043 cd "$base"
Neels Hofmeyr7fd177b2016-08-10 15:29:31 +020044
Max062dfa12017-06-13 18:39:52 +020045elif [ "$with_dsp" = lc15 ]; then
46 PCU_CONFIG="$PCU_CONFIG --enable-lc15bts-phy --with-litecell15=$deps/layer1-headers/inc"
47 cd "$deps"
Max865436d2017-06-22 18:23:09 +020048 osmo-layer1-headers.sh lc15 "$FIRMWARE_VERSION"
Max062dfa12017-06-13 18:39:52 +020049 cd "$base"
50
Daniel Willmann8ab35b12019-03-27 14:06:21 +010051elif [ "$with_dsp" = oc2g ]; then
52 PCU_CONFIG="$PCU_CONFIG --enable-oc2gbts-phy --with-oc2g=$deps/layer1-headers/inc"
53 cd "$deps"
54 osmo-layer1-headers.sh oc2g "$FIRMWARE_VERSION"
55 cd "$base"
56
Neels Hofmeyr7fd177b2016-08-10 15:29:31 +020057elif [ -z "$with_dsp" -o "$with_dsp" = none ]; then
Max406a1f02017-12-21 17:34:19 +010058 echo "Direct DSP access disabled, sanitizer enabled"
Pau Espin Pedrole176a4d2018-06-20 23:30:36 +020059 PCU_CONFIG="$PCU_CONFIG --enable-werror --enable-sanitize"
Neels Hofmeyr7fd177b2016-08-10 15:29:31 +020060else
61 echo 'Invalid $with_dsp value:' $with_dsp
62 exit 1
63fi
64
Max3e659ea2018-01-12 16:30:10 +010065if [ "$with_vty" = "True" ]; then
Neels Hofmeyr7fd177b2016-08-10 15:29:31 +020066 PCU_CONFIG="$PCU_CONFIG --enable-vty-tests"
Max3e659ea2018-01-12 16:30:10 +010067elif [ -z "$with_vty" -o "$with_vty" = "False" ]; then
Neels Hofmeyr7fd177b2016-08-10 15:29:31 +020068 echo "VTY tests disabled"
69else
70 echo 'Invalid $with_vty value:' $with_vty
71 exit 1
72fi
73
Max10e37a52017-08-24 14:23:12 +020074verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]")
75
Neels Hofmeyr7fd177b2016-08-10 15:29:31 +020076# Build deps
Max4cb6e042018-01-17 16:14:59 +010077osmo-build-dep.sh libosmocore "" --disable-doxygen
Holger Hans Peter Freyther1aa75272016-04-13 19:05:52 -040078
Neels Hofmeyrf868bdb2016-10-10 00:55:12 +020079export PKG_CONFIG_PATH="$inst/lib/pkgconfig:$PKG_CONFIG_PATH"
Neels Hofmeyr2d912602016-08-10 14:46:49 +020080export LD_LIBRARY_PATH="$inst/lib"
Oliver Smith64bc9402018-11-29 14:57:28 +010081export PATH="$inst/bin:$PATH"
82
83if [ "$WITH_MANUALS" = "1" ]; then
Oliver Smith64bc9402018-11-29 14:57:28 +010084 PCU_CONFIG="$PCU_CONFIG --enable-manuals"
85fi
Neels Hofmeyr7fd177b2016-08-10 15:29:31 +020086
Neels Hofmeyrf868bdb2016-10-10 00:55:12 +020087set +x
88echo
89echo
90echo
91echo " =============================== osmo-pcu ==============================="
92echo
93set -x
94
Neels Hofmeyr2d912602016-08-10 14:46:49 +020095autoreconf --install --force
96./configure $PCU_CONFIG
97$MAKE $PARALLEL_MAKE
Oliver Smith61469d12018-12-04 15:24:54 +010098DISTCHECK_CONFIGURE_FLAGS="$PCU_CONFIG" \
Pau Espin Pedrol38396052020-10-12 19:45:21 +020099 $MAKE $PARALLEL_MAKE distcheck \
Neels Hofmeyrf868bdb2016-10-10 00:55:12 +0200100 || cat-testlogs.sh
Neels Hofmeyr49beba42017-10-27 22:54:44 +0200101
Oliver Smith64bc9402018-11-29 14:57:28 +0100102if [ "$WITH_MANUALS" = "1" ] && [ "$PUBLISH" = "1" ]; then
103 make -C "$base/doc/manuals" publish
104fi
105
Pau Espin Pedrol38396052020-10-12 19:45:21 +0200106$MAKE $PARALLEL_MAKE maintainer-clean
Neels Hofmeyr49beba42017-10-27 22:54:44 +0200107osmo-clean-workspace.sh