blob: 6fbebab900a66809e6d626dfbafeda62125a1f17 [file] [log] [blame]
Neels Hofmeyr52261b32017-05-18 21:42:10 +02001#!/bin/sh
2set -e -x
3
4base="$PWD"
5prefix="$base/inst-osmo-hlr"
6
7rm -f "$base/osmo-hlr*.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-hlr_git_hashes.txt"
39
40 config_opts=""
41
42 autoreconf -fi
43 ./configure --prefix="$prefix" $config_opts
44 make -j8
45 make install
46}
47
48rm -rf "$prefix"
49mkdir -p "$prefix"
50
51export PKG_CONFIG_PATH="$prefix/lib/pkgconfig"
52export LD_LIBRARY_PATH="$prefix/lib"
53
54build_repo libosmocore
55build_repo libosmo-abis
56build_repo osmo-hlr
57
58# don't package documentation -- the libosmocore docs can be up to 16 Mb large,
59# a significant amount compared to the binaries
60rm -rf "$prefix/share/doc/libosmocore"
61
62# build the archive that is going to be copied to the tester
63rm "$base"/*.tgz "$base"/*.md5 || true
64cd "$prefix"
65this="osmo-hlr.build-${BUILD_NUMBER-$(date +%Y-%m-%d_%H_%M_%S)}"
66tar="${this}.tgz"
67tar czf "$base/$tar" *
68cd "$base"
69md5sum "$tar" > "${this}.md5"