#! /bin/bash cat < installing dependencies" sudo apt-get update -y sudo apt-get install -y build-essential unzip autoconf libtool git chrpath curl fi if [ ! -e $BUILD_BASE/go/bin/go ]; then echo "-> installing go" pushd $SRC $CURL https://storage.googleapis.com/golang/go1.9.2.linux-amd64.tar.gz -O tar xzf go1.9.2.linux-amd64.tar.gz -C $BUILD_BASE/ popd fi if [[ -z "$WITH_HYPERLEVELDB" && ! -e $PREFIX/lib/libleveldb.so ]]; then echo "-> installing leveldb" pushd $SRC $CURL https://github.com/google/leveldb/archive/master.zip -L -O unzip master.zip pushd leveldb-master make -j4 cp -R out-shared/liblevel* $PREFIX/lib/ cp -R include/leveldb $PREFIX/include/ popd popd fi if [[ -n "$WITH_HYPERLEVELDB" && ! -e $PREFIX/lib/libhyperleveldb.so ]]; then echo "-> installing hyperleveldb" pushd $SRC $CURL https://github.com/rescrv/HyperLevelDB/archive/master.zip -O unzip master.zip pushd HyperLevelDB-master autoreconf -i ./configure --prefix=$PREFIX make -j4 make install popd popd fi if [[ -n "$WITH_HYPERLEVELDB" && ! -e $PREFIX/include/leveldb ]]; then echo "-> linking hyperleveldb as leveldb" pushd $PREFIX/lib for s in 'a', 'la', 'so'; do ln -sf libhyperleveldb.$s libleveldb.$s done popd ln -s $PREFIX/include/hyperleveldb $PREFIX/include/leveldb fi if [ ! -e $PREFIX/lib/libprotobuf.so ]; then echo "-> installing protobuf" pushd $SRC $CURL https://github.com/google/protobuf/releases/download/v2.6.1/protobuf-2.6.1.tar.bz2 -O tar jxf protobuf-2.6.1.tar.bz2 pushd protobuf-2.6.1/ ./configure --prefix=$PREFIX make -j2 make install popd popd fi if [ ! -e $PREFIX/lib/libgeos-$GEOS_VERSION.so ]; then echo "-> installing GEOS" pushd $SRC $CURL http://download.osgeo.org/geos/geos-$GEOS_VERSION.tar.bz2 -O tar jxf geos-$GEOS_VERSION.tar.bz2 pushd geos-$GEOS_VERSION/ ./configure --prefix=$PREFIX make -j2 make install popd popd fi echo '-> fetching imposm' mkdir -p $IMPOSM_SRC git init $IMPOSM_SRC pushd $IMPOSM_SRC git config --add receive.denyCurrentBranch ignore pushd /vagrant git push --all -f $IMPOSM_SRC popd git reset --hard git checkout $REVISION echo '-> compiling imposm' make clean if [[ -n "$WITH_HYPERLEVELDB" ]]; then make build else LEVELDB_POST_121=1 make build fi popd echo '-> building imposm package' rm -rf $BUILD_TMP mkdir -p $BUILD_TMP pushd $IMPOSM_SRC cp imposm $BUILD_TMP cp README.md $BUILD_TMP cp example-mapping.json $BUILD_TMP/mapping.json popd mkdir -p $BUILD_TMP/lib pushd $PREFIX/lib cp libgeos_c.so $BUILD_TMP/lib ln -s libgeos_c.so $BUILD_TMP/lib/libgeos_c.so.1 cp libgeos.so $BUILD_TMP/lib ln -s libgeos.so $BUILD_TMP/lib/libgeos-$GEOS_VERSION.so if [ -n "$WITH_HYPERLEVELDB" ]; then cp libhyperleveldb.so $BUILD_TMP/lib ln -s libhyperleveldb.so $BUILD_TMP/lib/libhyperleveldb.so.0 ln -s libhyperleveldb.so $BUILD_TMP/lib/libleveldb.so.1 else cp -R libleveldb.so* $BUILD_TMP/lib fi popd pushd $BUILD_TMP/lib chrpath libgeos_c.so -r '${ORIGIN}' popd pushd $BUILD_BASE VERSION=`$BUILD_TMP/imposm version`-linux-x86-64 rm -rf imposm-$VERSION mv imposm-build imposm-$VERSION tar zcvf imposm-$VERSION.tar.gz imposm-$VERSION mkdir -p /vagrant/dist mv imposm-$VERSION.tar.gz /vagrant/dist/ echo "###########################################################################" echo " Call the following commands to download the created binary packages:" echo echo "vagrant ssh-config > .vagrant_ssh_conf" echo "rsync -a -v -P -e 'ssh -F .vagrant_ssh_conf' default:/vagrant/dist ./dist" echo "###########################################################################" popd