[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1021464: stfl: reproducible-builds: build path embedded in binaries



Source: stfl
Severity: normal
Tags: patch
User: reproducible-builds@lists.alioth.debian.org
Usertags: buildpath
X-Debbugs-Cc: reproducible-bugs@lists.alioth.debian.org

The build path is embedded in various binaries:

  https://tests.reproducible-builds.org/debian/rb-pkg/unstable/amd64/diffoscope-results/stfl.html

  /usr/lib/x86_64-linux-gnu/perl5/5.34/auto/stfl/stfl.so

  /build/1st/stfl-0.22/public.c:401
  vs.
  /build/2/stfl-0.22/2nd/public.c:401

The attached three patches to debian/rules fix this by adjusting the
make call to use dh_auto_make and passing CFLAGS via the CC variable,
adds -ffile-prefix-map to CFLAGS, and patches the generated
perl5/Makefile to add -ffile-prefix-map to CCFLAGS.

According to my local tests, with these patches applied, stfl should
build reproducibly on tests.reproducible-builds.org!

Thanks for maintaining stfl!

live well,
  vagrant
From c3082dcef861f562cf07ce389566766a2275688a Mon Sep 17 00:00:00 2001
From: Vagrant Cascadian <vagrant@reproducible-builds.org>
Date: Sat, 8 Oct 2022 23:42:42 +0000
Subject: [PATCH 1/3] debian/rules: Use dh_auto_build and pass CFLAGS via CC
 variable.

---
 debian/rules | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/debian/rules b/debian/rules
index 702e49f..d7967f9 100755
--- a/debian/rules
+++ b/debian/rules
@@ -16,7 +16,7 @@ build-indep: build-stamp
 build-stamp:
 	dh_testdir
 
-	$(MAKE) $(MAKE_FOUND_INTERPR)
+	dh_auto_build -- $(MAKE_FOUND_INTERPR) CC="$(CC) -pthread $(CFLAGS)"
 	# perl
 	test ! -f perl5/Makefile || $(MAKE) -C perl5 clean
 	cd perl5 && swig -perl5 stfl.i && perl Makefile.PL INSTALLDIRS=vendor
-- 
2.37.2

From 196634cef1ad5215457096d78ba4ff585fb58f48 Mon Sep 17 00:00:00 2001
From: Vagrant Cascadian <vagrant@reproducible-builds.org>
Date: Sat, 8 Oct 2022 23:43:20 +0000
Subject: [PATCH 2/3] debian/rules: Add -ffile-prefix-map to CFLAGS to avoid
 embedding build paths.

https://reproducible-builds.org/docs/build-path/
---
 debian/rules | 1 +
 1 file changed, 1 insertion(+)

diff --git a/debian/rules b/debian/rules
index d7967f9..a215bdc 100755
--- a/debian/rules
+++ b/debian/rules
@@ -5,6 +5,7 @@ MAKE_DESTDIR        := $(CURDIR)/debian/tmp
 MAKE_FOUND_INTERPR  := FOUND_PERL5=0 FOUND_SWIG=1 FOUND_SPL=0 FOUND_RUBY=0 FOUND_PYTHON=0
 MAKE_INSTALL_TARGET := DESTDIR=$(MAKE_DESTDIR) prefix=/usr
 CFLAGS += -fPIC
+CFLAGS += -ffile-prefix-map=$(CURDIR)=.
 
 include /usr/share/dpkg/architecture.mk
 PERL_VERSION := $(shell perl -MConfig -e 'print $$Config{version}')
-- 
2.37.2

From 37b01a1266e36d7202ed293af7efd85a916bce7a Mon Sep 17 00:00:00 2001
From: Vagrant Cascadian <vagrant@reproducible-builds.org>
Date: Sat, 8 Oct 2022 23:51:42 +0000
Subject: [PATCH 3/3] debian/rules: Add -ffile-prefix-map to CCFLAGS in
 perl5/Makefile to avoid embedding build paths.

https://reproducible-builds.org/docs/build-path/
---
 debian/rules | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/debian/rules b/debian/rules
index a215bdc..0682f15 100755
--- a/debian/rules
+++ b/debian/rules
@@ -21,6 +21,8 @@ build-stamp:
 	# perl
 	test ! -f perl5/Makefile || $(MAKE) -C perl5 clean
 	cd perl5 && swig -perl5 stfl.i && perl Makefile.PL INSTALLDIRS=vendor
+	# Avoid embedding build paths
+	sed -i -e 's,CCFLAGS =,CCFLAGS = -ffile-prefix-map=$(CURDIR)=.,g' perl5/Makefile
 	$(MAKE) -C perl5
 	# ruby
 	dh_ruby --build
-- 
2.37.2

Attachment: signature.asc
Description: PGP signature


Reply to: