Neels Hofmeyr | 52261b3 | 2017-05-18 21:42:10 +0200 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | set -e -x |
| 3 | |
| 4 | base="$PWD" |
| 5 | prefix="$base/inst-osmo-hlr" |
| 6 | |
| 7 | rm -f "$base/osmo-hlr*.tgz" |
| 8 | |
| 9 | git_url="git://git.osmocom.org" |
| 10 | |
| 11 | have_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 | |
| 30 | build_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 | |
| 48 | rm -rf "$prefix" |
| 49 | mkdir -p "$prefix" |
| 50 | |
| 51 | export PKG_CONFIG_PATH="$prefix/lib/pkgconfig" |
| 52 | export LD_LIBRARY_PATH="$prefix/lib" |
| 53 | |
| 54 | build_repo libosmocore |
| 55 | build_repo libosmo-abis |
| 56 | build_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 |
| 60 | rm -rf "$prefix/share/doc/libosmocore" |
| 61 | |
| 62 | # build the archive that is going to be copied to the tester |
| 63 | rm "$base"/*.tgz "$base"/*.md5 || true |
| 64 | cd "$prefix" |
| 65 | this="osmo-hlr.build-${BUILD_NUMBER-$(date +%Y-%m-%d_%H_%M_%S)}" |
| 66 | tar="${this}.tgz" |
| 67 | tar czf "$base/$tar" * |
| 68 | cd "$base" |
| 69 | md5sum "$tar" > "${this}.md5" |