Max | 062dfa1 | 2017-06-13 18:39:52 +0200 | [diff] [blame] | 1 | #!/bin/sh |
Harald Welte | 8c8027c | 2017-07-10 15:03:27 +0200 | [diff] [blame] | 2 | # jenkins build helper script for osmo-pcu. This is how we build on jenkins.osmocom.org |
Oliver Smith | 64bc940 | 2018-11-29 14:57:28 +0100 | [diff] [blame] | 3 | # |
| 4 | # environment variables: |
| 5 | # * with_dsp: the DSP to configure ("sysmo", "lc15" or "none") |
| 6 | # * with_vty: enable VTY tests if set to "True" |
| 7 | # * WITH_MANUALS: build manual PDFs if set to "1" |
| 8 | # * PUBLISH: upload manuals after building if set to "1" (ignored without WITH_MANUALS = "1") |
| 9 | # |
Harald Welte | 8c8027c | 2017-07-10 15:03:27 +0200 | [diff] [blame] | 10 | |
| 11 | if ! [ -x "$(command -v osmo-build-dep.sh)" ]; then |
| 12 | echo "Error: We need to have scripts/osmo-deps.sh from http://git.osmocom.org/osmo-ci/ in PATH !" |
| 13 | exit 2 |
| 14 | fi |
| 15 | |
Holger Hans Peter Freyther | 1aa7527 | 2016-04-13 19:05:52 -0400 | [diff] [blame] | 16 | |
| 17 | set -ex |
| 18 | |
Neels Hofmeyr | 0b4da05 | 2016-08-10 14:35:51 +0200 | [diff] [blame] | 19 | if [ -z "$MAKE" ]; then |
| 20 | echo 'The $MAKE variable is not defined, cannot build' |
| 21 | exit 1 |
| 22 | fi |
| 23 | |
Neels Hofmeyr | 6bae2d1 | 2016-08-10 14:42:16 +0200 | [diff] [blame] | 24 | base="$PWD" |
| 25 | deps="$base/deps" |
| 26 | inst="$deps/install" |
Neels Hofmeyr | f868bdb | 2016-10-10 00:55:12 +0200 | [diff] [blame] | 27 | export deps inst |
Neels Hofmeyr | 6bae2d1 | 2016-08-10 14:42:16 +0200 | [diff] [blame] | 28 | |
Neels Hofmeyr | 49beba4 | 2017-10-27 22:54:44 +0200 | [diff] [blame] | 29 | osmo-clean-workspace.sh |
| 30 | |
Neels Hofmeyr | f868bdb | 2016-10-10 00:55:12 +0200 | [diff] [blame] | 31 | mkdir "$deps" || true |
Neels Hofmeyr | 2d91260 | 2016-08-10 14:46:49 +0200 | [diff] [blame] | 32 | |
Neels Hofmeyr | 7fd177b | 2016-08-10 15:29:31 +0200 | [diff] [blame] | 33 | # Collect configure options for osmo-pcu |
| 34 | PCU_CONFIG="" |
| 35 | if [ "$with_dsp" = sysmo ]; then |
Pau Espin Pedrol | e176a4d | 2018-06-20 23:30:36 +0200 | [diff] [blame] | 36 | PCU_CONFIG="$PCU_CONFIG --enable-werror --enable-sysmocom-dsp --with-sysmobts=$inst/include/" |
Neels Hofmeyr | 7fd177b | 2016-08-10 15:29:31 +0200 | [diff] [blame] | 37 | |
| 38 | # For direct sysmo DSP access, provide the SysmoBTS Layer 1 API |
| 39 | cd "$deps" |
Max | 062dfa1 | 2017-06-13 18:39:52 +0200 | [diff] [blame] | 40 | osmo-layer1-headers.sh sysmo |
Max | 186206c | 2018-01-15 16:43:22 +0100 | [diff] [blame] | 41 | mkdir -p "$inst/include/sysmocom/femtobts" |
| 42 | ln -s $deps/layer1-headers/include/* "$inst/include/sysmocom/femtobts/" |
Neels Hofmeyr | f868bdb | 2016-10-10 00:55:12 +0200 | [diff] [blame] | 43 | cd "$base" |
Neels Hofmeyr | 7fd177b | 2016-08-10 15:29:31 +0200 | [diff] [blame] | 44 | |
Max | 062dfa1 | 2017-06-13 18:39:52 +0200 | [diff] [blame] | 45 | elif [ "$with_dsp" = lc15 ]; then |
| 46 | PCU_CONFIG="$PCU_CONFIG --enable-lc15bts-phy --with-litecell15=$deps/layer1-headers/inc" |
| 47 | cd "$deps" |
Max | 865436d | 2017-06-22 18:23:09 +0200 | [diff] [blame] | 48 | osmo-layer1-headers.sh lc15 "$FIRMWARE_VERSION" |
Max | 062dfa1 | 2017-06-13 18:39:52 +0200 | [diff] [blame] | 49 | cd "$base" |
| 50 | |
Daniel Willmann | 8ab35b1 | 2019-03-27 14:06:21 +0100 | [diff] [blame] | 51 | elif [ "$with_dsp" = oc2g ]; then |
| 52 | PCU_CONFIG="$PCU_CONFIG --enable-oc2gbts-phy --with-oc2g=$deps/layer1-headers/inc" |
| 53 | cd "$deps" |
| 54 | osmo-layer1-headers.sh oc2g "$FIRMWARE_VERSION" |
| 55 | cd "$base" |
| 56 | |
Neels Hofmeyr | 7fd177b | 2016-08-10 15:29:31 +0200 | [diff] [blame] | 57 | elif [ -z "$with_dsp" -o "$with_dsp" = none ]; then |
Max | 406a1f0 | 2017-12-21 17:34:19 +0100 | [diff] [blame] | 58 | echo "Direct DSP access disabled, sanitizer enabled" |
Pau Espin Pedrol | e176a4d | 2018-06-20 23:30:36 +0200 | [diff] [blame] | 59 | PCU_CONFIG="$PCU_CONFIG --enable-werror --enable-sanitize" |
Neels Hofmeyr | 7fd177b | 2016-08-10 15:29:31 +0200 | [diff] [blame] | 60 | else |
| 61 | echo 'Invalid $with_dsp value:' $with_dsp |
| 62 | exit 1 |
| 63 | fi |
| 64 | |
Max | 3e659ea | 2018-01-12 16:30:10 +0100 | [diff] [blame] | 65 | if [ "$with_vty" = "True" ]; then |
Neels Hofmeyr | 7fd177b | 2016-08-10 15:29:31 +0200 | [diff] [blame] | 66 | PCU_CONFIG="$PCU_CONFIG --enable-vty-tests" |
Max | 3e659ea | 2018-01-12 16:30:10 +0100 | [diff] [blame] | 67 | elif [ -z "$with_vty" -o "$with_vty" = "False" ]; then |
Neels Hofmeyr | 7fd177b | 2016-08-10 15:29:31 +0200 | [diff] [blame] | 68 | echo "VTY tests disabled" |
| 69 | else |
| 70 | echo 'Invalid $with_vty value:' $with_vty |
| 71 | exit 1 |
| 72 | fi |
| 73 | |
Max | 10e37a5 | 2017-08-24 14:23:12 +0200 | [diff] [blame] | 74 | verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]") |
| 75 | |
Neels Hofmeyr | 7fd177b | 2016-08-10 15:29:31 +0200 | [diff] [blame] | 76 | # Build deps |
Max | 4cb6e04 | 2018-01-17 16:14:59 +0100 | [diff] [blame] | 77 | osmo-build-dep.sh libosmocore "" --disable-doxygen |
Holger Hans Peter Freyther | 1aa7527 | 2016-04-13 19:05:52 -0400 | [diff] [blame] | 78 | |
Neels Hofmeyr | f868bdb | 2016-10-10 00:55:12 +0200 | [diff] [blame] | 79 | export PKG_CONFIG_PATH="$inst/lib/pkgconfig:$PKG_CONFIG_PATH" |
Neels Hofmeyr | 2d91260 | 2016-08-10 14:46:49 +0200 | [diff] [blame] | 80 | export LD_LIBRARY_PATH="$inst/lib" |
Oliver Smith | 64bc940 | 2018-11-29 14:57:28 +0100 | [diff] [blame] | 81 | export PATH="$inst/bin:$PATH" |
| 82 | |
| 83 | if [ "$WITH_MANUALS" = "1" ]; then |
| 84 | osmo-build-dep.sh osmo-gsm-manuals |
| 85 | PCU_CONFIG="$PCU_CONFIG --enable-manuals" |
| 86 | fi |
Neels Hofmeyr | 7fd177b | 2016-08-10 15:29:31 +0200 | [diff] [blame] | 87 | |
Neels Hofmeyr | f868bdb | 2016-10-10 00:55:12 +0200 | [diff] [blame] | 88 | set +x |
| 89 | echo |
| 90 | echo |
| 91 | echo |
| 92 | echo " =============================== osmo-pcu ===============================" |
| 93 | echo |
| 94 | set -x |
| 95 | |
Neels Hofmeyr | 2d91260 | 2016-08-10 14:46:49 +0200 | [diff] [blame] | 96 | autoreconf --install --force |
| 97 | ./configure $PCU_CONFIG |
| 98 | $MAKE $PARALLEL_MAKE |
Oliver Smith | 61469d1 | 2018-12-04 15:24:54 +0100 | [diff] [blame] | 99 | DISTCHECK_CONFIGURE_FLAGS="$PCU_CONFIG" \ |
Neels Hofmeyr | f868bdb | 2016-10-10 00:55:12 +0200 | [diff] [blame] | 100 | $MAKE distcheck \ |
| 101 | || cat-testlogs.sh |
Neels Hofmeyr | 49beba4 | 2017-10-27 22:54:44 +0200 | [diff] [blame] | 102 | |
Oliver Smith | 64bc940 | 2018-11-29 14:57:28 +0100 | [diff] [blame] | 103 | if [ "$WITH_MANUALS" = "1" ] && [ "$PUBLISH" = "1" ]; then |
| 104 | make -C "$base/doc/manuals" publish |
| 105 | fi |
| 106 | |
Neels Hofmeyr | 49beba4 | 2017-10-27 22:54:44 +0200 | [diff] [blame] | 107 | osmo-clean-workspace.sh |