Set __USE_FORTIFY_LEVEL for debug builds

This commit is contained in:
Henrik Grimler 2021-02-03 12:13:42 +01:00
parent 12163bb879
commit 9887e8cbfd

View File

@ -2,6 +2,7 @@ termux_step_setup_toolchain() {
[ "$TERMUX_PKG_METAPACKAGE" = "true" ] && return [ "$TERMUX_PKG_METAPACKAGE" = "true" ] && return
export CFLAGS="" export CFLAGS=""
export CPPFLAGS=""
export LDFLAGS="-L${TERMUX_PREFIX}/lib" export LDFLAGS="-L${TERMUX_PREFIX}/lib"
export AS=$TERMUX_HOST_PLATFORM-clang export AS=$TERMUX_HOST_PLATFORM-clang
@ -69,13 +70,14 @@ termux_step_setup_toolchain() {
LDFLAGS+=" -Wl,-z,relro,-z,now" LDFLAGS+=" -Wl,-z,relro,-z,now"
if [ "$TERMUX_DEBUG" = "true" ]; then if [ "$TERMUX_DEBUG" = "true" ]; then
CFLAGS+=" -g3 -O1 -D_FORTIFY_SOURCE=2" CFLAGS+=" -g3 -O1"
CPPFLAGS+=" -D_FORTIFY_SOURCE=2 -D__USE_FORTIFY_LEVEL=2"
else else
CFLAGS+=" -Oz" CFLAGS+=" -Oz"
fi fi
export CXXFLAGS="$CFLAGS" export CXXFLAGS="$CFLAGS"
export CPPFLAGS="-I${TERMUX_PREFIX}/include" export CPPFLAGS+=" -I${TERMUX_PREFIX}/include"
# If libandroid-support is declared as a dependency, link to it explicitly: # If libandroid-support is declared as a dependency, link to it explicitly:
if [ "$TERMUX_PKG_DEPENDS" != "${TERMUX_PKG_DEPENDS/libandroid-support/}" ]; then if [ "$TERMUX_PKG_DEPENDS" != "${TERMUX_PKG_DEPENDS/libandroid-support/}" ]; then