mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 07:04:22 +01:00
configure: --enable-debugbuild flag for debug builds.
This controls debug flags for the build, rather than --developer, which is going away. I thought about making this flag control the RUST_PROFILE too, but it seems that we want that set to "release" for CI, whereas for the C code we want --enable-debugbuild. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
12
.github/workflows/ci.yaml
vendored
12
.github/workflows/ci.yaml
vendored
@@ -56,7 +56,7 @@ jobs:
|
||||
# We're going to check BOLT quotes, so get the latest version
|
||||
git clone https://github.com/lightning/bolts.git ../${BOLTDIR}
|
||||
- name: Configure
|
||||
run: ./configure
|
||||
run: ./configure --enable-debugbuild
|
||||
- name: Check source
|
||||
run: make -j 4 check-source BASE_REF="origin/${{ github.base_ref }}"
|
||||
- name: Check Generated Files have been updated
|
||||
@@ -98,7 +98,7 @@ jobs:
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
./configure
|
||||
./configure --enable-debugbuild
|
||||
make -j $(nproc) check-units installcheck
|
||||
|
||||
check-units-sanitizers:
|
||||
@@ -132,7 +132,7 @@ jobs:
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
./configure CC=clang
|
||||
./configure --enable-debugbuild CC=clang
|
||||
make -j $(nproc) check-units installcheck
|
||||
|
||||
check-fuzz:
|
||||
@@ -165,7 +165,7 @@ jobs:
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
./configure --enable-fuzzing CC=clang
|
||||
./configure --enable-debugbuild --enable-fuzzing CC=clang
|
||||
make -j $(nproc) check-fuzz
|
||||
|
||||
compile:
|
||||
@@ -215,7 +215,7 @@ jobs:
|
||||
pip3 install --user pip wheel poetry
|
||||
poetry export -o requirements.txt --with dev --without-hashes
|
||||
python3 -m pip install -r requirements.txt
|
||||
./configure CC="$COMPILER"
|
||||
./configure --enable-debugbuild CC="$COMPILER"
|
||||
|
||||
make -j $(nproc) testpack.tar.bz2
|
||||
|
||||
@@ -462,7 +462,7 @@ jobs:
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
./configure CC=clang --enable-address-sanitizer --enable-ub-sanitizer --disable-valgrind --enable-developer
|
||||
./configure CC=clang --enable-address-sanitizer --enable-ub-sanitizer --disable-valgrind --enable-developer --enable-debugbuild
|
||||
make -j $(nproc)
|
||||
|
||||
- name: Test
|
||||
|
||||
2
Makefile
2
Makefile
@@ -43,7 +43,7 @@ VG=VALGRIND=1 valgrind -q --error-exitcode=7
|
||||
VG_TEST_ARGS = --track-origins=yes --leak-check=full --show-reachable=yes --errors-for-leak-kinds=all
|
||||
endif
|
||||
|
||||
ifeq ($(DEVELOPER),1)
|
||||
ifeq ($(DEBUGBUILD),1)
|
||||
DEV_CFLAGS=-DCCAN_TAKE_DEBUG=1 -DCCAN_TAL_DEBUG=1 -DCCAN_JSON_OUT_DEBUG=1
|
||||
else
|
||||
DEV_CFLAGS=
|
||||
|
||||
31
configure
vendored
31
configure
vendored
@@ -43,7 +43,7 @@ usage_with_default()
|
||||
echo " $1 (default $DEF)"
|
||||
}
|
||||
|
||||
# Given DEVELOPER, what COPTFLAGS do we default to.
|
||||
# Given DEBUGBUILD, what COPTFLAGS do we default to.
|
||||
default_coptflags()
|
||||
{
|
||||
if [ "$1" = 0 ]; then
|
||||
@@ -142,6 +142,9 @@ set_defaults()
|
||||
CC=${CC:-cc}
|
||||
CDEBUGFLAGS=${CDEBUGFLAGS--std=gnu11 -g -fstack-protector-strong}
|
||||
DEVELOPER=${DEVELOPER:-0}
|
||||
DEBUGBUILD=${DEBUGBUILD:-0}
|
||||
# --enable-developer forces debug build
|
||||
[ "$DEVELOPER" = 0 ] || DEBUGBUILD=1
|
||||
COMPAT=${COMPAT:-1}
|
||||
STATIC=${STATIC:-0}
|
||||
CLANG_COVERAGE=${CLANG_COVERAGE:-0}
|
||||
@@ -152,13 +155,13 @@ set_defaults()
|
||||
CSANFLAGS=""
|
||||
if [ "$ASAN" != 0 ]; then
|
||||
CSANFLAGS="$CSANFLAGS -fsanitize=address"
|
||||
if [ "$DEVELOPER" != 0 ]; then
|
||||
if [ "$DEBUGBUILD" != 0 ]; then
|
||||
CSANFLAGS="$CSANFLAGS -fno-sanitize-recover=address"
|
||||
fi
|
||||
fi
|
||||
if [ "$UBSAN" != 0 ]; then
|
||||
CSANFLAGS="$CSANFLAGS -fsanitize=undefined"
|
||||
if [ "$DEVELOPER" != 0 ]; then
|
||||
if [ "$DEBUGBUILD" != 0 ]; then
|
||||
CSANFLAGS="$CSANFLAGS -fno-sanitize-recover=undefined"
|
||||
fi
|
||||
fi
|
||||
@@ -168,7 +171,7 @@ set_defaults()
|
||||
fi
|
||||
echo CSANFLAGS = $CSANFLAGS
|
||||
PYTEST=${PYTEST-$(default_pytest)}
|
||||
COPTFLAGS=${COPTFLAGS-$(default_coptflags "$DEVELOPER")}
|
||||
COPTFLAGS=${COPTFLAGS-$(default_coptflags "$DEBUGBUILD")}
|
||||
CONFIGURATOR_CC=${CONFIGURATOR_CC-$CC}
|
||||
VALGRIND=${VALGRIND:-$(default_valgrind_setting)}
|
||||
TEST_NETWORK=${TEST_NETWORK:-regtest}
|
||||
@@ -181,7 +184,7 @@ usage()
|
||||
echo "If --reconfigure is specified, $CONFIG_VAR_FILE will set defaults."
|
||||
echo "Default settings:"
|
||||
set_defaults
|
||||
DEFAULT_COPTFLAGS="$(default_coptflags $DEVELOPER)"
|
||||
DEFAULT_COPTFLAGS="$(default_coptflags $DEBUGBUILD)"
|
||||
# We assume we have a modern gcc.
|
||||
DEFAULT_CWARNFLAGS="$(default_cwarnflags ""$DEFAULT_COPTFLAGS"" 1 1)"
|
||||
usage_with_default "CC" "$CC"
|
||||
@@ -198,6 +201,8 @@ usage()
|
||||
echo " Prefix for make install"
|
||||
usage_with_default "--enable/disable-developer" "$DEVELOPER" "enable" "disable"
|
||||
echo " Developer mode, good for testing"
|
||||
usage_with_default "--enable/disable-debug" "$DEBUGBUILD" "enable" "disable"
|
||||
echo " Extra debug checks in the build, good for testing"
|
||||
usage_with_default "--enable/disable-compat" "$COMPAT" "enable" "disable"
|
||||
echo " Compatibility mode, good to disable to see if your software breaks"
|
||||
usage_with_default "--enable/disable-valgrind" "(autodetect)"
|
||||
@@ -236,20 +241,21 @@ for opt in "$@"; do
|
||||
# Set from values if not already set.
|
||||
while IFS='=' read VAR VAL; do
|
||||
if eval [ -z \${$VAR+x} ]; then eval $VAR=\"$VAL\"; fi
|
||||
# If they had an old config, it might set DEVELOPER.
|
||||
if [ "$VAR" = DEVELOPER ]; then
|
||||
DEFAULT_COPTFLAGS=$(default_coptflags "$VAL")
|
||||
DEBUGBUILD="$VAL"
|
||||
VAR=DEBUGBUILD
|
||||
fi
|
||||
if [ "$VAR" = DEBUGBUILD ]; then
|
||||
DEFAULT_COPTFLAGS=$(default_coptflags "$VAL")
|
||||
fi
|
||||
done < $CONFIG_VAR_FILE
|
||||
# If we were those defaults, unset so we get new defaults in
|
||||
# case DEVELOPER has changed.
|
||||
# case DEBUGBUILD has changed.
|
||||
if [ x"$COPTFLAGS" = x"$DEFAULT_COPTFLAGS" ]; then
|
||||
unset COPTFLAGS
|
||||
fi
|
||||
# If they didn't have -Wshadow=local, add it on --reconfigure
|
||||
# (we only added it later)
|
||||
if [ x"${CWARNFLAGS%*-Wshadow=local}" = x"$CWARNFLAGS" ]; then
|
||||
unset CWARNFLAGS
|
||||
fi
|
||||
;;
|
||||
CC=*) CC="${opt#CC=}";;
|
||||
CONFIGURATOR_CC=*) CONFIGURATOR_CC="${opt#CONFIGURATOR_CC=}";;
|
||||
@@ -260,6 +266,8 @@ for opt in "$@"; do
|
||||
--prefix=*) PREFIX="${opt#--prefix=}";;
|
||||
--enable-developer) DEVELOPER=1;;
|
||||
--disable-developer) DEVELOPER=0;;
|
||||
--enable-debugbuild) DEBUGBUILD=1;;
|
||||
--disable-debugbuild) DEBUGBUILD=0;;
|
||||
--enable-compat) COMPAT=1;;
|
||||
--disable-compat) COMPAT=0;;
|
||||
--enable-valgrind) VALGRIND=1;;
|
||||
@@ -493,6 +501,7 @@ add_var POSTGRES_INCLUDE "$POSTGRES_INCLUDE"
|
||||
add_var POSTGRES_LDLIBS "$POSTGRES_LDLIBS"
|
||||
add_var VALGRIND "$VALGRIND"
|
||||
add_var DEVELOPER "$DEVELOPER" $CONFIG_HEADER.$$
|
||||
add_var DEBUGBUILD "$DEBUGBUILD"
|
||||
add_var COMPAT "$COMPAT" $CONFIG_HEADER.$$
|
||||
add_var PYTEST "$PYTEST"
|
||||
add_var STATIC "$STATIC"
|
||||
|
||||
Reference in New Issue
Block a user