| 1 |
To make the PostgreSQL server packages build reproducibly, we need to remove |
| 2 |
the build path from -fdebug-prefix-map and -ffile-prefix-map in CFLAGS. |
| 3 |
|
| 4 |
* The actual server build still uses the original CFLAGS so the build path is |
| 5 |
correctly mapped in the object files. |
| 6 |
* The information printed by the pg_config binary and the system view is |
| 7 |
filtered in src/common/Makefile and the configure script. |
| 8 |
* The build paths stored in Makefile.global are filtered in debian/rules. |
| 9 |
(abs_top_builddir, abs_top_srcdir, configure_args, CFLAGS) |
| 10 |
* To make PGXS module builds reproducible, pg_buildext copies the environment |
| 11 |
CFLAGS to COPT where Makefile.global picks them up, using the prefix maps |
| 12 |
from dpkg-buildflags. |
| 13 |
|
| 14 |
--- a/src/common/Makefile |
| 15 |
+++ b/src/common/Makefile |
| 16 |
@@ -33,7 +33,7 @@ STD_CPPFLAGS := $(filter-out -I$(top_src |
| 17 |
STD_LDFLAGS := $(filter-out -L$(top_builddir)/src/common -L$(top_builddir)/src/port,$(LDFLAGS)) |
| 18 |
override CPPFLAGS += -DVAL_CC="\"$(CC)\"" |
| 19 |
override CPPFLAGS += -DVAL_CPPFLAGS="\"$(STD_CPPFLAGS)\"" |
| 20 |
-override CPPFLAGS += -DVAL_CFLAGS="\"$(CFLAGS)\"" |
| 21 |
+override CPPFLAGS += -DVAL_CFLAGS="\"$(filter-out -fdebug-prefix-map=% -ffile-prefix-map=%,$(CFLAGS))\"" |
| 22 |
override CPPFLAGS += -DVAL_CFLAGS_SL="\"$(CFLAGS_SL)\"" |
| 23 |
override CPPFLAGS += -DVAL_LDFLAGS="\"$(STD_LDFLAGS)\"" |
| 24 |
override CPPFLAGS += -DVAL_LDFLAGS_EX="\"$(LDFLAGS_EX)\"" |
| 25 |
--- a/configure.ac |
| 26 |
+++ b/configure.ac |
| 27 |
@@ -27,6 +27,7 @@ AC_COPYRIGHT([Copyright (c) 1996-2023, P |
| 28 |
AC_CONFIG_SRCDIR([src/backend/access/common/heaptuple.c]) |
| 29 |
AC_CONFIG_AUX_DIR(config) |
| 30 |
AC_PREFIX_DEFAULT(/usr/local/pgsql) |
| 31 |
+[ac_configure_args=$(echo "$ac_configure_args" | sed -e "s/ -f\(debug\|file\)-prefix-map=[^' ]*//g")] |
| 32 |
AC_DEFINE_UNQUOTED(CONFIGURE_ARGS, ["$ac_configure_args"], [Saved arguments from configure]) |
| 33 |
|
| 34 |
[PG_MAJORVERSION=`expr "$PACKAGE_VERSION" : '\([0-9][0-9]*\)'`] |