nss-altfiles/0001-build-sys-Inherit-LDFLAGS.patch

53 lines
1.8 KiB
Diff

commit b87b28953cee248cffe05c8fd07d4a812a077e0d
Author: Jan Pazdziora <jpazdziora@redhat.com>
Date: Fri Dec 31 14:39:18 2021 +0100
build-sys: Inherit LDFLAGS
So that we can respect e.g. the Fedora hardening flags.
diff --git a/Makefile b/Makefile
index ea35529..f810fce 100644
--- a/Makefile
+++ b/Makefile
@@ -23,7 +23,7 @@ O := $(if $(HANDLE_rpc), src/nss_altfiles/files-rpc.o) \
src/nss_altfiles/files-have_o_cloexec.o
CFLAGS += $(EXTRA_CFLAGS) -pthread -fpic -std=gnu99 -Wall
-LDFLAGS += $(CFLAGS) -Wl,-soname,$T -Wl,-as-needed -lpthread
+LDFLAGS += $(CFLAGS) $(EXTRA_LDFLAGS) -Wl,-soname,$T -Wl,-as-needed -lpthread
CPPFLAGS += -D_GNU_SOURCE
ifneq ($(strip $(DATADIR)),)
diff --git a/configure b/configure
index 2b45e0b..74695b0 100755
--- a/configure
+++ b/configure
@@ -37,6 +37,7 @@ for var in "$@" ; do
CFLAGS Additional command line flags to be passed to the C compiler
CXXFLAGS Additional command line flags to be passed to the C++ compiler
+ LDFLAGS Additional command line flags to be passed to the linker
NOTE: This script tries to mimic the typical usage for configure scripts
generated by autotools, hence it will silently ignore unrecognized
@@ -54,7 +55,7 @@ echo EXTRA_CXXFLAGS= >> config.mk
for var in "$@" ; do
case ${var} in
- CFLAGS=* | CXXFLAGS=*)
+ CFLAGS=* | CXXFLAGS=* | LDFLAGS=* )
echo "Setting EXTRA_${var}"
echo "EXTRA_${var}" >> config.mk
;;
@@ -107,5 +108,9 @@ if test -n "${CXXFLAGS}"; then
echo "Setting EXTRA_CXXFLAGS+=${CXXFLAGS} (from environment)"
echo "EXTRA_CXXFLAGS+=${CXXFLAGS}" >> config.mk
fi
+if test -n "${LDFLAGS}"; then
+ echo "Setting EXTRA_LDFLAGS+=${LDFLAGS} (from environment)"
+ echo "EXTRA_LDFLAGS+=${LDFLAGS}" >> config.mk
+fi
echo "config.mk written"