Neels Hofmeyr | dae3d3c | 2017-03-28 12:16:58 +0200 | [diff] [blame^] | 1 | #!/bin/sh |
| 2 | |
| 3 | set -e |
| 4 | |
| 5 | OPTION_DO_CLONE=0 |
| 6 | OPTION_DO_CLEAN=0 |
| 7 | OPTION_DO_TEST=1 |
| 8 | |
| 9 | PREFIX=`pwd`/inst-osmo-bts-octphy |
| 10 | |
| 11 | # NOTE Make sure either 'octphy-2g-headers' (prefered) or |
| 12 | # 'octsdr-2g' is listed among the repositories |
| 13 | |
| 14 | octbts_repos="libosmocore |
| 15 | libosmo-abis |
| 16 | openbsc/openbsc |
| 17 | octphy-2g-headers |
| 18 | osmo-bts" |
| 19 | |
| 20 | clone_repos() { |
| 21 | repos="$1" |
| 22 | for repo in $repos; do |
| 23 | if [ -e $repo ]; then |
| 24 | continue |
| 25 | fi |
| 26 | if [ "$repo" = "libosmocore" ]; then |
| 27 | url="git://git.osmocom.org/libosmocore.git" |
| 28 | elif [ "$repo" = "libosmo-abis" ]; then |
| 29 | url="git://git.osmocom.org/libosmo-abis.git" |
| 30 | elif [ "$repo" = "libosmo-netif" ]; then |
| 31 | url="git://git.osmocom.org/libosmo-netif.git" |
| 32 | elif [ "$repo" = "openbsc/openbsc" ]; then |
| 33 | url="git://git.osmocom.org/openbsc" |
| 34 | elif [ "$repo" = "octphy-2g-headers" ]; then |
| 35 | url="git://git.osmocom.org/octphy-2g-headers" |
| 36 | elif [ "$repo" = "octsdr-2g" ]; then |
| 37 | # NOTE acutally we only need the headers from the octphy-2g-headers |
| 38 | # repository but this (private) repository contains more recent versions |
| 39 | url="ssh://git@git.admin.sysmocom.de/octasic/octsdr-2g" |
| 40 | elif [ "$repo" = "osmo-bts" ]; then |
| 41 | url="git://git.osmocom.org/osmo-bts.git" |
| 42 | else |
| 43 | exit 2 |
| 44 | fi |
| 45 | git clone $url |
| 46 | done |
| 47 | } |
| 48 | |
| 49 | main() { |
| 50 | repos="$1" |
| 51 | if [ $OPTION_DO_CLONE -eq 1 ]; then clone_repos "$repos"; fi |
| 52 | rm -rf $PREFIX |
| 53 | mkdir -p $PREFIX |
| 54 | for repo in $repos; do |
| 55 | if [ "$repo" = "openbsc/openbsc" ]; then |
| 56 | continue |
| 57 | fi |
| 58 | if [ "$repo" = "octphy-2g-headers" ]; then |
| 59 | OCTPHY_INCDIR=`pwd`/octphy-2g-headers |
| 60 | continue |
| 61 | fi |
| 62 | if [ "$repo" = "octsdr-2g" ]; then |
| 63 | cd $repo |
| 64 | git checkout 5c7166bab0a0f2d8a9664213d18642ae305e7004 |
| 65 | cd - |
| 66 | OCTPHY_INCDIR=`pwd`/octsdr-2g/software/include |
| 67 | continue |
| 68 | fi |
| 69 | cd $repo |
| 70 | if [ $OPTION_DO_CLEAN -eq 1 ]; then git clean -dxf; fi |
| 71 | echo "$(git rev-parse HEAD) $repo" >> "$PREFIX/osmo-bts-octphy_git_hashes.txt" |
| 72 | autoreconf -fi |
| 73 | if [ "$repo" != "libosmocore" ]; then |
| 74 | export PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig |
| 75 | export LD_LIBRARY_PATH=$PREFIX/lib:/usr/local/lib |
| 76 | fi |
| 77 | config_opts="" |
| 78 | case "$repo" in |
| 79 | 'osmo-bts') config_opts="$config_opts --enable-octphy --with-octsdr-2g=$OCTPHY_INCDIR" |
| 80 | esac |
| 81 | ./configure --prefix=$PREFIX $config_opts |
| 82 | make -j8 |
| 83 | if [ $OPTION_DO_TEST -eq 1 ]; then make check; fi |
| 84 | make install |
| 85 | cd .. |
| 86 | done |
| 87 | } |
| 88 | |
| 89 | set -x |
| 90 | main "$octbts_repos" |
| 91 | |
| 92 | # build the archive that is going to be copied to the tester and then to the BTS |
| 93 | rm -f $WORKSPACE/osmo-bts-octphy*.tgz |
| 94 | tar czf $WORKSPACE/osmo-bts-octphy-build-$BUILD_NUMBER.tgz inst-osmo-bts-octphy |