Source: schism
Version: 2:20250313-1
Severity: wishlist
Tags: patch
User: reproducible-bui...@lists.alioth.debian.org
Usertags: timestamps
X-Debbugs-Cc: reproducible-b...@lists.alioth.debian.org

Hi,

Whilst working on the Reproducible Builds effort [0], we noticed that
schism could not be built reproducibly.

This is because it embedded the timestamp of a source file via the
__TIMESTAMP__ macro. Unlike __DATE__ and __TIME__, this macro is not
automatically adjusted to SOURCE_DATE_EPOCH.

│ │ │ ├── ./usr/bin/schismtracker
│ │ │ │ ├── strings --all --bytes=8 {}
│ │ │ │ │ @@ -2382,15 +2382,15 @@
│ │ │ │ │  %3s %3s %d %d:%d:%d %d
│ │ │ │ │ -Thu Mar 13 15:04:35 2025
│ │ │ │ │ +Fri Mar 14 17:04:35 2025
│ │ │ │ │  %3s %3s  %d %d:%d:%d %d
│ │ │ │ │  %3s %d %d

Patch attached, although other solutions are obviously available.

 [0] https://reproducible-builds.org/


Regards,

-- 
      ,''`.
     : :'  :     Chris Lamb
     `. `'`      la...@debian.org / chris-lamb.co.uk
       `-
--- a/debian/patches/0001-Reproducible-build.patch      1969-12-31 
16:00:00.000000000 -0800
--- b/debian/patches/0001-Reproducible-build.patch      2025-04-21 
09:19:54.639357255 -0700
@@ -0,0 +1,22 @@
+Description: Make the build reproducible
+Author: Chris Lamb <la...@debian.org>
+Last-Update: 2025-04-21
+
+--- schism-20250313.orig/schism/version.c
++++ schism-20250313/schism/version.c
+@@ -218,6 +218,7 @@ static inline int get_version_date(int *
+ #endif
+ 
+ #ifdef __TIMESTAMP__
++#ifndef SOURCE_DATE_EPOCH
+       /* The last time THIS source file was actually edited. */
+       {
+               char day_of_week[4], month[4];
+@@ -236,6 +237,7 @@ static inline int get_version_date(int *
+               }
+       }
+ #endif
++#endif
+ 
+       {
+               // __DATE__ should be defined everywhere.
--- a/debian/patches/series     1969-12-31 16:00:00.000000000 -0800
--- b/debian/patches/series     2025-04-21 09:15:06.770698318 -0700
@@ -0,0 +1 @@
+0001-Reproducible-build.patch
--- a/debian/rules      2025-04-21 09:00:43.520722724 -0700
--- b/debian/rules      2025-04-21 09:19:50.271347256 -0700
@@ -1,10 +1,12 @@
 #! /usr/bin/make -f
 
 export DEB_BUILD_MAINT_OPTIONS = hardening=+all
+export DEB_CPPFLAGS_MAINT_APPEND = -DSOURCE_DATE_EPOCH=$(SOURCE_DATE_EPOCH)
 
 DPKG_EXPORT_BUILDFLAGS = 1
 include /usr/share/dpkg/buildflags.mk
 
+
 %:
        dh $@
 

Reply via email to