blob: f321b8cd0f8d36a3aacf31e2d3d0f384dcdb41fe [file] [log] [blame]
Neels Hofmeyrd46ea132017-04-08 15:56:31 +02001#!/bin/sh
Neels Hofmeyrdae3d3c2017-03-28 12:16:58 +02002set -e -x
3
4deps="
5libosmocore
6libosmo-abis
7osmo-bts
8"
9
10base="$PWD"
Neels Hofmeyrd46ea132017-04-08 15:56:31 +020011rm -f "$base/osmo-bts-sysmo.*.tgz"
Neels Hofmeyrdae3d3c2017-03-28 12:16:58 +020012
13have_repo() {
14 repo="$1"
15 cd "$base"
Neels Hofmeyr07650982017-05-12 16:24:16 +020016 if [ ! -d "$repo" ]; then
17 git clone "git://git.osmocom.org/$repo" "$repo"
Neels Hofmeyrdae3d3c2017-03-28 12:16:58 +020018 fi
19 cd "$repo"
20 git clean -dxf
Neels Hofmeyr07650982017-05-12 16:24:16 +020021 git fetch origin
22 git reset --hard origin/master
23 git rev-parse HEAD
Neels Hofmeyrdae3d3c2017-03-28 12:16:58 +020024 cd "$base"
25}
26
27for dep in $deps; do
28 have_repo "$dep"
29done
30
31# for gsm_data_shared.h
32have_repo openbsc
33
34. /opt/poky/1.5.4/environment-setup-armv5te-poky-linux-gnueabi
35
Neels Hofmeyrd46ea132017-04-08 15:56:31 +020036# Cross-compilation: all installations need to be put in the sysmo SDK sysroot
Neels Hofmeyrdae3d3c2017-03-28 12:16:58 +020037export DESTDIR=/opt/poky/1.5.4/sysroots/armv5te-poky-linux-gnueabi
38
39prefix_base="/usr/local/jenkins-build"
40prefix_base_real="$DESTDIR$prefix_base"
41rm -rf "$prefix_base_real"
42
43prefix="$prefix_base/inst-osmo-bts-sysmo"
44prefix_real="$DESTDIR$prefix"
45mkdir -p "$prefix_real"
46
47for dep in $deps; do
Neels Hofmeyrd46ea132017-04-08 15:56:31 +020048 cd "$base/$dep"
49 rm -rf *
50 git checkout .
Neels Hofmeyrdae3d3c2017-03-28 12:16:58 +020051
Neels Hofmeyrd46ea132017-04-08 15:56:31 +020052 echo "$(git rev-parse HEAD) $dep" >> "$prefix_real/osmo-bts-sysmo_git_hashes.txt"
Neels Hofmeyrdae3d3c2017-03-28 12:16:58 +020053
Neels Hofmeyrd46ea132017-04-08 15:56:31 +020054 autoreconf -fi
Neels Hofmeyrdae3d3c2017-03-28 12:16:58 +020055
Neels Hofmeyrd46ea132017-04-08 15:56:31 +020056 config_opts=""
57 case "$dep" in
58 'libosmocore') config_opts="--disable-pcsc" ;;
59 'osmo-bts') config_opts="--enable-sysmocom-bts --with-openbsc=$base/openbsc/openbsc/include" ;;
60 esac
Neels Hofmeyrdae3d3c2017-03-28 12:16:58 +020061
Neels Hofmeyrd46ea132017-04-08 15:56:31 +020062 ./configure --prefix="$prefix" $CONFIGURE_FLAGS $config_opts
63 make -j8
64 make install
Neels Hofmeyrdae3d3c2017-03-28 12:16:58 +020065done
66
67# build the archive that is going to be copied to the tester and then to the BTS
Neels Hofmeyrc59e0792017-05-14 01:57:25 +020068rm "$base"/*.tgz "$base"/*.md5 || true
Neels Hofmeyrd46ea132017-04-08 15:56:31 +020069cd "$prefix_real"
Neels Hofmeyrc59e0792017-05-14 01:57:25 +020070this="osmo-bts-sysmo.build-${BUILD_NUMBER}"
71tar="${this}.tgz"
72tar czf "$base/$tar" *
73cd "$base"
74md5sum "$tar" > "${this}.md5"