blob: 3fb5c0b62d60516c9f352689dcadaf74957276c4 [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
Neels Hofmeyr1eb5cbc2017-05-24 18:10:52 +020047# Installation in non-system dir, but keep the PKG_CONFIG_PATH from the SDK:
48export PKG_CONFIG_PATH="$prefix_real/lib/pkgconfig:$PKG_CONFIG_PATH"
49
Neels Hofmeyrdae3d3c2017-03-28 12:16:58 +020050for dep in $deps; do
Neels Hofmeyrd46ea132017-04-08 15:56:31 +020051 cd "$base/$dep"
52 rm -rf *
53 git checkout .
Neels Hofmeyrdae3d3c2017-03-28 12:16:58 +020054
Neels Hofmeyrd46ea132017-04-08 15:56:31 +020055 echo "$(git rev-parse HEAD) $dep" >> "$prefix_real/osmo-bts-sysmo_git_hashes.txt"
Neels Hofmeyrdae3d3c2017-03-28 12:16:58 +020056
Neels Hofmeyrd46ea132017-04-08 15:56:31 +020057 autoreconf -fi
Neels Hofmeyrdae3d3c2017-03-28 12:16:58 +020058
Neels Hofmeyrd46ea132017-04-08 15:56:31 +020059 config_opts=""
60 case "$dep" in
61 'libosmocore') config_opts="--disable-pcsc" ;;
62 'osmo-bts') config_opts="--enable-sysmocom-bts --with-openbsc=$base/openbsc/openbsc/include" ;;
63 esac
Neels Hofmeyrdae3d3c2017-03-28 12:16:58 +020064
Neels Hofmeyrd46ea132017-04-08 15:56:31 +020065 ./configure --prefix="$prefix" $CONFIGURE_FLAGS $config_opts
66 make -j8
67 make install
Neels Hofmeyrdae3d3c2017-03-28 12:16:58 +020068done
69
Neels Hofmeyr62a56002017-05-22 19:32:06 +020070# don't package documentation -- the libosmocore docs can be up to 16 Mb large,
71# a significant amount compared to the binaries
72rm -rf "$prefix_real/share/doc/libosmocore"
73
Neels Hofmeyrdae3d3c2017-03-28 12:16:58 +020074# build the archive that is going to be copied to the tester and then to the BTS
Neels Hofmeyrc59e0792017-05-14 01:57:25 +020075rm "$base"/*.tgz "$base"/*.md5 || true
Neels Hofmeyrd46ea132017-04-08 15:56:31 +020076cd "$prefix_real"
Neels Hofmeyrc59e0792017-05-14 01:57:25 +020077this="osmo-bts-sysmo.build-${BUILD_NUMBER}"
78tar="${this}.tgz"
79tar czf "$base/$tar" *
80cd "$base"
81md5sum "$tar" > "${this}.md5"