Holger Hans Peter Freyther | 1aa7527 | 2016-04-13 19:05:52 -0400 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | |
| 3 | set -ex |
| 4 | |
Neels Hofmeyr | 0b4da05 | 2016-08-10 14:35:51 +0200 | [diff] [blame] | 5 | if [ -z "$MAKE" ]; then |
| 6 | echo 'The $MAKE variable is not defined, cannot build' |
| 7 | exit 1 |
| 8 | fi |
| 9 | |
Neels Hofmeyr | 6bae2d1 | 2016-08-10 14:42:16 +0200 | [diff] [blame] | 10 | base="$PWD" |
| 11 | deps="$base/deps" |
| 12 | inst="$deps/install" |
| 13 | |
| 14 | rm -rf "$inst" |
Neels Hofmeyr | 2d91260 | 2016-08-10 14:46:49 +0200 | [diff] [blame] | 15 | mkdir -p "$deps" |
| 16 | |
Neels Hofmeyr | 7fd177b | 2016-08-10 15:29:31 +0200 | [diff] [blame] | 17 | # Collect configure options for osmo-pcu |
| 18 | PCU_CONFIG="" |
| 19 | if [ "$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 | |
| 34 | elif [ -z "$with_dsp" -o "$with_dsp" = none ]; then |
| 35 | echo "Direct DSP access disabled" |
| 36 | else |
| 37 | echo 'Invalid $with_dsp value:' $with_dsp |
| 38 | exit 1 |
| 39 | fi |
| 40 | |
| 41 | if [ "$with_vty" = "yes" ]; then |
| 42 | PCU_CONFIG="$PCU_CONFIG --enable-vty-tests" |
| 43 | elif [ -z "$with_vty" -o "$with_vty" = "no" ]; then |
| 44 | echo "VTY tests disabled" |
| 45 | else |
| 46 | echo 'Invalid $with_vty value:' $with_vty |
| 47 | exit 1 |
| 48 | fi |
| 49 | |
| 50 | # Build deps |
Neels Hofmeyr | 6bae2d1 | 2016-08-10 14:42:16 +0200 | [diff] [blame] | 51 | cd "$deps" |
Holger Hans Peter Freyther | 1aa7527 | 2016-04-13 19:05:52 -0400 | [diff] [blame] | 52 | osmo-deps.sh libosmocore |
Holger Hans Peter Freyther | 1aa7527 | 2016-04-13 19:05:52 -0400 | [diff] [blame] | 53 | cd libosmocore |
| 54 | autoreconf --install --force |
Neels Hofmeyr | 6bae2d1 | 2016-08-10 14:42:16 +0200 | [diff] [blame] | 55 | ./configure --prefix="$inst" |
Holger Hans Peter Freyther | 1aa7527 | 2016-04-13 19:05:52 -0400 | [diff] [blame] | 56 | $MAKE $PARALLEL_MAKE install |
| 57 | |
Neels Hofmeyr | 2d91260 | 2016-08-10 14:46:49 +0200 | [diff] [blame] | 58 | export PKG_CONFIG_PATH="$inst/lib/pkgconfig" |
| 59 | export LD_LIBRARY_PATH="$inst/lib" |
Neels Hofmeyr | 7fd177b | 2016-08-10 15:29:31 +0200 | [diff] [blame] | 60 | |
| 61 | # Build osmo-pcu |
Neels Hofmeyr | 2d91260 | 2016-08-10 14:46:49 +0200 | [diff] [blame] | 62 | cd "$base" |
| 63 | autoreconf --install --force |
| 64 | ./configure $PCU_CONFIG |
| 65 | $MAKE $PARALLEL_MAKE |
| 66 | DISTCHECK_CONFIGURE_FLAGS="$PCU_CONFIG" AM_DISTCHECK_CONFIGURE_FLAGS="$PCU_CONFIG" $MAKE distcheck |