debian/rules: don't include build path in binaries
authorMaximilian Engelhardt <maxi@daemonizer.de>
Fri, 11 Dec 2020 18:14:24 +0000 (19:14 +0100)
committerHans van Kranenburg <hans@knorrie.org>
Sun, 28 Feb 2021 18:53:12 +0000 (19:53 +0100)
This is part of making the package build reproducibly.

Signed-off-by: Maximilian Engelhardt <maxi@daemonizer.de>
Acked-by: Hans van Kranenburg <hans@knorrie.org>
debian/rules

index 57dde6b0c8f40ff0810caf44d8b4f7fdcbcc07cb..38386568d6c307f8df8eb264397485dba2fb14ec 100755 (executable)
@@ -19,7 +19,7 @@ SHELL    := bash -e
 # Inexplicably, if you tell make `export V=value' and `$(shell ...)'
 # it does not pass V to the shell.  WTF.  So we set a variable
 # dbmo which we include in the relevant $(shell ...) invocations.
-dbmo= DEB_BUILD_MAINT_OPTIONS=hardening=+all
+dbmo= DEB_BUILD_MAINT_OPTIONS="hardening=+all reproducible=+fixfilepath"
 
 # Architecture handling.
 #
@@ -140,8 +140,14 @@ make_args_common := \
        XEN_COMPILE_ARCH=$(xen_arch_$(DEB_BUILD_ARCH)) \
        V=1
 
+# Passing -ffile-prefix-map is needed for reproducible builds.
+# Additionally passing -fdebug-prefix-map in necessary to work around a gcc bug
+# where -ffile-prefix-map is ignored with assembly files. See
+# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93371
 make_args_xen := $(make_args_common) \
-       XEN_TARGET_ARCH=$(xen_arch_$(flavour))
+       XEN_TARGET_ARCH=$(xen_arch_$(flavour)) \
+       EXTRA_CFLAGS_XEN_CORE='-ffile-prefix-map=$(shell pwd)=. -fdebug-prefix-map=$(shell pwd)=.'
+
 # (Xen upstream does not offer a separate CPPFLAGS,
 # so we pass those in CFLAGS.)