On 2022-03-07, Andrew Bartlett wrote:
> I would rather this be discussed and implemented upstream.
>
> For one, the tevent build system is shared with the rest of Samba, and
> if possible this should be implemented by default for all 'make
> install' runs, just as we do to strip out the bin/default from -rpath.

Originally reported as https://bugs.debian.org/1006863 where I proposed
passing additional arguments via CFLAGS in the debian build system.

Attached is a proof of concept patch that works by adding the argument
to CFLAGS by patching the upstream buildsystem.

The patch is bit ugly in how it derives the top level source directory
and likely error-prone... a cleaner way of going about that would be
much appreciated!

It also requires gcc 8+ or clang 10+ ... making it detect weather the
argument was supported and only adding it conditionally might be
desireable.

I am not too familiar with samba project processes, let me know if
there's a better place to send this!


live well,
  vagrant

> On Sun, 2022-03-06 at 16:43 -0800, Vagrant Cascadian wrote:
>> Source: tevent
>> Severity: normal
>> Tags: patch
>> User: reproducible-bui...@lists.alioth.debian.org
>> Usertags: buildpath
>> X-Debbugs-Cc: reproducible-b...@lists.alioth.debian.org
>> 
>> The build path and resulting Build ID for various libraries is
>> embedded:
>> 
>>   
>> https://tests.reproducible-builds.org/debian/rb-pkg/unstable/amd64/diffoscope-results/tevent.html
>> 
>>   /usr/lib/x86_64-linux-gnu/libtevent.so.0.11.0
>> 
>>   /build/1st/tevent-0.11.0/bin/default/../../tevent.c:303
>>   vs.
>>   /build/2/tevent-0.11.0/2nd/bin/default/../../tevent.c:303
>> 
>> The attached patch to debian/rules fixes this by passing
>> -ffile-prefix-map via CFLAGS in the dh_auto_configure override.
>> 
>> Alternately, updating to use the CFLAGS passed via dh/debhelper would
>> also likely fix this.
>> 
>> With this patch applied tevent should build reproducibly on
>> tests.reproducible-builds.org!

From 8324603d80051d6ad2f3f5fcdcc0a110f159b5aa Mon Sep 17 00:00:00 2001
From: Vagrant Cascadian <vagr...@reproducible-builds.org>
Date: Sat, 12 Mar 2022 21:46:46 +0000
Subject: [PATCH] buildtools/wafsamba/samba_autoconf.py: Add -ffile-prefix-map
 to CFLAGS.

Without this, the build path is embedded in various binaries, which
requires additional knowledge about the build environment in order to
reproduce the build.
---
 buildtools/wafsamba/samba_autoconf.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/buildtools/wafsamba/samba_autoconf.py b/buildtools/wafsamba/samba_autoconf.py
index 4d2aea6..d618182 100644
--- a/buildtools/wafsamba/samba_autoconf.py
+++ b/buildtools/wafsamba/samba_autoconf.py
@@ -725,6 +725,13 @@ def SAMBA_CONFIG_H(conf, path=None):
     if Options.options.debug:
         conf.ADD_CFLAGS('-g', testflags=True)
 
+    # Remove build path using -ffile-prefix-map. Requires gcc 8+ or clang 10+
+    # https://reproducible-builds.org/docs/build-path/
+
+    # Determine the top-level source directory by stripping out the relative path that waf was called as.
+    sourcedir=os.path.abspath(sys.argv[0]).split(sys.argv[0].lstrip('.'))[0]
+    conf.ADD_CFLAGS('-ffile-prefix-map=%s=.' % sourcedir, testflags=True)
+
     if Options.options.pidl_developer:
         conf.env.PIDL_DEVELOPER_MODE = True
 
-- 
2.35.1

Attachment: signature.asc
Description: PGP signature

Reply via email to