2016-10-06 15:35:33 +00:00
|
|
|
#!/bin/sh
|
2023-03-01 17:42:47 +00:00
|
|
|
# Usage: $0 [--ccache] [make options]
|
|
|
|
#
|
2022-02-09 17:26:32 +00:00
|
|
|
# Test various compilation options:
|
|
|
|
# - native arch
|
2016-10-06 15:35:33 +00:00
|
|
|
# - dynamic, static
|
|
|
|
# - various configure options
|
|
|
|
#
|
2023-03-01 17:42:47 +00:00
|
|
|
# Arguments:
|
|
|
|
# - (first arugment) --ccache - enable ccache for build which can speed up
|
|
|
|
# rebuilding same files if the options do not affect them, the ccache will
|
|
|
|
# be created in the toplevel git directory
|
|
|
|
# - anything else will be passed to 'make', eg. define CC, D, V
|
2016-10-06 15:35:33 +00:00
|
|
|
#
|
|
|
|
# Requirements for full coverage:
|
|
|
|
# - static version of all libs
|
|
|
|
|
2019-07-03 20:35:22 +00:00
|
|
|
die() {
|
2016-10-06 15:35:33 +00:00
|
|
|
echo "ERROR: $@"
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
2019-07-03 20:35:22 +00:00
|
|
|
check_result() {
|
2016-10-06 15:35:33 +00:00
|
|
|
local ret
|
|
|
|
local str
|
|
|
|
|
|
|
|
ret=$1
|
|
|
|
|
2023-03-07 19:47:57 +00:00
|
|
|
str="RESULT of target($target) conf($conf) CFLAGS($CFLAGS): "
|
2016-10-06 15:35:33 +00:00
|
|
|
case $ret in
|
|
|
|
0) str="$str OK";;
|
|
|
|
*) str="$str FAIL";;
|
|
|
|
esac
|
|
|
|
echo "$str"
|
|
|
|
verdict="$verdict
|
|
|
|
$str"
|
|
|
|
}
|
|
|
|
|
2019-07-03 20:35:22 +00:00
|
|
|
buildme() {
|
2016-10-06 15:35:33 +00:00
|
|
|
make clean-all
|
|
|
|
|
2023-03-07 19:47:57 +00:00
|
|
|
./autogen.sh && CFLAGS="$CFLAGS" configure "$conf" || die "configure not working with: $@"
|
2016-10-06 15:35:33 +00:00
|
|
|
$make clean
|
|
|
|
$make $opts $target
|
|
|
|
check_result "$?"
|
|
|
|
echo "VERDICT: $verdict"
|
|
|
|
}
|
|
|
|
|
2023-03-07 19:47:57 +00:00
|
|
|
buildme_cflags() {
|
|
|
|
CFLAGS="$1"
|
|
|
|
buildme
|
|
|
|
CFLAGS=''
|
|
|
|
}
|
|
|
|
|
2019-07-03 20:35:22 +00:00
|
|
|
build_make_targets() {
|
2016-10-06 15:35:33 +00:00
|
|
|
# defaults
|
|
|
|
target=
|
|
|
|
buildme
|
|
|
|
# defaults, static
|
|
|
|
target=static
|
|
|
|
buildme
|
2015-06-21 16:23:19 +00:00
|
|
|
# defaults, busybox
|
|
|
|
target='btrfs.box btrfs.box.static'
|
|
|
|
buildme
|
2016-10-06 15:35:33 +00:00
|
|
|
# defaults, library
|
|
|
|
target="library-test"
|
|
|
|
buildme
|
2017-03-13 16:15:24 +00:00
|
|
|
# defaults, static library
|
|
|
|
target="library-test.static"
|
|
|
|
buildme
|
2016-10-06 15:35:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# main()
|
|
|
|
if ! [ -f configure.ac ]; then
|
|
|
|
echo "Please run me from the top directory"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2023-03-01 17:42:47 +00:00
|
|
|
if [ "$1" = "--ccache" ]; then
|
|
|
|
shift
|
|
|
|
ccache=true
|
|
|
|
export CCACHE_DIR=`pwd`/.ccache
|
|
|
|
mkdir -p -- "$CCACHE_DIR"
|
|
|
|
PATH="/usr/lib64/ccache:$PATH"
|
|
|
|
echo "Enable ccache at CCACHE_DIR=$CCACHE_DIR"
|
|
|
|
ccache -s
|
|
|
|
fi
|
|
|
|
|
|
|
|
make=make
|
|
|
|
jobs=16
|
|
|
|
opts="-j${jobs} $@"
|
2016-10-06 15:35:33 +00:00
|
|
|
verdict=
|
2023-03-01 17:42:47 +00:00
|
|
|
target=
|
2023-03-07 19:47:57 +00:00
|
|
|
export CLFAGS
|
|
|
|
CFLAGS=
|
2023-03-01 17:42:47 +00:00
|
|
|
|
2016-10-06 15:35:33 +00:00
|
|
|
conf=
|
|
|
|
build_make_targets
|
|
|
|
|
|
|
|
conf='--disable-documentation'
|
|
|
|
build_make_targets
|
|
|
|
|
|
|
|
conf='--disable-backtrace'
|
|
|
|
build_make_targets
|
|
|
|
|
|
|
|
conf='--disable-convert'
|
|
|
|
build_make_targets
|
|
|
|
|
2022-02-09 17:15:06 +00:00
|
|
|
conf='--disable-zoned'
|
|
|
|
build_make_targets
|
|
|
|
|
2022-08-16 07:21:51 +00:00
|
|
|
conf='--disable-libudev'
|
2022-02-09 17:15:06 +00:00
|
|
|
build_make_targets
|
|
|
|
|
|
|
|
conf='--disable-python'
|
|
|
|
build_make_targets
|
|
|
|
|
2017-10-12 12:29:27 +00:00
|
|
|
conf='--with-convert=ext2'
|
|
|
|
build_make_targets
|
|
|
|
|
2023-03-01 17:42:47 +00:00
|
|
|
conf='--enable-zstd'
|
2017-10-12 12:29:27 +00:00
|
|
|
build_make_targets
|
|
|
|
|
2023-03-01 17:42:47 +00:00
|
|
|
conf='--with-crypto=libgcrypt'
|
|
|
|
build_make_targets
|
|
|
|
|
|
|
|
conf='--with-crypto=libsodium'
|
|
|
|
build_make_targets
|
|
|
|
|
|
|
|
conf='--with-crypto=libkcapi'
|
2017-10-12 12:29:27 +00:00
|
|
|
build_make_targets
|
|
|
|
|
2023-03-07 19:47:57 +00:00
|
|
|
# Old architectures
|
|
|
|
conf='--with-crypto=builtin'
|
|
|
|
buildme_cflags '-march=core2'
|
|
|
|
|
|
|
|
conf='--with-crypto=builtin'
|
|
|
|
buildme_cflags '-march=x86-64-v3'
|
|
|
|
|
2017-08-28 11:54:02 +00:00
|
|
|
# debugging builds, just the default targets
|
|
|
|
target='D=1'
|
|
|
|
buildme
|
|
|
|
|
|
|
|
target='D=asan'
|
|
|
|
buildme
|
|
|
|
|
|
|
|
target='D=tsan'
|
|
|
|
buildme
|
|
|
|
|
|
|
|
target='D=ubsan'
|
|
|
|
buildme
|
|
|
|
|
2016-10-06 15:35:33 +00:00
|
|
|
echo "---------------------------------------------------"
|
|
|
|
echo "$verdict"
|