cc plugin: Filter out -ffile-prefix-map etc. from CFLAGS
authorSimon McVittie <smcv@debian.org>
Mon, 23 Aug 2021 08:40:33 +0000 (09:40 +0100)
committerHilko Bengen <bengen@debian.org>
Sat, 29 Jul 2023 09:19:01 +0000 (10:19 +0100)
The default CFLAGS from dpkg-buildflags include this compiler flag to
rewrite nbdkit's own source directory in __FILE__, debug symbols and
similar constructs so that the source directory used by the developer
or the transient source directory used by an autobuilder is not
written into the executable, which would make it non-reproducible
between different build directories. Older versions used
-fdebug-prefix-map for a similar (although more limited) purpose.

However, these particular flags are not useful when compiling a new
plugin at a later time, and because they include the package's source
directory, including them in the binary makes it non-reproducible
between different build directories.

Signed-off-by: Simon McVittie <smcv@debian.org>
Bug-Debian: https://bugs.debian.org/992722

Gbp-Pq: Name 0009-cc-plugin-Filter-out-ffile-prefix-map-etc.-from-CFLA.patch

plugins/cc/Makefile.am

index df8b5d1507c828b2c12f092eef433532c0b8c203..a99d3965a2a4c6e85124ad0e8c00ae520a6749a8 100644 (file)
@@ -46,7 +46,7 @@ nbdkit_cc_plugin_la_SOURCES = \
 
 nbdkit_cc_plugin_la_CPPFLAGS = \
        -DCC="\"$(CC)\"" \
-       -DCFLAGS="\"$(CFLAGS)\"" \
+       -DCFLAGS="\"$(filter-out -ffile-prefix-map=% -fdebug-prefix-map=%,$(CFLAGS))\"" \
        -I$(top_srcdir)/include \
        -I$(top_builddir)/include \
        -I$(top_srcdir)/common/include \