filter-debug-prefix-map

To make the PostgreSQL server packages build reproducibly, we need to remove
the build path from -fdebug-prefix-map and -ffile-prefix-map in CFLAGS.

* The actual server build still uses the original CFLAGS so the build path is
  correctly mapped in the object files.
* The information printed by the pg_config binary and the system view is
  filtered in src/common/Makefile.
* The build paths stored in Makefile.global are filtered in debian/rules.
  (abs_top_builddir, abs_top_srcdir, configure_args, CFLAGS)
* To make PGXS module builds reproducible, pg_buildext copies the environment
  CFLAGS to COPT where Makefile.global picks them up, using the prefix maps
  from dpkg-buildflags.


Gbp-Pq: Name filter-debug-prefix-map
This commit is contained in:
Debian PostgreSQL Maintainers 2022-05-14 02:43:37 +08:00 committed by openKylinBot
parent 6c56d504dd
commit af7ffcf1f7
1 changed files with 3 additions and 2 deletions

View File

@ -31,10 +31,11 @@ include $(top_builddir)/src/Makefile.global
# don't include subdirectory-path-dependent -I and -L switches
STD_CPPFLAGS := $(filter-out -I$(top_srcdir)/src/include -I$(top_builddir)/src/include,$(CPPFLAGS))
STD_LDFLAGS := $(filter-out -L$(top_builddir)/src/common -L$(top_builddir)/src/port,$(LDFLAGS))
override CPPFLAGS += -DVAL_CONFIGURE="\"$(configure_args)\""
# filter build path variation from -fdebug-prefix-map and -ffile-prefix-map
override CPPFLAGS += -DVAL_CONFIGURE="\"$(filter-out -fdebug-prefix-map=% -ffile-prefix-map=%,$(configure_args))\""
override CPPFLAGS += -DVAL_CC="\"$(CC)\""
override CPPFLAGS += -DVAL_CPPFLAGS="\"$(STD_CPPFLAGS)\""
override CPPFLAGS += -DVAL_CFLAGS="\"$(CFLAGS)\""
override CPPFLAGS += -DVAL_CFLAGS="\"$(filter-out -fdebug-prefix-map=% -ffile-prefix-map=%,$(CFLAGS))\""
override CPPFLAGS += -DVAL_CFLAGS_SL="\"$(CFLAGS_SL)\""
override CPPFLAGS += -DVAL_LDFLAGS="\"$(STD_LDFLAGS)\""
override CPPFLAGS += -DVAL_LDFLAGS_EX="\"$(LDFLAGS_EX)\""