#!/bin/sh -ex
case "$CC" in
- gcc)
- ENABLE_GCC_WERROR=--enable-gcc-Werror
+ gcc*)
+ DISTCHECK_CONFIGURE_FLAGS="$DISTCHECK_CONFIGURE_FLAGS --enable-gcc-Werror"
;;
clang-*)
# clang -mx32 fails with the following error:
;;
x86)
CC="$CC -m32"
- export DISTCHECK_CONFIGURE_FLAGS='--build=i686-pc-linux-gnu'
+ DISTCHECK_CONFIGURE_FLAGS="$DISTCHECK_CONFIGURE_FLAGS --build=i686-pc-linux-gnu --target=i686-pc-linux-gnu"
;;
esac
-$CC --version
+case "$KHEADERS" in
+ */*)
+ CPPFLAGS='-isystem /opt/kernel/include'
+ export CPPFLAGS
+ ;;
+esac
+
+case "${CHECK-}" in
+ coverage)
+ DISTCHECK_CONFIGURE_FLAGS="$DISTCHECK_CONFIGURE_FLAGS --enable-code-coverage"
+ CFLAGS='-g -O0'
+ CFLAGS_FOR_BUILD="$CFLAGS"
+ export CFLAGS CFLAGS_FOR_BUILD
+ ;;
+esac
+
+echo 'BEGIN OF BUILD ENVIRONMENT INFORMATION'
+uname -a |head -1
+libc="$(ldd /bin/sh |sed -n 's|^[^/]*\(/[^ ]*/libc\.so[^ ]*\).*|\1|p' |head -1)"
+$libc |head -1
+file -L /bin/sh
+$CC --version |head -1
+make --version |head -1
+autoconf --version |head -1
+automake --version |head -1
+kver="$(printf '%s\n%s\n' '#include <linux/version.h>' 'LINUX_VERSION_CODE' | $CC -E -P -)"
+printf 'kernel-headers %s.%s.%s\n' $(($kver/65536)) $(($kver/256%256)) $(($kver%256))
+echo 'END OF BUILD ENVIRONMENT INFORMATION'
+
export CC_FOR_BUILD="$CC"
+[ -z "${DISTCHECK_CONFIGURE_FLAGS-}" ] ||
+ export DISTCHECK_CONFIGURE_FLAGS
+
./git-set-file-times
./bootstrap
-./configure --enable-maintainer-mode ${ENABLE_GCC_WERROR-} ${DISTCHECK_CONFIGURE_FLAGS-}
+./configure --enable-maintainer-mode \
+ ${DISTCHECK_CONFIGURE_FLAGS-} \
+ #
j=-j`getconf _NPROCESSORS_ONLN 2> /dev/null` || j=
-make -k $j distcheck VERBOSE=${VERBOSE-}
+
+case "${CHECK-}" in
+ coverage)
+ make -k $j all VERBOSE=${VERBOSE-}
+ make -k $j check VERBOSE=${VERBOSE-}
+ codecov --gcov-args=-abcp ||:
+ echo 'BEGIN OF TEST SUITE INFORMATION'
+ tail -n 99999 -- tests*/test-suite.log tests*/ksysent.log
+ echo 'END OF TEST SUITE INFORMATION'
+ ;;
+ *)
+ make -k $j distcheck VERBOSE=${VERBOSE-}
+ ;;
+esac