blob: 78269117738e5098a81b18d2930f7b975a6dff49 [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 Hofmeyr7fd177b2016-08-10 15:29:31 +020010# Compat: to be able to smoothly reconfigure the jenkins job, handle both
11# old and new matrix variables
12if [ -z "$with_dsp" -a "$sysmodsp" = yes ]; then
13 with_dsp="sysmo"
14else
15 with_vty="yes"
Holger Hans Peter Freyther1aa75272016-04-13 19:05:52 -040016fi
Neels Hofmeyr7fd177b2016-08-10 15:29:31 +020017# end of compat part
Holger Hans Peter Freyther1aa75272016-04-13 19:05:52 -040018
Neels Hofmeyr6bae2d12016-08-10 14:42:16 +020019base="$PWD"
20deps="$base/deps"
21inst="$deps/install"
22
23rm -rf "$inst"
Neels Hofmeyr2d912602016-08-10 14:46:49 +020024mkdir -p "$deps"
25
Neels Hofmeyr7fd177b2016-08-10 15:29:31 +020026# Collect configure options for osmo-pcu
27PCU_CONFIG=""
28if [ "$with_dsp" = sysmo ]; then
29 PCU_CONFIG="$PCU_CONFIG --enable-sysmocom-dsp"
30
31 # For direct sysmo DSP access, provide the SysmoBTS Layer 1 API
32 cd "$deps"
33 if [ ! -d layer1-api ]; then
34 git clone git://git.sysmocom.de/sysmo-bts/layer1-api.git layer1-api
35 fi
36 cd layer1-api
37 git fetch origin
38 git reset --hard origin/master
39 api_incl="$inst/include/sysmocom/femtobts/"
40 mkdir -p "$api_incl"
41 cp include/*.h "$api_incl"
42
43elif [ -z "$with_dsp" -o "$with_dsp" = none ]; then
44 echo "Direct DSP access disabled"
45else
46 echo 'Invalid $with_dsp value:' $with_dsp
47 exit 1
48fi
49
50if [ "$with_vty" = "yes" ]; then
51 PCU_CONFIG="$PCU_CONFIG --enable-vty-tests"
52elif [ -z "$with_vty" -o "$with_vty" = "no" ]; then
53 echo "VTY tests disabled"
54else
55 echo 'Invalid $with_vty value:' $with_vty
56 exit 1
57fi
58
59# Build deps
Neels Hofmeyr6bae2d12016-08-10 14:42:16 +020060cd "$deps"
Holger Hans Peter Freyther1aa75272016-04-13 19:05:52 -040061osmo-deps.sh libosmocore
Holger Hans Peter Freyther1aa75272016-04-13 19:05:52 -040062cd libosmocore
63autoreconf --install --force
Neels Hofmeyr6bae2d12016-08-10 14:42:16 +020064./configure --prefix="$inst"
Holger Hans Peter Freyther1aa75272016-04-13 19:05:52 -040065$MAKE $PARALLEL_MAKE install
66
Neels Hofmeyr2d912602016-08-10 14:46:49 +020067export PKG_CONFIG_PATH="$inst/lib/pkgconfig"
68export LD_LIBRARY_PATH="$inst/lib"
Neels Hofmeyr7fd177b2016-08-10 15:29:31 +020069
70# Build osmo-pcu
Neels Hofmeyr2d912602016-08-10 14:46:49 +020071cd "$base"
72autoreconf --install --force
73./configure $PCU_CONFIG
74$MAKE $PARALLEL_MAKE
75DISTCHECK_CONFIGURE_FLAGS="$PCU_CONFIG" AM_DISTCHECK_CONFIGURE_FLAGS="$PCU_CONFIG" $MAKE distcheck