blob: 7b456c263583fc5ca98e864af11a1550f7d1563e [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"
13
14rm -rf "$inst"
Neels Hofmeyr2d912602016-08-10 14:46:49 +020015mkdir -p "$deps"
16
Neels Hofmeyr7fd177b2016-08-10 15:29:31 +020017# Collect configure options for osmo-pcu
18PCU_CONFIG=""
19if [ "$with_dsp" = sysmo ]; then
20 PCU_CONFIG="$PCU_CONFIG --enable-sysmocom-dsp"
21
22 # For direct sysmo DSP access, provide the SysmoBTS Layer 1 API
23 cd "$deps"
24 if [ ! -d layer1-api ]; then
25 git clone git://git.sysmocom.de/sysmo-bts/layer1-api.git layer1-api
26 fi
27 cd layer1-api
28 git fetch origin
29 git reset --hard origin/master
30 api_incl="$inst/include/sysmocom/femtobts/"
31 mkdir -p "$api_incl"
32 cp include/*.h "$api_incl"
33
34elif [ -z "$with_dsp" -o "$with_dsp" = none ]; then
35 echo "Direct DSP access disabled"
36else
37 echo 'Invalid $with_dsp value:' $with_dsp
38 exit 1
39fi
40
41if [ "$with_vty" = "yes" ]; then
42 PCU_CONFIG="$PCU_CONFIG --enable-vty-tests"
43elif [ -z "$with_vty" -o "$with_vty" = "no" ]; then
44 echo "VTY tests disabled"
45else
46 echo 'Invalid $with_vty value:' $with_vty
47 exit 1
48fi
49
50# Build deps
Neels Hofmeyr6bae2d12016-08-10 14:42:16 +020051cd "$deps"
Holger Hans Peter Freyther1aa75272016-04-13 19:05:52 -040052osmo-deps.sh libosmocore
Holger Hans Peter Freyther1aa75272016-04-13 19:05:52 -040053cd libosmocore
54autoreconf --install --force
Neels Hofmeyr6bae2d12016-08-10 14:42:16 +020055./configure --prefix="$inst"
Holger Hans Peter Freyther1aa75272016-04-13 19:05:52 -040056$MAKE $PARALLEL_MAKE install
57
Neels Hofmeyr2d912602016-08-10 14:46:49 +020058export PKG_CONFIG_PATH="$inst/lib/pkgconfig"
59export LD_LIBRARY_PATH="$inst/lib"
Neels Hofmeyr7fd177b2016-08-10 15:29:31 +020060
61# Build osmo-pcu
Neels Hofmeyr2d912602016-08-10 14:46:49 +020062cd "$base"
63autoreconf --install --force
64./configure $PCU_CONFIG
65$MAKE $PARALLEL_MAKE
66DISTCHECK_CONFIGURE_FLAGS="$PCU_CONFIG" AM_DISTCHECK_CONFIGURE_FLAGS="$PCU_CONFIG" $MAKE distcheck