Filter out -f{debug,file}-prefix-map= from ocamlc_cflags and mkexe
authorStéphane Glondu <glondu@debian.org>
Wed, 8 Feb 2023 07:45:00 +0000 (08:45 +0100)
committerStéphane Glondu <glondu@debian.org>
Thu, 29 Aug 2024 16:03:23 +0000 (18:03 +0200)
Bug-Debian: https://bugs.debian.org/1030785
Forwarded: not-needed

Gbp-Pq: Name 0008-Filter-out-f-debug-file-prefix-map-from-ocamlc_cflag.patch

configure.ac

index d5d432a8f074bf270847cd1af98636a7ad7c5daa..467099fdfb6742f50a92380968acaea7c23ce30c 100644 (file)
@@ -36,7 +36,7 @@ CONFIGURE_ARGS="$*"
 # rely on $CFLAGS because these cannot be processed by flexlink (and are not
 # passed)
 mkexe_cmd='$(CC)'
-mkexe_cflags='$(OC_CFLAGS) $(CFLAGS)'
+mkexe_cflags='$(OC_CFLAGS) $(filter-out -fdebug-prefix-map=% -ffile-prefix-map=%,\$(CFLAGS))'
 mkexe_extra_flags=''
 mkexe_via_cc_extra_cmd=''
 mkexe_ldflags_prefix=''
@@ -2555,7 +2555,7 @@ AS_IF([test "$ccomptype" != "msvc"],
 
 oc_cflags="$common_cflags $internal_cflags"
 oc_cppflags="$common_cppflags $internal_cppflags"
-ocamlc_cflags="$ocamlc_cflags $common_cflags $sharedlib_cflags $CFLAGS"
+ocamlc_cflags="$ocamlc_cflags $common_cflags $sharedlib_cflags $(printf "%s" "$CFLAGS" | sed -r -e 's/-fdebug-prefix-map=\S+//' -e 's/-ffile-prefix-map=\S+//')"
 ocamlc_cppflags="$common_cppflags $CPPFLAGS"
 
 AS_CASE([$host],
@@ -2652,7 +2652,7 @@ AC_CONFIG_COMMANDS_PRE([
   mkexe_exp="$mkexe_cmd_exp"
   AS_IF([test -n "$mkexe_cflags"],
     [mkexe="$mkexe $mkexe_cflags"
-    mkexe_exp="$mkexe_exp $common_cflags $CFLAGS"])
+    mkexe_exp="$mkexe_exp $common_cflags $(printf "%s" "$CFLAGS" | sed -r -e 's/-fdebug-prefix-map=\S+//' -e 's/-ffile-prefix-map=\S+//')"])
   AS_IF([test -n "$mkexe_extra_flags"],
     [mkexe="$mkexe $mkexe_extra_flags"
     mkexe_exp="$mkexe_exp $mkexe_extra_flags"])