Neels Hofmeyr | 0d05d36 | 2017-05-18 15:15:19 +0200 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | set -e -x |
| 3 | |
| 4 | base="$PWD" |
| 5 | prefix="$base/inst-osmo-msc" |
| 6 | |
| 7 | rm -f "$base/osmo-msc*.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-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 | |
| 55 | rm -rf "$prefix" |
| 56 | mkdir -p "$prefix" |
| 57 | |
| 58 | export PKG_CONFIG_PATH="$prefix/lib/pkgconfig" |
| 59 | export LD_LIBRARY_PATH="$prefix/lib" |
| 60 | |
| 61 | build_repo libosmocore |
| 62 | build_repo libosmo-abis |
| 63 | build_repo libosmo-netif |
| 64 | build_repo openggsn |
| 65 | build_repo libsmpp34 |
| 66 | build_repo libosmo-sccp neels/aoip # TEMPORARY BRANCH |
| 67 | build_repo libasn1c |
| 68 | build_repo osmo-iuh neels/sigtran # TEMPORARY BRANCH |
| 69 | build_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 |
Neels Hofmeyr | 4e0627f | 2017-05-29 00:41:07 +0200 | [diff] [blame] | 73 | rm -rf "$prefix/share/doc" |
Neels Hofmeyr | 0d05d36 | 2017-05-18 15:15:19 +0200 | [diff] [blame] | 74 | |
| 75 | # build the archive that is going to be copied to the tester |
| 76 | rm "$base"/*.tgz "$base"/*.md5 || true |
| 77 | cd "$prefix" |
| 78 | this="osmo-msc.build-${BUILD_NUMBER-$(date +%Y-%m-%d_%H_%M_%S)}" |
| 79 | tar="${this}.tgz" |
| 80 | tar czf "$base/$tar" * |
| 81 | cd "$base" |
| 82 | md5sum "$tar" > "${this}.md5" |