blob: 8a963803142c17ab590c4c541033a35537a4a347 [file] [log] [blame]
Holger Hans Peter Freyther1aa75272016-04-13 19:05:52 -04001#!/usr/bin/env bash
2
3set -ex
4
Neels Hofmeyr0b4da052016-08-10 14:35:51 +02005if [ -z "$MAKE" ]; then
6 echo 'The $MAKE variable is not defined, cannot build'
7 exit 1
8fi
9
Neels Hofmeyr6bae2d12016-08-10 14:42:16 +020010base="$PWD"
11deps="$base/deps"
12inst="$deps/install"
Neels Hofmeyrf868bdb2016-10-10 00:55:12 +020013export deps inst
Neels Hofmeyr6bae2d12016-08-10 14:42:16 +020014
Neels Hofmeyrf868bdb2016-10-10 00:55:12 +020015mkdir "$deps" || true
Neels Hofmeyr6bae2d12016-08-10 14:42:16 +020016rm -rf "$inst"
Neels Hofmeyr2d912602016-08-10 14:46:49 +020017
Neels Hofmeyr7fd177b2016-08-10 15:29:31 +020018# Collect configure options for osmo-pcu
19PCU_CONFIG=""
20if [ "$with_dsp" = sysmo ]; then
21 PCU_CONFIG="$PCU_CONFIG --enable-sysmocom-dsp"
22
23 # For direct sysmo DSP access, provide the SysmoBTS Layer 1 API
24 cd "$deps"
25 if [ ! -d layer1-api ]; then
26 git clone git://git.sysmocom.de/sysmo-bts/layer1-api.git layer1-api
27 fi
28 cd layer1-api
29 git fetch origin
30 git reset --hard origin/master
31 api_incl="$inst/include/sysmocom/femtobts/"
32 mkdir -p "$api_incl"
33 cp include/*.h "$api_incl"
Neels Hofmeyrf868bdb2016-10-10 00:55:12 +020034 cd "$base"
Neels Hofmeyr7fd177b2016-08-10 15:29:31 +020035
36elif [ -z "$with_dsp" -o "$with_dsp" = none ]; then
37 echo "Direct DSP access disabled"
38else
39 echo 'Invalid $with_dsp value:' $with_dsp
40 exit 1
41fi
42
43if [ "$with_vty" = "yes" ]; then
44 PCU_CONFIG="$PCU_CONFIG --enable-vty-tests"
45elif [ -z "$with_vty" -o "$with_vty" = "no" ]; then
46 echo "VTY tests disabled"
47else
48 echo 'Invalid $with_vty value:' $with_vty
49 exit 1
50fi
51
52# Build deps
Neels Hofmeyrf868bdb2016-10-10 00:55:12 +020053osmo-build-dep.sh libosmocore
Holger Hans Peter Freyther1aa75272016-04-13 19:05:52 -040054
Neels Hofmeyr20827372017-03-01 15:48:39 +010055"$deps"/libosmocore/contrib/verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]")
56
Neels Hofmeyrf868bdb2016-10-10 00:55:12 +020057export PKG_CONFIG_PATH="$inst/lib/pkgconfig:$PKG_CONFIG_PATH"
Neels Hofmeyr2d912602016-08-10 14:46:49 +020058export LD_LIBRARY_PATH="$inst/lib"
Neels Hofmeyr7fd177b2016-08-10 15:29:31 +020059
Neels Hofmeyrf868bdb2016-10-10 00:55:12 +020060set +x
61echo
62echo
63echo
64echo " =============================== osmo-pcu ==============================="
65echo
66set -x
67
Neels Hofmeyr2d912602016-08-10 14:46:49 +020068autoreconf --install --force
69./configure $PCU_CONFIG
70$MAKE $PARALLEL_MAKE
Neels Hofmeyrf868bdb2016-10-10 00:55:12 +020071DISTCHECK_CONFIGURE_FLAGS="$PCU_CONFIG" AM_DISTCHECK_CONFIGURE_FLAGS="$PCU_CONFIG" \
72 $MAKE distcheck \
73 || cat-testlogs.sh