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 | 7fd177b | 2016-08-10 15:29:31 +0200 | [diff] [blame^] | 10 | # Compat: to be able to smoothly reconfigure the jenkins job, handle both |
| 11 | # old and new matrix variables |
| 12 | if [ -z "$with_dsp" -a "$sysmodsp" = yes ]; then |
| 13 | with_dsp="sysmo" |
| 14 | else |
| 15 | with_vty="yes" |
Holger Hans Peter Freyther | 1aa7527 | 2016-04-13 19:05:52 -0400 | [diff] [blame] | 16 | fi |
Neels Hofmeyr | 7fd177b | 2016-08-10 15:29:31 +0200 | [diff] [blame^] | 17 | # end of compat part |
Holger Hans Peter Freyther | 1aa7527 | 2016-04-13 19:05:52 -0400 | [diff] [blame] | 18 | |
Neels Hofmeyr | 6bae2d1 | 2016-08-10 14:42:16 +0200 | [diff] [blame] | 19 | base="$PWD" |
| 20 | deps="$base/deps" |
| 21 | inst="$deps/install" |
| 22 | |
| 23 | rm -rf "$inst" |
Neels Hofmeyr | 2d91260 | 2016-08-10 14:46:49 +0200 | [diff] [blame] | 24 | mkdir -p "$deps" |
| 25 | |
Neels Hofmeyr | 7fd177b | 2016-08-10 15:29:31 +0200 | [diff] [blame^] | 26 | # Collect configure options for osmo-pcu |
| 27 | PCU_CONFIG="" |
| 28 | if [ "$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 | |
| 43 | elif [ -z "$with_dsp" -o "$with_dsp" = none ]; then |
| 44 | echo "Direct DSP access disabled" |
| 45 | else |
| 46 | echo 'Invalid $with_dsp value:' $with_dsp |
| 47 | exit 1 |
| 48 | fi |
| 49 | |
| 50 | if [ "$with_vty" = "yes" ]; then |
| 51 | PCU_CONFIG="$PCU_CONFIG --enable-vty-tests" |
| 52 | elif [ -z "$with_vty" -o "$with_vty" = "no" ]; then |
| 53 | echo "VTY tests disabled" |
| 54 | else |
| 55 | echo 'Invalid $with_vty value:' $with_vty |
| 56 | exit 1 |
| 57 | fi |
| 58 | |
| 59 | # Build deps |
Neels Hofmeyr | 6bae2d1 | 2016-08-10 14:42:16 +0200 | [diff] [blame] | 60 | cd "$deps" |
Holger Hans Peter Freyther | 1aa7527 | 2016-04-13 19:05:52 -0400 | [diff] [blame] | 61 | osmo-deps.sh libosmocore |
Holger Hans Peter Freyther | 1aa7527 | 2016-04-13 19:05:52 -0400 | [diff] [blame] | 62 | cd libosmocore |
| 63 | autoreconf --install --force |
Neels Hofmeyr | 6bae2d1 | 2016-08-10 14:42:16 +0200 | [diff] [blame] | 64 | ./configure --prefix="$inst" |
Holger Hans Peter Freyther | 1aa7527 | 2016-04-13 19:05:52 -0400 | [diff] [blame] | 65 | $MAKE $PARALLEL_MAKE install |
| 66 | |
Neels Hofmeyr | 2d91260 | 2016-08-10 14:46:49 +0200 | [diff] [blame] | 67 | export PKG_CONFIG_PATH="$inst/lib/pkgconfig" |
| 68 | export LD_LIBRARY_PATH="$inst/lib" |
Neels Hofmeyr | 7fd177b | 2016-08-10 15:29:31 +0200 | [diff] [blame^] | 69 | |
| 70 | # Build osmo-pcu |
Neels Hofmeyr | 2d91260 | 2016-08-10 14:46:49 +0200 | [diff] [blame] | 71 | cd "$base" |
| 72 | autoreconf --install --force |
| 73 | ./configure $PCU_CONFIG |
| 74 | $MAKE $PARALLEL_MAKE |
| 75 | DISTCHECK_CONFIGURE_FLAGS="$PCU_CONFIG" AM_DISTCHECK_CONFIGURE_FLAGS="$PCU_CONFIG" $MAKE distcheck |