diff --git a/.travis.yml b/.travis.yml index 820a2847..01d4d110 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,11 +11,11 @@ language: os: - osx - linux - + compiler: - clang - gcc - + env: - LINK=static - LINK=dynamic @@ -68,9 +68,11 @@ install: - if [[ $LINUX && $GCC && $STATIC ]]; then sudo apt-get -qq install swig; fi # Download and install packages for osx/clang/dynamic. - - if [[ $OSX && $CLANG && $DYNAMIC ]]; then brew unlink boost; brew install boost; fi - if [[ $OSX && $CLANG && $DYNAMIC ]]; then brew unlink swig; brew install swig; fi + # Download and install packages for linux/clang/dynamic. + - if [[ $LINUX && $CLANG && $DYNAMIC ]]; then sudo apt-get -qq install boost1.54; fi + # Download and install packages for linux/gcc/dynamic. - if [[ $LINUX && $GCC && $DYNAMIC ]]; then sudo apt-get -qq install swig; fi @@ -78,10 +80,10 @@ script: # Download and build libbitcoin-consensus and all dependencies. - if [[ $OSX && $CLANG && $STATIC ]]; then ./install.sh --with-java --disable-shared --build-boost --prefix=$TRAVIS_BUILD_DIR/my-prefix; fi - - if [[ $LINUX && $CLANG && $STATIC ]]; then ./install.sh --with-python --disable-shared --build-boost --prefix=$TRAVIS_BUILD_DIR/my-prefix CFLAGS='-Os' CXXFLAGS='-Os'; fi - - if [[ $LINUX && $GCC && $STATIC ]]; then ./install.sh --with-java --disable-shared --build-boost --build-dir=my-build --prefix=$TRAVIS_BUILD_DIR/my-prefix CFLAGS='-O0 -g --coverage' CXXFLAGS='-O0 -g --coverage'; fi + - if [[ $LINUX && $CLANG && $STATIC ]]; then ./install.sh --with-python --disable-shared --build-boost --prefix=$TRAVIS_BUILD_DIR/my-prefix CFLAGS='-Os' LDLIBS='-lstdc++' CXXFLAGS='-Os -stdlib=libstdc++'; fi + - if [[ $LINUX && $GCC && $STATIC ]]; then ./install.sh --with-java --disable-shared --build-boost --build-dir=my-build --prefix=$TRAVIS_BUILD_DIR/my-prefix CFLAGS='-O0 -g -static --coverage' CXXFLAGS='-O0 -g -static --coverage'; fi - if [[ $OSX && $CLANG && $DYNAMIC ]]; then ./install.sh --with-python; fi - - if [[ $LINUX && $CLANG && $DYNAMIC ]]; then sudo CXX=$CXX CC=$CC ./install.sh --build-boost --disable-ndebug --disable-static CFLAGS='-Os' CXXFLAGS='-Os'; fi + - if [[ $LINUX && $CLANG && $DYNAMIC ]]; then sudo CXX=$CXX CC=$CC ./install.sh --disable-ndebug --disable-static CFLAGS='-Os' LDLIBS='-lstdc++' CXXFLAGS='-Os -stdlib=libstdc++'; fi - if [[ $LINUX && $GCC && $DYNAMIC ]]; then sudo CXX=$CXX CC=$CC ./install.sh --with-java --with-python --disable-static --build-boost CFLAGS='-Os -s' CXXFLAGS='-Os -s'; fi after_success: @@ -96,6 +98,6 @@ after_success: - if [[ $LINUX && $GCC && $STATIC ]]; then lcov --directory . --capture --output-file coverage.info; fi - if [[ $LINUX && $GCC && $STATIC ]]; then lcov --remove coverage.info "/usr/*" "$TRAVIS_BUILD_DIR/my-prefix/*" "my-build/*" "test/*" "clone/*" --output-file coverage.info; fi - if [[ $LINUX && $GCC && $STATIC ]]; then lcov --list coverage.info; fi - + # Upload coverage info to coveralls service (--repo-token ). - if [[ $LINUX && $GCC && $STATIC ]]; then coveralls-lcov coverage.info; fi diff --git a/configure.ac b/configure.ac index 7bab2a57..50d87cb4 100644 --- a/configure.ac +++ b/configure.ac @@ -7,9 +7,7 @@ # Standard declarations. #============================================================================== -# Requires Automake 1.14 or newer. - -# Declare the required version of Autoconf. +# Declare the required version of autoconf. AC_PREREQ([2.65]) # Process command-line arguments and perform initialization and verification. @@ -353,15 +351,15 @@ AS_CASE([${CC}], [*gcc*], AC_MSG_NOTICE([boost_LDFLAGS : ${boost_LDFLAGS}])], [AC_MSG_ERROR([Boost 1.55.0 or later is required but was not found.])])]) -# Require Boost of at least version 1.56.0 if in clang and output ${boost_CPPFLAGS/LDFLAGS}. +# Require Boost of at least version 1.54.0 if in clang and output ${boost_CPPFLAGS/LDFLAGS}. #------------------------------------------------------------------------------ AS_CASE([${CC}], [*clang*], - [AX_BOOST_BASE([1.56.0], + [AX_BOOST_BASE([1.54.0], [AC_SUBST([boost_CPPFLAGS], [${BOOST_CPPFLAGS}]) AC_SUBST([boost_LDFLAGS], [${BOOST_LDFLAGS}]) AC_MSG_NOTICE([boost_CPPFLAGS : ${boost_CPPFLAGS}]) AC_MSG_NOTICE([boost_LDFLAGS : ${boost_LDFLAGS}])], - [AC_MSG_ERROR([Boost 1.56.0 or later is required but was not found.])])]) + [AC_MSG_ERROR([Boost 1.54.0 or later is required but was not found.])])]) AS_CASE([${with_tests}], [yes], [AX_BOOST_UNIT_TEST_FRAMEWORK @@ -427,6 +425,12 @@ AS_CASE([${CC}], [*clang*], [AX_CHECK_COMPILE_FLAG([-Wno-mismatched-tags], [CXXFLAGS="$CXXFLAGS -Wno-mismatched-tags"])]) +# Clean up boost 1.54 headers. Enabled in clang only. +#------------------------------------------------------------------------------ +AS_CASE([${CC}], [*clang*], + [AX_CHECK_COMPILE_FLAG([-Wno-deprecated-register], + [CXXFLAGS="$CXXFLAGS -Wno-deprecated-register"])]) + # Protect stack. #------------------------------------------------------------------------------ AS_CASE([${CC}], [*], diff --git a/install.sh b/install.sh index 4d29cdb7..77fabace 100755 --- a/install.sh +++ b/install.sh @@ -24,16 +24,31 @@ # Depending on the caller's permission to the --prefix or --build-dir # directory, the script may need to be sudo'd. -# Define constants. +# Define common constants. #============================================================================== # The default build directory. #------------------------------------------------------------------------------ BUILD_DIR="build-libbitcoin-consensus" -# Boost archive. +# Boost archive for gcc. #------------------------------------------------------------------------------ -BOOST_URL="http://downloads.sourceforge.net/project/boost/boost/1.56.0/boost_1_56_0.tar.bz2" -BOOST_ARCHIVE="boost_1_56_0.tar.bz2" +BOOST_URL_GCC="http://github.com/libbitcoin/libbitcoin-build/blob/master/mirror/boost_1_55_0.tar.bz2?raw=true" +BOOST_ARCHIVE_GCC="boost_1_55_0.tar.bz2" +BOOST_STANDARD_GCC=\ +"threading=multi "\ +"variant=release "\ +"-d0 "\ +"-q" + +# Boost archive for clang. +#------------------------------------------------------------------------------ +BOOST_URL_CLANG="http://github.com/libbitcoin/libbitcoin-build/blob/master/mirror/boost_1_54_0.tar.bz2?raw=true" +BOOST_ARCHIVE_CLANG="boost_1_54_0.tar.bz2" +BOOST_STANDARD_CLANG=\ +"threading=multi "\ +"variant=release "\ +"-d0 "\ +"-q" # Initialize the build environment. @@ -58,27 +73,37 @@ else echo "Unsupported system: $OS" exit 1 fi +echo "Make jobs: $PARALLEL" +echo "Make for system: $OS" # Define operating system specific settings. #------------------------------------------------------------------------------ if [[ $OS == Darwin ]]; then + # Always require clang, common lib linking will otherwise fail. export CC="clang" export CXX="clang++" - STDLIB="c++" + LIBC="libc++" + + # Always initialize prefix on OSX so default is useful. + PREFIX="/usr/local" elif [[ $OS == OpenBSD ]]; then make() { gmake "$@"; } export CC="egcc" export CXX="eg++" - STDLIB="estdc++" -else # Linux - STDLIB="stdc++" + LIBC="libestdc++" +else + LIBC="libstdc++" fi +echo "Make with cc: $CC" +echo "Make with cxx: $CXX" +echo "Make with stdlib: $LIBC" -# Link to appropriate standard library in non-default scnearios. +# Define compiler specific settings. #------------------------------------------------------------------------------ -if [[ ($OS == Linux && $CC == "clang") || ($OS == OpenBSD) ]]; then - export LDLIBS="-l$STDLIB $LDLIBS" - export CXXFLAGS="-stdlib=lib$STDLIB $CXXFLAGS" +COMPILER="GCC" +if [[ $CXX == "clang++" ]]; then + BOOST_TOOLS="toolset=clang cxxflags=-stdlib=$LIBC linkflags=-stdlib=$LIBC" + COMPILER="CLANG" fi # Parse command line options that are handled by this script. @@ -87,137 +112,147 @@ for OPTION in "$@"; do case $OPTION in # Custom build options (in the form of --build-