diff --git a/build-auto.sh b/build-auto.sh index 7666066..1e27c3a 100755 --- a/build-auto.sh +++ b/build-auto.sh @@ -9,6 +9,36 @@ if ! hostname | grep -q ^gitbuilder- ; then exit 1 fi +if hostname | grep -q -- -clang ; then + echo "hostname has -clang, will build with CC=clang CXX=clang++" + export CC=clang + export CXX=clang++ + # Workaround nfortunate interactions between clang and distcc < 3.2. + export CCACHE_CPP2=yes + export CFLAGS="-Qunused-arguments $CFLAGS" + export CXXFLAGS="-Qunused-arguments $CXXFLAXS" +fi +if hostname | grep -q -- -analyze ; then + echo "hostname has -analyze, will wrap build with scan-build static analyzer" + echo "Disabling CCache to ensure complete coverage." + export CCACHE_DISABLE=yes + export BUILD_WRAPPER="scan-build -o scan-build-report.tmp/" +fi +if hostname | grep -q -- -asan; then + echo "hostname has -asan, will build with -fsanitize=address" + export CFLAGS="-fsanitize=address $CFLAGS" + export CXXFLAGS="-fsanitize=address $CXXFLAGS" +fi +if hostname | grep -q -- -tsan; then + echo "hostname has -tsan, will build with -fsanitize=thread" + export CFLAGS="-fsanitize=thread $CFLAGS" + export CXXFLAGS="-fsanitize=thread $CXXFLAGS" +fi +if hostname | grep -q -- -wall; then + echo "hostname has -wall, will build with all possible warnings enabled" + export CFLAGS="-Wall -Weverything -Wpedantic $CFLAGS" + export CXXFLAGS="-Wall -Weverything -Wpedantic $CXXFLAGS" +fi if hostname | grep -q -- -notcmalloc ; then echo "hostname has -notcmalloc, will build --without-tcmalloc --without-cryptopp" export CEPH_EXTRA_CONFIGURE_ARGS="$CEPH_EXTRA_CONFIGURE_ARGS --without-tcmalloc" diff --git a/build-ceph-deb-native.sh b/build-ceph-deb-native.sh index d99d73f..d66b270 100755 --- a/build-ceph-deb-native.sh +++ b/build-ceph-deb-native.sh @@ -18,13 +18,23 @@ rm -rf .git/modules/ /srv/git/bin/git submodule update --init git clean -fdx +# If CC is not already defined, use gcc. +if [ "x$CC" = "x" ]; then + export CC=gcc +fi + +# If CXX is not already defined, use g++. +if [ "x$CXX" = "x" ]; then + export CXX=g++ +fi + DIST=`lsb_release -sc` echo --START-IGNORE-WARNINGS [ ! -x autogen.sh ] || ./autogen.sh || exit 1 autoconf || true echo --STOP-IGNORE-WARNINGS -[ ! -x configure ] || CFLAGS="-fno-omit-frame-pointer -g -O2" CXXFLAGS="-fno-omit-frame-pointer -g -O2" ./configure --with-debug --with-radosgw --with-fuse --with-tcmalloc --with-libatomic-ops --with-gtk2 --with-profiler --enable-cephfs-java || exit 2 +[ ! -x configure ] || CFLAGS="-fno-omit-frame-pointer -g -O2 $CFLAGS" CXXFLAGS="-fno-omit-frame-pointer -g -O2 $CXXFLAGS" ./configure --with-debug --with-radosgw --with-fuse --with-tcmalloc --with-libatomic-ops --with-gtk2 --with-profiler --enable-cephfs-java || exit 2 if [ ! -e Makefile ]; then echo "$0: no Makefile, aborting." 1>&2 @@ -42,7 +52,7 @@ if command -v ccache >/dev/null; then if [ ! -e "$CCACHE_DIR" ]; then echo "$0: have ccache but cache directory does not exist: $CCACHE_DIR" 1>&2 else - set -- CC='ccache gcc' CXX='ccache g++' + set -- CC="ccache $CC" CXX="ccache $CXX" fi else echo "$0: no ccache found, compiles will be slower." 1>&2 diff --git a/build-ceph-deb.sh b/build-ceph-deb.sh index ef5b7d0..e507528 100755 --- a/build-ceph-deb.sh +++ b/build-ceph-deb.sh @@ -18,6 +18,15 @@ rm -rf .git/modules/ /srv/git/bin/git submodule update --init git clean -fdx +# If CC is not already defined, use gcc. +if [ "x$CC" = "x" ]; then + export CC=gcc +fi + +# If CXX is not already defined, use g++. +if [ "x$CXX" = "x" ]; then + export CXX=g++ +fi DISTS=`cat ../../dists` @@ -43,7 +52,7 @@ if command -v ccache >/dev/null; then if [ ! -e "$CCACHE_DIR" ]; then echo "$0: have ccache but cache directory does not exist: $CCACHE_DIR" 1>&2 else - set -- CC='ccache gcc' CXX='ccache g++' + set -- CC="ccache $CC" CXX="ccache $CXX" fi else echo "$0: no ccache found, compiles will be slower." 1>&2 diff --git a/build-ceph-gcov.sh b/build-ceph-gcov.sh index f3f7ea4..f4892ed 100755 --- a/build-ceph-gcov.sh +++ b/build-ceph-gcov.sh @@ -19,6 +19,16 @@ rm -rf .git/modules/ /srv/git/bin/git submodule update --init git clean -fdx +# If CC is not already defined, use gcc. +if [ "x$CC" = "x" ]; then + export CC=gcc +fi + +# If CXX is not already defined, use g++. +if [ "x$CXX" = "x" ]; then + export CXX=g++ +fi + echo --START-IGNORE-WARNINGS [ ! -x autogen.sh ] || ./autogen.sh || exit 1 autoconf || true @@ -41,14 +51,14 @@ if command -v ccache >/dev/null; then if [ ! -e "$CCACHE_DIR" ]; then echo "$0: have ccache but cache directory does not exist: $CCACHE_DIR" 1>&2 else - set -- CC='ccache gcc' CXX='ccache g++' + set -- CC="ccache $CC" CXX="ccache $CXX" fi else echo "$0: no ccache found, compiles will be slower." 1>&2 fi NCPU=$(( 2 * `grep -c processor /proc/cpuinfo` )) -ionice -c3 nice -n20 make -j$NCPU "$@" || exit 4 +ionice -c3 nice -n20 $BUILD_WRAPPER make -j$NCPU "$@" || exit 4 # The "make -q check" probe in build.sh.example is faulty in that # screwups in Makefiles make it think there are no unit tests to diff --git a/build-ceph-notcmalloc.sh b/build-ceph-notcmalloc.sh index 107f2b8..f397b24 100755 --- a/build-ceph-notcmalloc.sh +++ b/build-ceph-notcmalloc.sh @@ -19,12 +19,21 @@ rm -rf .git/modules/ /srv/git/bin/git submodule update --init git clean -fdx +# If CC is not already defined, use gcc. +if [ "x$CC" = "x" ]; then + export CC=gcc +fi + +# If CXX is not already defined, use g++. +if [ "x$CXX" = "x" ]; then + export CXX=g++ +fi echo --START-IGNORE-WARNINGS [ ! -x autogen.sh ] || ./autogen.sh || exit 1 autoconf || true echo --STOP-IGNORE-WARNINGS -[ ! -x configure ] || CFLAGS="-fno-omit-frame-pointer -g -O2" CXXFLAGS="-fno-omit-frame-pointer -g" ./configure --with-debug --with-radosgw --with-fuse --without-tcmalloc --with-libatomic-ops --with-gtk2 --with-profiler || exit 2 +[ ! -x configure ] || CFLAGS="-fno-omit-frame-pointer -g -O2 $CFLAGS" CXXFLAGS="-fno-omit-frame-pointer -g $CXXFLAGS" ./configure --with-debug --with-radosgw --with-fuse --without-tcmalloc --with-libatomic-ops --with-gtk2 --with-profiler || exit 2 if [ ! -e Makefile ]; then echo "$0: no Makefile, aborting." 1>&2 @@ -42,14 +51,14 @@ if command -v ccache >/dev/null; then if [ ! -e "$CCACHE_DIR" ]; then echo "$0: have ccache but cache directory does not exist: $CCACHE_DIR" 1>&2 else - set -- CC='ccache gcc' CXX='ccache g++' + set -- CC="ccache $CC" CXX="ccache $CXX" fi else echo "$0: no ccache found, compiles will be slower." 1>&2 fi NCPU=$(( 2 * `grep -c processor /proc/cpuinfo` )) -ionice -c3 nice -n20 make -j$NCPU "$@" || exit 4 +ionice -c3 nice -n20 $BUILD_WRAPPER make -j$NCPU "$@" || exit 4 # The "make -q check" probe in build.sh.example is faulty in that # screwups in Makefiles make it think there are no unit tests to diff --git a/build-ceph-rpm.sh b/build-ceph-rpm.sh index 5a5fea3..fd74333 100755 --- a/build-ceph-rpm.sh +++ b/build-ceph-rpm.sh @@ -18,6 +18,16 @@ rm -rf .git/modules/ /srv/git/bin/git submodule update --init git clean -fdx +# If CC is not already defined, use gcc. +if [ "x$CC" = "x" ]; then + export CC=gcc +fi + +# If CXX is not already defined, use g++. +if [ "x$CXX" = "x" ]; then + export CXX=g++ +fi + DISTS=`cat ../../dists` TARGET="$(cat ../../rsync-target)" TARGET="$(basename $TARGET)" @@ -67,7 +77,7 @@ if command -v ccache >/dev/null; then if [ ! -e "$CCACHE_DIR" ]; then echo "$0: have ccache but cache directory does not exist: $CCACHE_DIR" 1>&2 else - set -- CC='ccache gcc' CXX='ccache g++' + set -- CC="ccache $CC" CXX="ccache $CXX" fi else echo "$0: no ccache found, compiles will be slower." 1>&2 diff --git a/build-ceph.sh b/build-ceph.sh index 44789d9..e150629 100755 --- a/build-ceph.sh +++ b/build-ceph.sh @@ -18,11 +18,21 @@ rm -rf .git/modules/ /srv/git/bin/git submodule update --init git clean -fdx +# If CC is not already defined, use gcc. +if [ "x$CC" = "x" ]; then + export CC=gcc +fi + +# If CXX is not already defined, use g++. +if [ "x$CXX" = "x" ]; then + export CXX=g++ +fi + echo --START-IGNORE-WARNINGS [ ! -x autogen.sh ] || ./autogen.sh || exit 1 autoconf || true echo --STOP-IGNORE-WARNINGS -[ ! -x configure ] || CFLAGS="-fno-omit-frame-pointer -g -O2" CXXFLAGS="-fno-omit-frame-pointer -g" ./configure --with-debug --with-radosgw --with-fuse --with-tcmalloc --with-libatomic-ops --with-gtk2 --with-hadoop --with-profiler --enable-cephfs-java --with-librocksdb-static=check || exit 2 +[ ! -x configure ] || CFLAGS="-fno-omit-frame-pointer -g -O2 $CFLAGS" CXXFLAGS="-fno-omit-frame-pointer -g $CXXFLAGS" ./configure --with-debug --with-radosgw --with-fuse --with-tcmalloc --with-libatomic-ops --with-gtk2 --with-hadoop --with-profiler --enable-cephfs-java --with-librocksdb-static=check || exit 2 if [ ! -e Makefile ]; then echo "$0: no Makefile, aborting." 1>&2 @@ -40,14 +50,14 @@ if command -v ccache >/dev/null; then if [ ! -e "$CCACHE_DIR" ]; then echo "$0: have ccache but cache directory does not exist: $CCACHE_DIR" 1>&2 else - set -- CC='ccache gcc' CXX='ccache g++' + set -- CC="ccache $CC" CXX="ccache $CXX" fi else echo "$0: no ccache found, compiles will be slower." 1>&2 fi NCPU=$(( 2 * `grep -c processor /proc/cpuinfo` )) -ionice -c3 nice -n20 make -j$NCPU "$@" || exit 4 +ionice -c3 nice -n20 $BUILD_WRAPPER make -j$NCPU "$@" || exit 4 # The "make -q check" probe in build.sh.example is faulty in that # screwups in Makefiles make it think there are no unit tests to diff --git a/fabfile.py b/fabfile.py index ffc553f..a56eb85 100644 --- a/fabfile.py +++ b/fabfile.py @@ -164,6 +164,8 @@ def _rh_gitbuilder(flavor, git_repo, extra_remotes={}, extra_packages=[], ignore _rpm_install( 'ntp', 'ccache', + 'clang', + 'clang-analyzer', 'git', 'logrotate', 'rsync', @@ -282,6 +284,7 @@ def _gitbuilder(flavor, git_repo, extra_remotes={}, extra_packages=[], ignore=[] 'ntp', 'build-essential', 'ccache', + 'clang', 'git', 'logrotate', # 'sun-java6-jdk',