Package: nspr
Version: 2:4.35-1.1
Severity: normal
Tags: patch
X-Debbugs-Cc: [email protected]
User: [email protected]
Usertags: origin-ubuntu oracular ubuntu-patch
Dear Maintainer,
In Ubuntu, the attached patch was applied to achieve the following:
* Drop explicit -Wl,--as-needed linker flag. It's the default.
* Drop explicit CFLAGS that are checked by configure.
* Also use non-hardening flags from dpkg-buildflags to pick up flags
like -fno-omit-frame-pointer.
Thanks for considering the patch. I also attach the individual commits
done in Ubuntu that could be applied with "git am".
--
Benjamin Drung
Debian & Ubuntu Developer
diff -Nru nspr-4.35/debian/rules nspr-4.35/debian/rules
--- nspr-4.35/debian/rules 2023-02-10 21:52:57.000000000 +0100
+++ nspr-4.35/debian/rules 2024-07-22 11:23:52.000000000 +0200
@@ -4,15 +4,6 @@
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
-# Use dpkg-buildflags to get hardening flags, and exclude non-hardening flags
-dpkg_buildflags = $(and $(1),$(shell DEB_CFLAGS_MAINT_STRIP="$(shell
DEB_BUILD_MAINT_OPTIONS=hardening=-all dpkg-buildflags --get $(1))"
dpkg-buildflags --get $(1)))
-$(call lazy,CFLAGS,$$(call dpkg_buildflags,CFLAGS))
-$(call lazy,CPPFLAGS,$$(call dpkg_buildflags,CPPFLAGS))
-$(call lazy,LDFLAGS,$$(call dpkg_buildflags,LDFLAGS))
-
-CFLAGS += -Wall -pipe
-LDFLAGS += -Wl,--as-needed
-
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
CONFIGURE_FLAGS := --disable-optimize
else
@@ -49,9 +40,6 @@
done
cd nspr && \
- CFLAGS="$(CFLAGS)" \
- CPPFLAGS="$(CPPFLAGS)" \
- LDFLAGS="$(LDFLAGS)" \
./configure --target=$(DEB_HOST_GNU_TYPE) --host=$(DEB_BUILD_GNU_TYPE)
--build=$(DEB_BUILD_GNU_TYPE) \
$(CONFIGURE_FLAGS) \
--prefix=/usr \
>From 72c276c25bcdda20bb252f75c6dbc369a391b461 Mon Sep 17 00:00:00 2001
From: Benjamin Drung <[email protected]>
Date: Mon, 22 Jul 2024 11:27:41 +0200
Subject: [PATCH 1/3] Drop explicit -Wl,--as-needed linker flag
The debian/rules file for this package uses the -Wl,--as-needed linker
flag. The bullseye toolchain defaults to linking with --as-needed and
therefore it should no longer be necessary to inject this into the build
process.
---
debian/rules | 1 -
1 file changed, 1 deletion(-)
diff --git a/debian/rules b/debian/rules
index fcd74da..418a439 100755
--- a/debian/rules
+++ b/debian/rules
@@ -11,7 +11,6 @@ $(call lazy,CPPFLAGS,$$(call dpkg_buildflags,CPPFLAGS))
$(call lazy,LDFLAGS,$$(call dpkg_buildflags,LDFLAGS))
CFLAGS += -Wall -pipe
-LDFLAGS += -Wl,--as-needed
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
CONFIGURE_FLAGS := --disable-optimize
--
2.43.0
>From 02a76d81e9bd5c2ab0b10d8620938efc39377096 Mon Sep 17 00:00:00 2001
From: Benjamin Drung <[email protected]>
Date: Mon, 22 Jul 2024 11:30:19 +0200
Subject: [PATCH 2/3] Drop explicit CFLAGS that are checked by configure
The configure script will check for `-Wall` and `-pipe`. So rely on
configure instead of explicitly setting those.
---
debian/rules | 2 --
1 file changed, 2 deletions(-)
diff --git a/debian/rules b/debian/rules
index 418a439..602633d 100755
--- a/debian/rules
+++ b/debian/rules
@@ -10,8 +10,6 @@ $(call lazy,CFLAGS,$$(call dpkg_buildflags,CFLAGS))
$(call lazy,CPPFLAGS,$$(call dpkg_buildflags,CPPFLAGS))
$(call lazy,LDFLAGS,$$(call dpkg_buildflags,LDFLAGS))
-CFLAGS += -Wall -pipe
-
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
CONFIGURE_FLAGS := --disable-optimize
else
--
2.43.0
>From 9b161f5a44eba294917aa43c2269e631a875e821 Mon Sep 17 00:00:00 2001
From: Benjamin Drung <[email protected]>
Date: Mon, 22 Jul 2024 11:31:18 +0200
Subject: [PATCH 3/3] Also use non-hardening flags from dpkg-buildflags
Also use non-hardening flags from dpkg-buildflags to pick up flags like
`-fno-omit-frame-pointer`.
---
debian/rules | 9 ---------
1 file changed, 9 deletions(-)
diff --git a/debian/rules b/debian/rules
index 602633d..952806b 100755
--- a/debian/rules
+++ b/debian/rules
@@ -4,12 +4,6 @@ include debian/make.mk
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
-# Use dpkg-buildflags to get hardening flags, and exclude non-hardening flags
-dpkg_buildflags = $(and $(1),$(shell DEB_CFLAGS_MAINT_STRIP="$(shell
DEB_BUILD_MAINT_OPTIONS=hardening=-all dpkg-buildflags --get $(1))"
dpkg-buildflags --get $(1)))
-$(call lazy,CFLAGS,$$(call dpkg_buildflags,CFLAGS))
-$(call lazy,CPPFLAGS,$$(call dpkg_buildflags,CPPFLAGS))
-$(call lazy,LDFLAGS,$$(call dpkg_buildflags,LDFLAGS))
-
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
CONFIGURE_FLAGS := --disable-optimize
else
@@ -46,9 +40,6 @@ override_dh_auto_configure: $(PREPROCESS_FILES:.in=)
done
cd nspr && \
- CFLAGS="$(CFLAGS)" \
- CPPFLAGS="$(CPPFLAGS)" \
- LDFLAGS="$(LDFLAGS)" \
./configure --target=$(DEB_HOST_GNU_TYPE) --host=$(DEB_BUILD_GNU_TYPE)
--build=$(DEB_BUILD_GNU_TYPE) \
$(CONFIGURE_FLAGS) \
--prefix=/usr \
--
2.43.0