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

Bug#1011500: tuxcmd-modules: reproducible-builds: embedded build paths in various binaries



Source: tuxcmd-modules
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 in /usr/lib:

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

  /usr/lib/tuxcmd/libarchive_plugin.so

  /build/1st/tuxcmd-modules-0.6.70+ds/libarchive/strutils.c:27
  vs.
  /build/2/tuxcmd-modules-0.6.70+ds/2nd/libarchive/strutils.c:27

The attached patch fixes this by adjusting various Makefiles to set
-ffile-prefix-map in CFLAGS, which avoids embedding the build path in
the compiled binaries.


With this patch applied, tuxcmd-modules should build reproducibly on
tests.reproducible-builds.org!


live well,
  vagrant
From 0bd222e5cf0c9710c97c217fce4d0435cee989bc Mon Sep 17 00:00:00 2001
From: Vagrant Cascadian <vagrant@reproducible-builds.org>
Date: Tue, 24 May 2022 00:39:56 +0000
Subject: [PATCH] Support passing -ffile-prefix-map in various Makefiles.

This avoids embedding the build path in the resulting binaries.

https://reproducible-builds.org/docs/build-path/
---
 Makefile                | 2 ++
 gvfs/Makefile           | 2 ++
 libarchive/Makefile     | 3 +++
 zip/Makefile            | 2 ++
 zip/Makefile.ziparch    | 3 +++
 zip/ZipArchive/Makefile | 3 +++
 6 files changed, 15 insertions(+)

diff --git a/Makefile b/Makefile
index 61dade4..2d78375 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,7 @@
 SUBDIRS = zip libarchive gvfs
 
+export BUILDPATH = $(CURDIR)
+
 all install clean shared static::
 	target=`echo $@ | sed s/-recursive//`; \
 	list='$(SUBDIRS)'; for subdir in $$list; do \
diff --git a/gvfs/Makefile b/gvfs/Makefile
index 9c5d759..8bd0c08 100644
--- a/gvfs/Makefile
+++ b/gvfs/Makefile
@@ -9,6 +9,8 @@ CFLAGS =-I. -I/usr/include \
 	-Wall -fPIC -O2 -g \
 	-DG_DISABLE_DEPRECATED -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE
 
+# Avoid embedding build path
+CFLAGS += -ffile-prefix-map=$(BUILDPATH)=.
 
 # VFS_COMMON_OBJECTS=strutils.o treepathutils.o treepath_vfs.o vfsutils.o
 VFS_COMMON_OBJECTS=
diff --git a/libarchive/Makefile b/libarchive/Makefile
index 8514968..db3c1b5 100644
--- a/libarchive/Makefile
+++ b/libarchive/Makefile
@@ -13,6 +13,9 @@ CFLAGS =-I. -I/usr/include -I$(DIR_COMMON) \
 	-DG_DISABLE_DEPRECATED -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE \
 	-D__VERBOSE_DEBUGx
 
+# Avoid embedding build path
+CFLAGS += -ffile-prefix-map=$(BUILDPATH)=.
+
 VFS_COMMON_OBJECTS=strutils.o treepathutils.o treepath_vfs.o vfsutils.o
 
 VFS_OBJECTS=libarchive.o
diff --git a/zip/Makefile b/zip/Makefile
index 1299323..5d32373 100644
--- a/zip/Makefile
+++ b/zip/Makefile
@@ -12,6 +12,8 @@ CFLAGS =-I. -I$(DIR_ZIPARCHIVE) -I/usr/include \
 	-DG_DISABLE_DEPRECATED -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE \
 	-D__VERBOSE_DEBUGx
 
+# Avoid embedding build path
+CFLAGS += -ffile-prefix-map=$(BUILDPATH)=.
 
 VFS_COMMON_OBJECTS=strutils.o treepathutils.o treepath_vfs.o vfsutils.o
 
diff --git a/zip/Makefile.ziparch b/zip/Makefile.ziparch
index 2a66b94..ab8db23 100644
--- a/zip/Makefile.ziparch
+++ b/zip/Makefile.ziparch
@@ -19,6 +19,9 @@ CCC=cc
 CFLAGS = -D ZIP_ARCHIVE_LNX -fPIC -g -O2
 #CFLAGS =
 
+# Avoid embedding build path
+CFLAGS += -ffile-prefix-map=$(BUILDPATH)=.
+
 ifdef INTERNAL_BZIP2
 CFLAGS += -D ZIP_ARCHIVE_BZIP2_INTERNAL 
 endif
diff --git a/zip/ZipArchive/Makefile b/zip/ZipArchive/Makefile
index a426b6d..627b036 100644
--- a/zip/ZipArchive/Makefile
+++ b/zip/ZipArchive/Makefile
@@ -23,6 +23,9 @@ ifdef INTERNAL_BZIP2
 CFLAGS += -D ZIP_ARCHIVE_BZIP2_INTERNAL
 endif
 
+# Avoid embedding build path
+CFLAGS += -ffile-prefix-map=$(BUILDPATH)=.
+
 ZIPARCHLIB = libziparch.a
 
 ZIPPIELOCATION = ../Zippie/
-- 
2.36.1

Attachment: signature.asc
Description: PGP signature


Reply to: