blob: 7e7148879ae6d7bbe6a1d3f08f0a6e200b6dd523 [file] [log] [blame]
Neels Hofmeyr0d05d362017-05-18 15:15:19 +02001#!/bin/sh
2set -e -x
3
4base="$PWD"
5prefix="$base/inst-osmo-msc"
6
7rm -f "$base/osmo-msc*.tgz"
8
9git_url="git://git.osmocom.org"
10
11have_repo() {
12 repo="$1"
13 branch="${2-master}"
14
15 cd "$base"
16 if [ ! -d "$repo" ]; then
17 git clone "$git_url/$repo" -b "$branch" "$repo"
18 fi
19 cd "$repo"
20 rm -rf *
21 git fetch origin
22 git checkout .
23 git checkout "$branch"
24 git reset --hard origin/"$branch"
25 git rev-parse HEAD
26
27 cd "$base"
28}
29
30build_repo() {
31 dep="$1"
32 branch="${2-master}"
33
34 have_repo "$dep" "$branch"
35
36 cd "$dep"
37
38 echo "$(git rev-parse HEAD) $dep" >> "$prefix/osmo-msc_git_hashes.txt"
39
40 config_opts=""
41
42 case "$dep" in
43 'openbsc')
44 config_opts="$config_opts --enable-smpp --enable-osmo-bsc --enable-nat --enable-iu"
45 cd openbsc/
46 ;;
47 esac
48
49 autoreconf -fi
50 ./configure --prefix="$prefix" $config_opts
51 make -j8 || make # libsmpp34 can't build in parallel
52 make install
53}
54
55rm -rf "$prefix"
56mkdir -p "$prefix"
57
58export PKG_CONFIG_PATH="$prefix/lib/pkgconfig"
59export LD_LIBRARY_PATH="$prefix/lib"
60
61build_repo libosmocore
62build_repo libosmo-abis
63build_repo libosmo-netif
64build_repo openggsn
65build_repo libsmpp34
66build_repo libosmo-sccp neels/aoip # TEMPORARY BRANCH
67build_repo libasn1c
68build_repo osmo-iuh neels/sigtran # TEMPORARY BRANCH
69build_repo openbsc aoip
70
71# don't package documentation -- the libosmocore docs can be up to 16 Mb large,
72# a significant amount compared to the binaries
73rm -rf "$prefix/share/doc/libosmocore"
74
75# build the archive that is going to be copied to the tester
76rm "$base"/*.tgz "$base"/*.md5 || true
77cd "$prefix"
78this="osmo-msc.build-${BUILD_NUMBER-$(date +%Y-%m-%d_%H_%M_%S)}"
79tar="${this}.tgz"
80tar czf "$base/$tar" *
81cd "$base"
82md5sum "$tar" > "${this}.md5"