Holger Hans Peter Freyther | a47b401 | 2016-04-13 19:03:38 -0400 | [diff] [blame] | 1 | #!/usr/bin/env bash |
Harald Welte | e2e41c1 | 2017-07-10 15:00:00 +0200 | [diff] [blame] | 2 | # jenkins build helper script for openbsc. This is how we build on jenkins.osmocom.org |
Oliver Smith | 42a6c39 | 2018-11-29 14:31:32 +0100 | [diff] [blame] | 3 | # |
| 4 | # environment variables: |
| 5 | # * IU: configure 3G support (values: "--enable-iu", "--disable-iu") |
| 6 | # * WITH_MANUALS: build manual PDFs if set to "1" |
| 7 | # * PUBLISH: upload manuals after building if set to "1" (ignored without WITH_MANUALS = "1") |
Oliver Smith | 799d972 | 2023-05-23 16:21:04 +0200 | [diff] [blame] | 8 | # * IS_MASTER_BUILD: set to 1 when running from master-builds (not gerrit-verifications) |
Oliver Smith | 42a6c39 | 2018-11-29 14:31:32 +0100 | [diff] [blame] | 9 | # |
Harald Welte | e2e41c1 | 2017-07-10 15:00:00 +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 | |
Oliver Smith | 799d972 | 2023-05-23 16:21:04 +0200 | [diff] [blame] | 16 | exit_tar_workspace() { |
Oliver Smith | 799d972 | 2023-05-23 16:21:04 +0200 | [diff] [blame] | 17 | if [ "$IS_MASTER_BUILD" = "1" ]; then |
| 18 | tar -cJf "/tmp/workspace.tar.xz" "$base" |
| 19 | mv /tmp/workspace.tar.xz "$base" |
| 20 | fi |
| 21 | |
Vadim Yanitskiy | 912f350 | 2023-05-28 03:03:13 +0700 | [diff] [blame] | 22 | cat-testlogs.sh |
Oliver Smith | 799d972 | 2023-05-23 16:21:04 +0200 | [diff] [blame] | 23 | } |
Holger Hans Peter Freyther | a47b401 | 2016-04-13 19:03:38 -0400 | [diff] [blame] | 24 | |
| 25 | set -ex |
| 26 | |
Neels Hofmeyr | a3d93ed | 2016-07-11 19:39:51 +0200 | [diff] [blame] | 27 | base="$PWD" |
| 28 | deps="$base/deps" |
| 29 | inst="$deps/install" |
Neels Hofmeyr | f1a56de | 2016-10-07 00:58:22 +0200 | [diff] [blame] | 30 | export deps inst |
Holger Hans Peter Freyther | a47b401 | 2016-04-13 19:03:38 -0400 | [diff] [blame] | 31 | |
Neels Hofmeyr | 7f5ab9e | 2017-10-27 22:54:40 +0200 | [diff] [blame] | 32 | osmo-clean-workspace.sh |
| 33 | |
Neels Hofmeyr | a3d93ed | 2016-07-11 19:39:51 +0200 | [diff] [blame] | 34 | mkdir "$deps" || true |
Neels Hofmeyr | a3d93ed | 2016-07-11 19:39:51 +0200 | [diff] [blame] | 35 | |
Neels Hofmeyr | f1a56de | 2016-10-07 00:58:22 +0200 | [diff] [blame] | 36 | osmo-build-dep.sh libosmocore "" ac_cv_path_DOXYGEN=false |
Neels Hofmeyr | a3d93ed | 2016-07-11 19:39:51 +0200 | [diff] [blame] | 37 | |
Neels Hofmeyr | 6ecdbc9 | 2017-08-26 21:19:35 +0200 | [diff] [blame] | 38 | verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]") |
Neels Hofmeyr | ac27a99 | 2017-03-01 15:06:16 +0100 | [diff] [blame] | 39 | |
Neels Hofmeyr | a3d93ed | 2016-07-11 19:39:51 +0200 | [diff] [blame] | 40 | export PKG_CONFIG_PATH="$inst/lib/pkgconfig:$PKG_CONFIG_PATH" |
Neels Hofmeyr | f1a56de | 2016-10-07 00:58:22 +0200 | [diff] [blame] | 41 | export LD_LIBRARY_PATH="$inst/lib" |
Oliver Smith | 42a6c39 | 2018-11-29 14:31:32 +0100 | [diff] [blame] | 42 | export PATH="$inst/bin:$PATH" |
Neels Hofmeyr | a3d93ed | 2016-07-11 19:39:51 +0200 | [diff] [blame] | 43 | |
Neels Hofmeyr | f1a56de | 2016-10-07 00:58:22 +0200 | [diff] [blame] | 44 | osmo-build-dep.sh libosmo-abis |
Neels Hofmeyr | 4aa75e7 | 2017-03-31 14:03:39 +0200 | [diff] [blame] | 45 | osmo-build-dep.sh libosmo-netif |
Philipp Maier | fbf6610 | 2017-04-09 12:32:51 +0200 | [diff] [blame] | 46 | osmo-build-dep.sh libosmo-sccp |
Vadim Yanitskiy | 088043f | 2022-08-29 00:42:02 +0700 | [diff] [blame] | 47 | osmo-build-dep.sh libsmpp34 |
Neels Hofmeyr | cf6a487 | 2017-09-03 22:47:51 +0200 | [diff] [blame] | 48 | osmo-build-dep.sh osmo-mgw |
Harald Welte | 1ea6baf | 2018-07-31 19:40:52 +0200 | [diff] [blame] | 49 | osmo-build-dep.sh osmo-hlr |
Neels Hofmeyr | a3d93ed | 2016-07-11 19:39:51 +0200 | [diff] [blame] | 50 | |
Neels Hofmeyr | 9759374 | 2016-07-11 19:44:58 +0200 | [diff] [blame] | 51 | if [ "x$IU" = "x--enable-iu" ]; then |
Neels Hofmeyr | f1a56de | 2016-10-07 00:58:22 +0200 | [diff] [blame] | 52 | osmo-build-dep.sh libasn1c |
| 53 | #osmo-build-dep.sh asn1c aper-prefix # only needed for make regen in osmo-iuh |
Philipp Maier | fbf6610 | 2017-04-09 12:32:51 +0200 | [diff] [blame] | 54 | osmo-build-dep.sh osmo-iuh |
Neels Hofmeyr | 9759374 | 2016-07-11 19:44:58 +0200 | [diff] [blame] | 55 | fi |
| 56 | |
Oliver Smith | 42a6c39 | 2018-11-29 14:31:32 +0100 | [diff] [blame] | 57 | # Additional configure options and depends |
| 58 | CONFIG="" |
| 59 | if [ "$WITH_MANUALS" = "1" ]; then |
Oliver Smith | 42a6c39 | 2018-11-29 14:31:32 +0100 | [diff] [blame] | 60 | CONFIG="--enable-manuals" |
| 61 | fi |
| 62 | |
Neels Hofmeyr | f1a56de | 2016-10-07 00:58:22 +0200 | [diff] [blame] | 63 | set +x |
| 64 | echo |
| 65 | echo |
| 66 | echo |
Neels Hofmeyr | f29ff88 | 2017-07-12 23:37:05 +0200 | [diff] [blame] | 67 | echo " =============================== osmo-msc ===============================" |
Neels Hofmeyr | f1a56de | 2016-10-07 00:58:22 +0200 | [diff] [blame] | 68 | echo |
| 69 | set -x |
| 70 | |
Neels Hofmeyr | a3d93ed | 2016-07-11 19:39:51 +0200 | [diff] [blame] | 71 | cd "$base" |
Holger Hans Peter Freyther | a47b401 | 2016-04-13 19:03:38 -0400 | [diff] [blame] | 72 | autoreconf --install --force |
Oliver Smith | f5a0c4b | 2022-11-15 12:57:24 +0100 | [diff] [blame] | 73 | ./configure --enable-sanitize --enable-werror --enable-smpp $IU --enable-external-tests $CONFIG |
Neels Hofmeyr | a3d93ed | 2016-07-11 19:39:51 +0200 | [diff] [blame] | 74 | $MAKE $PARALLEL_MAKE |
Neels Hofmeyr | f1a56de | 2016-10-07 00:58:22 +0200 | [diff] [blame] | 75 | LD_LIBRARY_PATH="$inst/lib" $MAKE check \ |
Oliver Smith | 799d972 | 2023-05-23 16:21:04 +0200 | [diff] [blame] | 76 | || exit_tar_workspace |
Neels Hofmeyr | 53edff3 | 2017-07-20 17:57:37 +0200 | [diff] [blame] | 77 | LD_LIBRARY_PATH="$inst/lib" \ |
Oliver Smith | f5a0c4b | 2022-11-15 12:57:24 +0100 | [diff] [blame] | 78 | DISTCHECK_CONFIGURE_FLAGS="--enable-werror --enable-smpp $IU --enable-external-tests $CONFIG" \ |
Pau Espin Pedrol | 5a58cef | 2020-10-12 19:37:24 +0200 | [diff] [blame] | 79 | $MAKE $PARALLEL_MAKE distcheck \ |
Oliver Smith | 799d972 | 2023-05-23 16:21:04 +0200 | [diff] [blame] | 80 | || exit_tar_workspace |
Neels Hofmeyr | 7f5ab9e | 2017-10-27 22:54:40 +0200 | [diff] [blame] | 81 | |
Oliver Smith | 42a6c39 | 2018-11-29 14:31:32 +0100 | [diff] [blame] | 82 | if [ "$WITH_MANUALS" = "1" ] && [ "$PUBLISH" = "1" ]; then |
| 83 | make -C "$base/doc/manuals" publish |
| 84 | fi |
| 85 | |
Pau Espin Pedrol | 5a58cef | 2020-10-12 19:37:24 +0200 | [diff] [blame] | 86 | $MAKE $PARALLEL_MAKE maintainer-clean |
Neels Hofmeyr | 7f5ab9e | 2017-10-27 22:54:40 +0200 | [diff] [blame] | 87 | osmo-clean-workspace.sh |