Avoid build path ending up in binaries (Closes: #1030785)
authorStéphane Glondu <glondu@debian.org>
Wed, 8 Feb 2023 08:48:04 +0000 (09:48 +0100)
committerStéphane Glondu <glondu@debian.org>
Wed, 8 Feb 2023 09:57:38 +0000 (10:57 +0100)
debian/patches/0008-Filter-out-f-debug-file-prefix-map-from-ocamlc_cflag.patch [new file with mode: 0644]
debian/patches/series
debian/rules

diff --git a/debian/patches/0008-Filter-out-f-debug-file-prefix-map-from-ocamlc_cflag.patch b/debian/patches/0008-Filter-out-f-debug-file-prefix-map-from-ocamlc_cflag.patch
new file mode 100644 (file)
index 0000000..0034748
--- /dev/null
@@ -0,0 +1,32 @@
+From: =?utf-8?q?St=C3=A9phane_Glondu?= <glondu@debian.org>
+Date: Wed, 8 Feb 2023 08:45:00 +0100
+Subject: Filter out -f{debug,file}-prefix-map= from ocamlc_cflags and mkexe
+
+Bug-Debian: https://bugs.debian.org/1030785
+Forwarded: not-needed
+---
+ configure.ac | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 9ac019f..a449246 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -43,7 +43,7 @@ libraries_man_section=3
+ # at the moment they are not taken into account on Windows, because
+ # flexlink, which is used to build executables on this platform, can
+ # not handle them.
+-mkexe="\$(CC) \$(OC_CFLAGS) \$(CFLAGS) \$(OC_LDFLAGS) \$(LDFLAGS)"
++mkexe="\$(CC) \$(OC_CFLAGS) \$(filter-out -fdebug-prefix-map=% -ffile-prefix-map=%,\$(CFLAGS)) \$(OC_LDFLAGS) \$(LDFLAGS)"
+ # Flags for building executable files with debugging symbols
+ mkexedebugflag="-g"
+@@ -1952,7 +1952,7 @@ AS_IF([test x"$DEFAULT_STRING" = "xunsafe"],
+ oc_cflags="$common_cflags $internal_cflags"
+ oc_cppflags="$common_cppflags $internal_cppflags"
+-ocamlc_cflags="$common_cflags $sharedlib_cflags \$(CFLAGS)"
++ocamlc_cflags="$common_cflags $sharedlib_cflags \$(filter-out -fdebug-prefix-map=% -ffile-prefix-map=%,\$(CFLAGS))"
+ ocamlc_cppflags="$common_cppflags \$(CPPFLAGS)"
+ cclibs="$cclibs $mathlib"
index 2924ded559c6fcdee866866578adfb7f77f84a30..56079e3be2ba753957f3783e1d22e4139be115f5 100644 (file)
@@ -5,3 +5,4 @@
 0005-Trigger-output-complete-exe-on-custom-with-an-enviro.patch
 0006-Do-not-error-on-warnings-in-autoconf.patch
 0007-Put-manpages-in-section-3o-instead-of-3.patch
+0008-Filter-out-f-debug-file-prefix-map-from-ocamlc_cflag.patch
index e01a74241b4cbf83c36f8ccc3dddb43d1f4fd74e..f8a996d93dbe619260fb89e25a5e3a6a9e2ce120 100755 (executable)
@@ -131,6 +131,7 @@ override_dh_auto_configure: config-stamp ocamlinit-stamp
 
 config-stamp: pre-config-stamp
        ./configure $(CONFIGURE_OPTS)
+       sed -r -i '/^CFLAGS/s/-f(file|debug)-prefix-map=[^ ]* //g' Makefile.config
        touch $@
 
 ocamlinit-stamp: $(TARBALL_TARGET) config-stamp