2016-07-13 20:12:11 +08:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# Set up opam.
|
|
|
|
opam init -y
|
|
|
|
eval `opam config env`
|
|
|
|
|
|
|
|
# Install required opam packages.
|
|
|
|
opam install -y ocamlfind ppx_deriving menhir
|
|
|
|
|
|
|
|
# Build apidsl.
|
2016-09-12 04:09:41 +08:00
|
|
|
git clone --depth=1 https://github.com/TokTok/apidsl ../apidsl
|
2016-08-18 00:36:05 +08:00
|
|
|
make -C ../apidsl -j$NPROC
|
2016-07-13 20:12:11 +08:00
|
|
|
|
|
|
|
# Install cpp-coveralls to upload test coverage results.
|
2017-01-03 07:03:17 +08:00
|
|
|
pip install --user urllib3[secure] cpp-coveralls
|
|
|
|
|
|
|
|
# Work around https://github.com/eddyxu/cpp-coveralls/issues/108 by manually
|
|
|
|
# installing the pyOpenSSL module and injecting it into urllib3 as per
|
|
|
|
# https://urllib3.readthedocs.io/en/latest/user-guide.html#ssl-py2
|
|
|
|
sed -i -e '/^import sys$/a import urllib3.contrib.pyopenssl\nurllib3.contrib.pyopenssl.inject_into_urllib3()' `which coveralls`
|
2016-07-13 20:12:11 +08:00
|
|
|
|
|
|
|
# Install astyle (version in ubuntu-precise too old).
|
|
|
|
[ -f $ASTYLE ] || {
|
2016-07-13 21:18:03 +08:00
|
|
|
wget -O ../astyle.tar.gz https://launchpad.net/ubuntu/+archive/primary/+files/astyle_2.05.1.orig.tar.gz
|
|
|
|
tar -xf ../astyle.tar.gz -C $CACHE_DIR
|
2016-08-18 00:36:05 +08:00
|
|
|
make -C $CACHE_DIR/astyle/build/gcc -j$NPROC
|
2016-07-13 20:12:11 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
# Install libsodium (not in ubuntu-precise).
|
|
|
|
[ -f $CACHE_DIR/lib/libsodium.a ] || {
|
2016-07-13 21:18:03 +08:00
|
|
|
git clone --depth=1 --branch=stable https://github.com/jedisct1/libsodium ../libsodium
|
|
|
|
cd ../libsodium # pushd
|
2016-07-13 20:12:11 +08:00
|
|
|
./autogen.sh
|
|
|
|
./configure --prefix=$CACHE_DIR
|
2016-08-18 00:36:05 +08:00
|
|
|
make install -j$NPROC
|
2016-07-13 21:18:03 +08:00
|
|
|
cd - # popd
|
2016-07-13 20:12:11 +08:00
|
|
|
}
|
|
|
|
|
2017-06-05 02:34:15 +08:00
|
|
|
# Install msgpack-c.
|
|
|
|
[ -f $CACHE_DIR/lib/libmsgpackc.so ] || {
|
|
|
|
git clone --depth=1 https://github.com/msgpack/msgpack-c ../msgpack-c
|
|
|
|
$CC -shared -fPIC -O3 -I../msgpack-c/include ../msgpack-c/src/*.c -o $CACHE_DIR/lib/libmsgpackc.so
|
|
|
|
cp -a ../msgpack-c/include/* $CACHE_DIR/include/
|
|
|
|
sed -e "s|@prefix@|$CACHE_DIR|" \
|
|
|
|
-e 's|@exec_prefix@|${prefix}|' \
|
|
|
|
-e 's|@libdir@|${prefix}/lib|' \
|
|
|
|
-e 's|@includedir@|${prefix}/include|' \
|
|
|
|
-e 's|@VERSION@|2.1.1|' \
|
|
|
|
../msgpack-c/msgpack.pc.in \
|
|
|
|
> $CACHE_DIR/lib/pkgconfig/msgpack.pc
|
|
|
|
# TODO(iphydf): This doesn't work, because the cmake version on travis is too
|
|
|
|
# old. We're building it manually, instead.
|
|
|
|
# cd ../msgpack-c # pushd
|
|
|
|
# cmake . -DCMAKE_INSTALL_PREFIX:PATH=$CACHE_DIR \
|
|
|
|
# -DMSGPACK_ENABLE_CXX=OFF \
|
|
|
|
# -DMSGPACK_BUILD_EXAMPLES=OFF \
|
|
|
|
# -DMSGPACK_BUILD_TESTS=OFF
|
|
|
|
# make -j$NPROC
|
|
|
|
# make install -j$NPROC
|
|
|
|
# cd - # popd
|
|
|
|
}
|
|
|
|
|
2016-07-13 20:12:11 +08:00
|
|
|
# Install libconfig (version in ubuntu-precise too old).
|
|
|
|
[ -f $CACHE_DIR/lib/libconfig.a ] || {
|
2016-07-13 21:18:03 +08:00
|
|
|
git clone --depth=1 --branch=REL1_6_STABLE https://github.com/hyperrealm/libconfig ../libconfig
|
|
|
|
cd ../libconfig # pushd
|
2016-07-13 20:12:11 +08:00
|
|
|
autoreconf -fi
|
|
|
|
./configure --prefix=$CACHE_DIR
|
|
|
|
touch lib/scanner.l
|
2016-08-18 00:36:05 +08:00
|
|
|
make install -j$NPROC
|
2016-07-13 21:18:03 +08:00
|
|
|
cd - # popd
|
2016-07-13 20:12:11 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
# Install libopus (not in ubuntu-precise).
|
|
|
|
[ -f $CACHE_DIR/lib/libopus.a ] || {
|
2016-07-13 21:18:03 +08:00
|
|
|
git clone --depth=1 --branch=1.1.2 https://github.com/xiph/opus ../opus
|
|
|
|
cd ../opus # pushd
|
2016-07-13 20:12:11 +08:00
|
|
|
./autogen.sh
|
|
|
|
./configure --prefix=$CACHE_DIR
|
2016-08-18 00:36:05 +08:00
|
|
|
make install -j$NPROC
|
2016-07-13 21:18:03 +08:00
|
|
|
cd - # popd
|
2016-07-13 20:12:11 +08:00
|
|
|
}
|
2017-06-05 02:34:15 +08:00
|
|
|
|
|
|
|
if [ "$CC" = "clang" ]; then
|
|
|
|
# An initial update is required or the cabal cache will be empty and no packages
|
|
|
|
# can be installed.
|
|
|
|
cabal update
|
|
|
|
|
|
|
|
# Install the hstox test runner after installing libsodium.
|
|
|
|
CABAL_FLAGS="--disable-library-profiling"
|
|
|
|
CABAL_FLAGS="$CABAL_FLAGS --extra-include-dirs=$CACHE_DIR/include"
|
|
|
|
CABAL_FLAGS="$CABAL_FLAGS --extra-lib-dirs=$CACHE_DIR/lib"
|
|
|
|
git clone --recursive --depth=1 https://github.com/TokTok/hs-toxcore ../hs-toxcore
|
|
|
|
(cd ../hs-toxcore && cabal install $CABAL_FLAGS)
|
|
|
|
fi
|