diff --git a/.travis.yml b/.travis.yml index 0a1ec2a..96dc876 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,15 +10,180 @@ rust: before_script: - rustup component add clippy-preview +before_install: + - echo "MATRIX_EVAL=${MATRIX_EVAL}" + - echo "CC=$CC" + - echo "CXX=$CXX" + - eval "${MATRIX_EVAL}" + script: - cargo test -- --test-threads=1 - cargo clippy +env: + global: + - RUSTFLAGS="-D warnings" + +addons: + apt: + packages: + - make + - autoconf + - autoconf-archive # for AX_CHECK_COMPILE_FLAG + - automake + - libtool + homebrew: + update: true + packages: + - make + - autoconf + - autoconf-archive + - automake + - libtool + matrix: allow_failures: - rust: beta - rust: nightly - -env: - global: - - RUSTFLAGS="-D warnings" + include: + # GCC on Linux + - os: linux + addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - g++-4.8 + - make + - autoconf + - autoconf-archive + - automake + - libtool + env: + - MATRIX_EVAL="CC=gcc-4.8 CXX=g++-4.8" + - os: linux + addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - g++-4.9 + - make + - autoconf + - autoconf-archive + - automake + - libtool + env: + - MATRIX_EVAL="CC=gcc-4.9 CXX=g++-4.9" + - os: linux + addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - g++-9 + - make + - autoconf + - autoconf-archive + - automake + - libtool + env: + - MATRIX_EVAL="CC=gcc-9 CXX=g++-9" + # Clang on Linux + - os: linux + addons: + apt: + sources: + - ubuntu-toolchain-r-test + - llvm-toolchain-xenial-4.0 + packages: + - clang-4.0 + - make + - autoconf + - autoconf-archive + - automake + - libtool + env: + - MATRIX_EVAL="CC=clang-4.0 CXX=clang++-4.0" + - os: linux + addons: + apt: + sources: + - ubuntu-toolchain-r-test + - llvm-toolchain-xenial-5.0 + packages: + - clang-5.0 + - make + - autoconf + - autoconf-archive + - automake + - libtool + env: + - MATRIX_EVAL="CC=clang-5.0 CXX=clang++-5.0" + - os: linux + addons: + apt: + sources: + - ubuntu-toolchain-r-test + - llvm-toolchain-xenial-6.0 + packages: + - clang-6.0 + - make + - autoconf + - autoconf-archive + - automake + - libtool + env: + - MATRIX_EVAL="CC=clang-6.0 CXX=clang++-6.0" + - os: linux + addons: + apt: + sources: + - ubuntu-toolchain-r-test + - sourceline: 'deb https://apt.llvm.org/xenial/ llvm-toolchain-xenial-7 main' + key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key' + packages: + - clang-7 + - make + - autoconf + - autoconf-archive + - automake + - libtool + env: + - MATRIX_EVAL="CC=clang-7 CXX=clang++-7" + - os: linux + addons: + apt: + sources: + - ubuntu-toolchain-r-test + - sourceline: 'deb https://apt.llvm.org/xenial/ llvm-toolchain-xenial-8 main' + key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key' + packages: + - clang-8 + - make + - autoconf + - autoconf-archive + - automake + - libtool + env: + - MATRIX_EVAL="CC=clang-8 CXX=clang++-8" + # Clang on macOS + - os: osx + osx_image: xcode10.2 + - os: osx + osx_image: xcode9.4 + - os: osx + osx_image: xcode8 + # GCC on macOS + - os: osx + osx_image: xcode8 + env: + - MATRIX_EVAL="CC=gcc-4.9 && CXX=g++-4.9" + - os: osx + osx_image: xcode9.4 + env: + - MATRIX_EVAL="brew install gcc && CC=gcc-8 && CXX=g++-8" + - os: osx + osx_image: xcode9.4 + env: + - MATRIX_EVAL="brew install gcc && CC=gcc-9 && CXX=g++-9" diff --git a/build.rs b/build.rs index 2404614..2ce1092 100644 --- a/build.rs +++ b/build.rs @@ -14,7 +14,7 @@ fn main() { for file in &[ "install_deps.sh", "liberasurecode.patch", - "for_darwin_to_detect_compiler_flag.patch", + "liberasurecode_configure_ac.patch", ] { fs::copy(file, build_dir.join(file)).unwrap(); } diff --git a/for_darwin_to_detect_compiler_flag.patch b/for_darwin_to_detect_compiler_flag.patch deleted file mode 100644 index 4a33910..0000000 --- a/for_darwin_to_detect_compiler_flag.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- a/configure.ac 2019-04-19 16:27:52.000000000 +0900 -+++ b/configure.ac 2019-04-19 16:26:06.000000000 +0900 -@@ -39,6 +39,20 @@ AC_PROG_LN_S - dnl Compiling with per-target flags requires AM_PROG_CC_C_O. - AC_PROG_CC - AM_PROG_CC_C_O -+ -+# Check if a compiler supports "-Wno-error=address-of-packed-member" -+# If it supports the option, we add it to CFLAGS. -+ac_save_CFLAGS="$CFLAGS" -+AC_LANG_PUSH([C]) -+CFLAGS="-Wno-error=address-of-packed-member" -+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[[]])], -+[ac_c_recognize_address_of_packed_member=1], -+[ac_c_recognize_address_of_packed_member=0]) -+AC_LANG_POP([C]) -+AS_IF([test $ac_c_recognize_address_of_packed_member -eq 1], -+[CFLAGS="$ac_save_CFLAGS -Wno-error=address-of-packed-member"], -+[CFLAGS="$ac_save_CFLAGS"]) -+ - AC_PROG_LIBTOOL - AC_PROG_CXX - AC_PROG_INSTALL diff --git a/install_deps.sh b/install_deps.sh index d0b81f1..e8240e2 100755 --- a/install_deps.sh +++ b/install_deps.sh @@ -39,11 +39,9 @@ cd ../ git clone https://github.com/openstack/liberasurecode.git cd liberasurecode/ git checkout 1.5.0 -if [ "$(uname)" == "Darwin" ]; then - # if the compiler has the feature to check `address-of-packed-member`, we suppress it. - # it is only annoying for liberasurecode v1.5.0. - patch -p1 < ../for_darwin_to_detect_compiler_flag.patch -fi +# if the compiler has the feature to check `address-of-packed-member`, we suppress it. +# it is only annoying for liberasurecode v1.5.0. +patch -p1 < ../liberasurecode_configure_ac.patch ./autogen.sh CFLAGS="-I${BUILD_DIR}/jerasure/include -I${BUILD_DIR}/include" CFLAGS=$CFLAGS LIBS="-lJerasure" LDFLAGS="-L${BUILD_DIR}/lib" ./configure --disable-shared --with-pic --prefix $BUILD_DIR diff --git a/liberasurecode_configure_ac.patch b/liberasurecode_configure_ac.patch new file mode 100644 index 0000000..74c6760 --- /dev/null +++ b/liberasurecode_configure_ac.patch @@ -0,0 +1,16 @@ +diff --git a/configure.ac b/configure.ac +index 16d4dc4..6614878 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -146,6 +146,11 @@ fi + AC_SUBST(GCOV_FLAGS) + AC_SUBST(GCOV_LDFLAGS) + ++# Check if a compiler supports "-Wno-error=address-of-packed-member" ++# If it supports the option, we add it to CFLAGS. ++AX_CHECK_COMPILE_FLAG([-Wno-error=address-of-packed-member], ++ [CFLAGS="${CFLAGS} -Wno-error=address-of-packed-member"]) ++ + dnl Expand the sources and objects needed to build the library + AC_SUBST(ac_aux_dir) + AC_SUBST(OBJECTS)