Some distributions (Debian) adds `-ffile-prefix-map=/current/pwd=` to
CFLAGS in an attempt to make the package more reproducible when source
code is using `__FILE__`. Unfortunately, this makes HAProxy build not
reproducible since CFLAGS is recorded to be displayed in `haproxy
--version`. To solve this, we filter out these arguments as they are
not really important to report to the user.

This could be backported to 2.4. Older versions do not display CFLAGS.
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 50a21b3105cd..6597f0bf855f 100644
--- a/Makefile
+++ b/Makefile
@@ -968,7 +968,7 @@ src/haproxy.o:      src/haproxy.c $(DEP)
              -DBUILD_ARCH='"$(strip $(ARCH))"' \
              -DBUILD_CPU='"$(strip $(CPU))"' \
              -DBUILD_CC='"$(strip $(CC))"' \
-             -DBUILD_CFLAGS='"$(strip $(VERBOSE_CFLAGS))"' \
+             -DBUILD_CFLAGS='"$(filter-out -ffile-prefix-map=% 
-fmacro-prefix-map=% -fdebug-prefix-map=%,$(strip $(VERBOSE_CFLAGS)))"' \
              -DBUILD_OPTIONS='"$(strip $(BUILD_OPTIONS))"' \
              -DBUILD_DEBUG='"$(strip $(DEBUG))"' \
              -DBUILD_FEATURES='"$(strip $(BUILD_FEATURES))"' \
-- 
2.33.0


Reply via email to