Source: slashem Version: 0.0.7E7F3-7 Severity: wishlist Tags: patch upstream User: reproducible-builds@lists.alioth.debian.org Usertags: timestamps fileordering X-Debbugs-Cc: reproducible-builds@lists.alioth.debian.org
Hi! While working on the "reproducible builds" effort [1], we have noticed that slashem could not be built reproducibly. It embeds the current build time into the binary. The attached patch, which is based on a similar patch for src:nethack 3.6.0-2, fixes those issues. Regards, Reiner [1]: https://wiki.debian.org/ReproducibleBuilds
diff --git a/debian/patches/reproducible-build.patch b/debian/patches/reproducible-build.patch new file mode 100644 index 0000000..9e14bfb --- /dev/null +++ b/debian/patches/reproducible-build.patch @@ -0,0 +1,58 @@ +Author: Reiner Herrmann <rei...@reiner-h.de> +Description: Enable reproducible builds + - Use C locale for sorting files while creating archive with dlb + - Honour SOURCE_DATE_EPOCH for embedded timestamp +Origin: based on patch in src:nethack 3.6.0-2 + +--- a/sys/unix/Makefile.top ++++ b/sys/unix/Makefile.top +@@ -273,8 +273,8 @@ + + dlb: + ( cd util ; $(MAKE) dlb ) +- ( cd dat ; ../util/dlb cf nhshare $(SHARE_DATDLB) ) +- ( cd dat ; ../util/dlb cf nhushare $(UNSHARE_DATDLB) ) ++ ( cd dat ; LC_ALL=C ../util/dlb cf nhshare $(SHARE_DATDLB) ) ++ ( cd dat ; LC_ALL=C ../util/dlb cf nhushare $(UNSHARE_DATDLB) ) + + # recover can be used when INSURANCE is defined in include/config.h + # and the checkpoint option is true +--- a/util/makedefs.c ++++ b/util/makedefs.c +@@ -598,7 +598,7 @@ + do_date() + { + long clocktim = 0; +- char *c, *cbuf, buf[BUFSZ]; ++ char *c, *cbuf, buf[BUFSZ], *source_date_epoch; + const char *ul_sfx; + + cbuf = malloc(600); +@@ -614,13 +614,12 @@ + Fprintf(ofp,"/*\tSCCS Id: @(#)date.h\t3.4\t2002/02/03 */\n\n"); + Fprintf(ofp,Dont_Edit_Code); + +-#ifdef KR1ED + (void) time(&clocktim); +- Strcpy(cbuf, ctime(&clocktim)); +-#else +- (void) time((time_t *)&clocktim); +- Strcpy(cbuf, ctime((time_t *)&clocktim)); +-#endif ++ source_date_epoch = getenv("SOURCE_DATE_EPOCH"); ++ if (source_date_epoch) ++ clocktim = strtoull(source_date_epoch, NULL, 10); ++ Strcpy(cbuf, asctime(gmtime(&clocktim))); ++ + for (c = cbuf; *c; c++) if (*c == '\n') break; + *c = '\0'; /* strip off the '\n' */ + #ifdef NHSTDC +@@ -649,7 +648,7 @@ + version_id_string(buf, cbuf)); + #ifdef AMIGA + { +- struct tm *tm = localtime((time_t *) &clocktim); ++ struct tm *tm = gmtime((time_t *) &clocktim); + Fprintf(ofp,"#define AMIGA_VERSION_STRING "); + Fprintf(ofp,"\"\\0$VER: NetHack %d.%d.%d (%d.%d.%d)\"\n", + VERSION_MAJOR, VERSION_MINOR, PATCHLEVEL, diff --git a/debian/patches/series b/debian/patches/series index ba76b8a..ff7bd88 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -2,3 +2,4 @@ fix-libpng15-ftbfs.patch spelling-error.patch slashem-debian.patch clang_FTBFS_Wreturn-type.patch +reproducible-build.patch
signature.asc
Description: Digital signature
_______________________________________________ Reproducible-builds mailing list Reproducible-builds@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/reproducible-builds