BitcoinPrivate-legacy/btcputil/build-mac.sh

93 lines
2.7 KiB
Bash
Raw Normal View History

2017-01-16 11:21:36 -08:00
#!/bin/bash
export CC=gcc-5
export CXX=g++-5
export LIBTOOL=libtool
export AR=ar
export RANLIB=ranlib
export STRIP=strip
export OTOOL=otool
export NM=nm
set -eu -o pipefail
if [ "x$*" = 'x--help' ]
then
cat <<EOF
Usage:
$0 --help
Show this help message and exit.
2017-06-16 18:35:33 -07:00
$0 [ --enable-lcov || --disable-tests ] [ --disable-mining ] [ --disable-rust ] [ --enable-proton ] [ MAKEARGS... ]
Build Bitcoin Private and most of its transitive dependencies from
source. MAKEARGS are applied to both dependencies and Bitcoin Private itself.
2017-06-16 18:35:33 -07:00
If --enable-lcov is passed, Bitcoin Private is configured to add coverage
2017-01-16 11:21:36 -08:00
instrumentation, thus enabling "make cov" to work.
If --disable-tests is passed instead, the Bitcoin Private tests are not built.
2017-06-16 18:35:33 -07:00
If --disable-mining is passed, Bitcoin Private is configured to not build any mining
2017-06-16 18:35:33 -07:00
code. It must be passed after the test arguments, if present.
If --disable-rust is passed, Bitcoin Private is configured to not build any Rust language
2017-06-16 18:35:33 -07:00
assets. It must be passed after test/mining arguments, if present.
If --enable-proton is passed, Bitcoin Private is configured to build the Apache Qpid Proton
2017-06-16 18:35:33 -07:00
library required for AMQP support. This library is not built by default.
It must be passed after the test/mining/Rust arguments, if present.
2017-01-16 11:21:36 -08:00
EOF
exit 0
fi
# If --enable-lcov is the first argument, enable lcov coverage support:
LCOV_ARG=''
HARDENING_ARG='--disable-hardening'
2017-06-16 18:35:33 -07:00
TEST_ARG=''
2017-01-16 11:21:36 -08:00
if [ "x${1:-}" = 'x--enable-lcov' ]
then
LCOV_ARG='--enable-lcov'
HARDENING_ARG='--disable-hardening'
shift
2017-06-16 18:35:33 -07:00
elif [ "x${1:-}" = 'x--disable-tests' ]
then
TEST_ARG='--enable-tests=no'
shift
2017-01-16 11:21:36 -08:00
fi
# If --disable-mining is the next argument, disable mining code:
MINING_ARG=''
if [ "x${1:-}" = 'x--disable-mining' ]
then
MINING_ARG='--enable-mining=no'
shift
fi
# If --disable-rust is the next argument, disable Rust code:
RUST_ARG=''
if [ "x${1:-}" = 'x--disable-rust' ]
then
RUST_ARG='--enable-rust=no'
shift
fi
2017-06-16 18:35:33 -07:00
# If --enable-proton is the next argument, enable building Proton code:
PROTON_ARG='--enable-proton=no'
if [ "x${1:-}" = 'x--enable-proton' ]
then
PROTON_ARG=''
shift
fi
2017-01-16 11:21:36 -08:00
TRIPLET=`./depends/config.guess`
PREFIX="$(pwd)/depends/$TRIPLET"
2017-06-16 18:35:33 -07:00
NO_RUST="$RUST_ARG" NO_PROTON="$PROTON_ARG" make "$@" -C ./depends/ V=1 NO_QT=1
2017-01-16 11:21:36 -08:00
./autogen.sh
CPPFLAGS="-I$PREFIX/include -arch x86_64" LDFLAGS="-L$PREFIX/lib -arch x86_64 -Wl,-no_pie" \
CXXFLAGS='-arch x86_64 -I/usr/local/Cellar/gcc5/5.4.0/include/c++/5.4.0 -I$PREFIX/include -fwrapv -fno-strict-aliasing -Werror -g -Wl,-undefined -Wl,dynamic_lookup' \
2017-06-16 18:35:33 -07:00
./configure --prefix="${PREFIX}" --with-gui=no "$RUST_ARG" "$HARDENING_ARG" "$LCOV_ARG" "$TEST_ARG" "$MINING_ARG" "$PROTON_ARG"
2017-01-16 11:21:36 -08:00
make "$@" V=1 NO_GTEST=0 STATIC=1