2013-05-28 01:55:01 +02:00
|
|
|
#!/bin/bash
|
|
|
|
# Param1: The prefix to mingw staging
|
|
|
|
# Param2: Path to java comparison tool
|
|
|
|
# Param3: Number of make jobs. Defaults to 1.
|
|
|
|
|
2013-10-11 03:33:27 +02:00
|
|
|
# Exit immediately if anything fails:
|
2013-05-28 01:55:01 +02:00
|
|
|
set -e
|
|
|
|
set -o xtrace
|
|
|
|
|
|
|
|
MINGWPREFIX=$1
|
|
|
|
JAVA_COMPARISON_TOOL=$2
|
2013-10-28 07:59:45 +01:00
|
|
|
RUN_EXPENSIVE_TESTS=$3
|
2013-10-28 06:16:41 +01:00
|
|
|
JOBS=${4-1}
|
|
|
|
OUT_DIR=${5-}
|
2013-05-28 01:55:01 +02:00
|
|
|
|
|
|
|
if [ $# -lt 2 ]; then
|
2013-10-11 03:33:27 +02:00
|
|
|
echo "Usage: $0 [mingw-prefix] [java-comparison-tool] <make jobs> <save output dir>"
|
2013-05-28 01:55:01 +02:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
DISTDIR=@PACKAGE@-@VERSION@
|
|
|
|
|
2013-10-11 03:33:27 +02:00
|
|
|
# Cross-compile for windows first (breaking the mingw/windows build is most common)
|
2013-10-07 05:10:22 +02:00
|
|
|
cd @abs_top_srcdir@
|
|
|
|
make distdir
|
2013-10-28 07:59:45 +01:00
|
|
|
mkdir -p win32-build
|
|
|
|
rsync -av $DISTDIR/ win32-build/
|
|
|
|
rm -r $DISTDIR
|
2013-10-07 05:10:22 +02:00
|
|
|
cd win32-build
|
2013-10-28 07:59:45 +01:00
|
|
|
|
2013-10-28 08:20:12 +01:00
|
|
|
if [ $RUN_EXPENSIVE_TESTS = 1 ]; then
|
|
|
|
./configure --disable-silent-rules --disable-ccache --prefix=$MINGWPREFIX --host=i586-mingw32msvc --with-qt-bindir=$MINGWPREFIX/host/bin --with-qt-plugindir=$MINGWPREFIX/plugins --with-qt-incdir=$MINGWPREFIX/include --with-boost=$MINGWPREFIX --with-protoc-bindir=$MINGWPREFIX/host/bin CPPFLAGS=-I$MINGWPREFIX/include LDFLAGS=-L$MINGWPREFIX/lib --with-comparison-tool="$JAVA_COMPARISON_TOOL" --enable-comparison-tool-reorg-tests
|
|
|
|
else
|
|
|
|
./configure --disable-silent-rules --disable-ccache --prefix=$MINGWPREFIX --host=i586-mingw32msvc --with-qt-bindir=$MINGWPREFIX/host/bin --with-qt-plugindir=$MINGWPREFIX/plugins --with-qt-incdir=$MINGWPREFIX/include --with-boost=$MINGWPREFIX --with-protoc-bindir=$MINGWPREFIX/host/bin CPPFLAGS=-I$MINGWPREFIX/include LDFLAGS=-L$MINGWPREFIX/lib
|
|
|
|
fi
|
2013-10-07 05:10:22 +02:00
|
|
|
make -j$JOBS
|
|
|
|
|
2013-10-11 03:33:27 +02:00
|
|
|
# And compile for Linux:
|
2013-05-28 01:55:01 +02:00
|
|
|
cd @abs_top_srcdir@
|
|
|
|
make distdir
|
2013-10-28 07:59:45 +01:00
|
|
|
mkdir -p linux-build
|
|
|
|
rsync -av $DISTDIR/ linux-build/
|
|
|
|
rm -r $DISTDIR
|
2013-05-28 01:55:01 +02:00
|
|
|
cd linux-build
|
2013-10-28 07:59:45 +01:00
|
|
|
if [ $RUN_EXPENSIVE_TESTS = 1 ]; then
|
2013-10-28 06:16:41 +01:00
|
|
|
./configure --disable-silent-rules --disable-ccache --with-comparison-tool="$JAVA_COMPARISON_TOOL" --enable-comparison-tool-reorg-tests
|
|
|
|
else
|
|
|
|
./configure --disable-silent-rules --disable-ccache --with-comparison-tool="$JAVA_COMPARISON_TOOL"
|
|
|
|
fi
|
2013-05-28 01:55:01 +02:00
|
|
|
make -j$JOBS
|
2013-10-11 03:33:27 +02:00
|
|
|
|
|
|
|
# link interesting binaries to parent out/ directory, if it exists. Do this before
|
|
|
|
# running unit tests (we want bad binaries to be easy to find)
|
|
|
|
if [ -d "$OUT_DIR" -a -w "$OUT_DIR" ]; then
|
|
|
|
set +e
|
|
|
|
# Windows:
|
|
|
|
cp @abs_top_srcdir@/win32-build/src/bitcoind.exe $OUT_DIR/bitcoind.exe
|
|
|
|
cp @abs_top_srcdir@/win32-build/src/test/test_bitcoin.exe $OUT_DIR/test_bitcoin.exe
|
|
|
|
cp @abs_top_srcdir@/win32-build/src/qt/bitcoind-qt.exe $OUT_DIR/bitcoin-qt.exe
|
|
|
|
# Linux:
|
|
|
|
cp @abs_top_srcdir@/linux-build/src/bitcoind $OUT_DIR/bitcoind
|
|
|
|
cp @abs_top_srcdir@/linux-build/src/test/test_bitcoin $OUT_DIR/test_bitcoin
|
|
|
|
cp @abs_top_srcdir@/linux-build/src/qt/bitcoind-qt $OUT_DIR/bitcoin-qt
|
|
|
|
set -e
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Run unit tests and blockchain-tester on Linux:
|
|
|
|
cd @abs_top_srcdir@/linux-build
|
2013-05-28 01:55:01 +02:00
|
|
|
make check
|
|
|
|
|
2013-10-28 08:20:12 +01:00
|
|
|
if [ $RUN_EXPENSIVE_TESTS = 1 ]; then
|
|
|
|
# Run unit tests and blockchain-tester on Windows:
|
|
|
|
cd @abs_top_srcdir@/win32-build
|
|
|
|
make check
|
|
|
|
fi
|
|
|
|
|
2013-10-11 03:33:27 +02:00
|
|
|
# Clean up builds (pull-tester machine doesn't have infinite disk space)
|
|
|
|
cd @abs_top_srcdir@/linux-build
|
|
|
|
make clean
|
|
|
|
cd @abs_top_srcdir@/win32-build
|
|
|
|
make clean
|
|
|
|
|
2013-10-11 04:32:17 +02:00
|
|
|
# TODO: Fix code coverage builds on pull-tester machine
|
|
|
|
# # Test code coverage
|
|
|
|
# cd @abs_top_srcdir@
|
|
|
|
# make distdir
|
|
|
|
# mv $DISTDIR linux-coverage-build
|
|
|
|
# cd linux-coverage-build
|
|
|
|
# ./configure --enable-lcov --disable-silent-rules --disable-ccache --with-comparison-tool="$JAVA_COMPARISON_TOOL"
|
|
|
|
# make -j$JOBS
|
|
|
|
# make cov
|