blob: 7af73091dd2aa29ab2f8a89966090438ded835aa [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
Neels Hofmeyr7fd177b2016-08-10 15:29:31 +020051elif [ -z "$with_dsp" -o "$with_dsp" = none ]; then
Max406a1f02017-12-21 17:34:19 +010052 echo "Direct DSP access disabled, sanitizer enabled"
Pau Espin Pedrole176a4d2018-06-20 23:30:36 +020053 PCU_CONFIG="$PCU_CONFIG --enable-werror --enable-sanitize"
Neels Hofmeyr7fd177b2016-08-10 15:29:31 +020054else
55 echo 'Invalid $with_dsp value:' $with_dsp
56 exit 1
57fi
58
Max3e659ea2018-01-12 16:30:10 +010059if [ "$with_vty" = "True" ]; then
Neels Hofmeyr7fd177b2016-08-10 15:29:31 +020060 PCU_CONFIG="$PCU_CONFIG --enable-vty-tests"
Max3e659ea2018-01-12 16:30:10 +010061elif [ -z "$with_vty" -o "$with_vty" = "False" ]; then
Neels Hofmeyr7fd177b2016-08-10 15:29:31 +020062 echo "VTY tests disabled"
63else
64 echo 'Invalid $with_vty value:' $with_vty
65 exit 1
66fi
67
Max10e37a52017-08-24 14:23:12 +020068verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]")
69
Neels Hofmeyr7fd177b2016-08-10 15:29:31 +020070# Build deps
Max4cb6e042018-01-17 16:14:59 +010071osmo-build-dep.sh libosmocore "" --disable-doxygen
Holger Hans Peter Freyther1aa75272016-04-13 19:05:52 -040072
Neels Hofmeyrf868bdb2016-10-10 00:55:12 +020073export PKG_CONFIG_PATH="$inst/lib/pkgconfig:$PKG_CONFIG_PATH"
Neels Hofmeyr2d912602016-08-10 14:46:49 +020074export LD_LIBRARY_PATH="$inst/lib"
Oliver Smith64bc9402018-11-29 14:57:28 +010075export PATH="$inst/bin:$PATH"
76
77if [ "$WITH_MANUALS" = "1" ]; then
78 osmo-build-dep.sh osmo-gsm-manuals
79 PCU_CONFIG="$PCU_CONFIG --enable-manuals"
80fi
Neels Hofmeyr7fd177b2016-08-10 15:29:31 +020081
Neels Hofmeyrf868bdb2016-10-10 00:55:12 +020082set +x
83echo
84echo
85echo
86echo " =============================== osmo-pcu ==============================="
87echo
88set -x
89
Neels Hofmeyr2d912602016-08-10 14:46:49 +020090autoreconf --install --force
91./configure $PCU_CONFIG
92$MAKE $PARALLEL_MAKE
Oliver Smith61469d12018-12-04 15:24:54 +010093DISTCHECK_CONFIGURE_FLAGS="$PCU_CONFIG" \
Neels Hofmeyrf868bdb2016-10-10 00:55:12 +020094 $MAKE distcheck \
95 || cat-testlogs.sh
Neels Hofmeyr49beba42017-10-27 22:54:44 +020096
Oliver Smith64bc9402018-11-29 14:57:28 +010097if [ "$WITH_MANUALS" = "1" ] && [ "$PUBLISH" = "1" ]; then
98 make -C "$base/doc/manuals" publish
99fi
100
Neels Hofmeyr49beba42017-10-27 22:54:44 +0200101osmo-clean-workspace.sh