2017-11-22 17:22:47 -05:00
|
|
|
#!/bin/sh
|
|
|
|
# This script is used for testing the build, primarily for use
|
|
|
|
# with travis, but may be used by hand as well.
|
|
|
|
|
|
|
|
set -e
|
|
|
|
set -x
|
|
|
|
|
|
|
|
# Test autoconf build
|
|
|
|
autoconf_build()
|
|
|
|
{
|
|
|
|
autoreconf -ivf
|
|
|
|
|
|
|
|
mkdir autoconf-build
|
|
|
|
cd autoconf-build
|
|
|
|
echo "Running ../configure --prefix=$(pwd)/../autoconf-install) ${opts}"
|
2018-09-05 19:49:28 -04:00
|
|
|
../configure --prefix=$(pwd)/../autoconf-install --with-zstd-include-dir=/tmp/include --with-zstd-lib-dir=/tmp/lib --with-webp-include-dir=/tmp/include --with-webp-lib-dir=/tmp/lib ${opts}
|
2017-11-22 17:22:47 -05:00
|
|
|
make
|
|
|
|
make install
|
|
|
|
make check
|
2017-12-01 05:41:50 -05:00
|
|
|
make distcheck
|
2017-11-22 17:22:47 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
# Test autoconf build
|
|
|
|
cmake_build()
|
|
|
|
{
|
|
|
|
PATH="$(pwd)/tools/bin:$PATH"
|
|
|
|
if [ "$(uname -s)" = "Darwin" ]; then
|
|
|
|
PATH="$(pwd)/tools/CMake.app/Contents/bin:$PATH"
|
|
|
|
fi
|
|
|
|
mkdir cmake-build
|
|
|
|
cd cmake-build
|
2018-09-05 19:49:28 -04:00
|
|
|
echo "Running cmake -G "$1" -DCMAKE_BUILD_TYPE="$2" -DCMAKE_INSTALL_PREFIX=../autoconf-install -DZSTD_INCLUDE_DIR=/tmp/include -DZSTD_LIBRARY=/tmp/lib/libzstd.so -DWEBP_INCLUDE_DIR=/tmp/include -DZWEBP_LIBRARY=/tmp/lib/libwebp.so ${opts} .."
|
|
|
|
cmake -G "$1" -DCMAKE_BUILD_TYPE="$2" -DCMAKE_INSTALL_PREFIX=../autoconf-install -DZSTD_INCLUDE_DIR=/tmp/include -DZSTD_LIBRARY=/tmp/lib/libzstd.so -DWEBP_INCLUDE_DIR=/tmp/include -DWEBP_LIBRARY=/tmp/lib/libwebp.so ${opts} ..
|
2017-11-22 17:22:47 -05:00
|
|
|
cmake --build .
|
|
|
|
cmake --build . --target install
|
|
|
|
ctest -V
|
|
|
|
}
|
|
|
|
|
|
|
|
build=$1
|
|
|
|
shift
|
|
|
|
|
2017-12-21 07:53:44 -05:00
|
|
|
# Build zstd
|
|
|
|
wget https://github.com/facebook/zstd/archive/v1.3.3.tar.gz
|
|
|
|
tar xvzf v1.3.3.tar.gz
|
|
|
|
cd zstd-1.3.3/lib
|
|
|
|
# Faster build
|
|
|
|
make -j3 PREFIX=/tmp ZSTD_LEGACY_SUPPORT=0 CFLAGS=-O1
|
|
|
|
make install PREFIX=/tmp ZSTD_LEGACY_SUPPORT=0 CFLAGS=-O1
|
|
|
|
cd ../..
|
|
|
|
rm -rf zstd-1.3.3
|
2018-09-05 19:49:28 -04:00
|
|
|
|
|
|
|
# Build webp
|
|
|
|
wget https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.0.0.tar.gz
|
|
|
|
tar xvzf libwebp-1.0.0.tar.gz
|
|
|
|
cd libwebp-1.0.0
|
|
|
|
./configure --prefix=/tmp
|
|
|
|
make && make install
|
|
|
|
cd ..
|
|
|
|
rm -rf libwebp-1.0.0
|
|
|
|
|
2017-12-21 07:53:44 -05:00
|
|
|
export LD_LIBRARY_PATH=/tmp/lib
|
|
|
|
|
2017-11-22 17:22:47 -05:00
|
|
|
case $build in
|
|
|
|
autoconf)
|
|
|
|
echo "Testing Autoconf build"
|
|
|
|
autoconf_build "$@"
|
|
|
|
;;
|
|
|
|
cmake)
|
|
|
|
echo "Testing CMake build"
|
|
|
|
cmake_build "$@"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "Invalid argument: \"$arg\"" >&2
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
exit 0
|