[yquake2] 07/11: Add patch for CTF to use SOURCE_DATE_EPOCH

Simon McVittie smcv at debian.org
Thu Sep 14 15:08:02 UTC 2017


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to branch debian/master
in repository yquake2.

commit 0e64d229b11a9eda870638729ee13ea9efba61ef
Author: Simon McVittie <smcv at debian.org>
Date:   Thu Sep 14 11:26:39 2017 +0100

    Add patch for CTF to use SOURCE_DATE_EPOCH
---
 debian/changelog                                   |  1 +
 ...-SOURCE_DATE_EPOCH-for-reproducible-build.patch | 78 ++++++++++++++++++++++
 debian/patches/series                              |  1 +
 3 files changed, 80 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 055d46a..d871b87 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -9,6 +9,7 @@ yquake2 (7.01+ctf1.05~dfsg-1) UNRELEASED; urgency=medium
     precompiled mkdir.exe.
   * Rely on Files-Excluded in debian/copyright to repack tarball
   * Add game code for CTF v1.05, which is also GPL
+  * Add patch for CTF to use SOURCE_DATE_EPOCH
 
  -- Simon McVittie <smcv at debian.org>  Mon, 26 Jun 2017 11:05:54 +0100
 
diff --git a/debian/patches/ctf-Use-SOURCE_DATE_EPOCH-for-reproducible-build.patch b/debian/patches/ctf-Use-SOURCE_DATE_EPOCH-for-reproducible-build.patch
new file mode 100644
index 0000000..6c2ae48
--- /dev/null
+++ b/debian/patches/ctf-Use-SOURCE_DATE_EPOCH-for-reproducible-build.patch
@@ -0,0 +1,78 @@
+From: Simon McVittie <smcv at debian.org>
+Date: Thu, 14 Sep 2017 11:23:58 +0100
+Subject: ctf: Use SOURCE_DATE_EPOCH for reproducible build
+
+---
+ ctf/Makefile     |  7 +++++++
+ ctf/src/g_save.c | 12 ++++++++----
+ 2 files changed, 15 insertions(+), 4 deletions(-)
+
+diff --git a/ctf/Makefile b/ctf/Makefile
+index eb96775..83eb806 100644
+--- a/ctf/Makefile
++++ b/ctf/Makefile
+@@ -68,6 +68,13 @@ endif
+ 
+ # ----------
+ 
++# https://reproducible-builds.org/specs/source-date-epoch/
++ifdef SOURCE_DATE_EPOCH
++CFLAGS += -DBUILD_DATE=\"$(shell date --utc --date="@${SOURCE_DATE_EPOCH}" +"%b %_d %Y" | sed -e 's/ /\\ /g')\"
++endif
++
++# ----------
++
+ # Builds everything
+ all: ctf
+ 
+diff --git a/ctf/src/g_save.c b/ctf/src/g_save.c
+index b2f4bd6..893eccc 100644
+--- a/ctf/src/g_save.c
++++ b/ctf/src/g_save.c
+@@ -28,6 +28,10 @@
+ 
+ #include "header/local.h"
+ 
++#ifndef BUILD_DATE
++#define BUILD_DATE __DATE__
++#endif
++
+ field_t fields[] = {
+ 	{"classname", FOFS(classname), F_LSTRING},
+ 	{"origin", FOFS(s.origin), F_VECTOR},
+@@ -141,7 +145,7 @@ void
+ InitGame(void)
+ {
+ 	gi.dprintf("Game is starting up.\n");
+-	gi.dprintf("Game is ctf built on %s.\n", GAMEVERSION, __DATE__);
++	gi.dprintf("Game is ctf built on %s.\n", GAMEVERSION, BUILD_DATE);
+ 
+ 	gun_x = gi.cvar("gun_x", "0", 0);
+ 	gun_y = gi.cvar("gun_y", "0", 0);
+@@ -157,7 +161,7 @@ InitGame(void)
+ 	/* latched vars */
+ 	sv_cheats = gi.cvar("cheats", "0", CVAR_SERVERINFO | CVAR_LATCH);
+ 	gi.cvar("gamename", GAMEVERSION, CVAR_SERVERINFO | CVAR_LATCH);
+-	gi.cvar("gamedate", __DATE__, CVAR_SERVERINFO | CVAR_LATCH);
++	gi.cvar("gamedate", BUILD_DATE, CVAR_SERVERINFO | CVAR_LATCH);
+ 	maxclients = gi.cvar("maxclients", "4", CVAR_SERVERINFO | CVAR_LATCH);
+ 	deathmatch = gi.cvar("deathmatch", "0", CVAR_LATCH);
+ 	coop = gi.cvar("coop", "0", CVAR_LATCH);
+@@ -493,7 +497,7 @@ WriteGame(char *filename, qboolean autosave)
+ 	}
+ 
+ 	memset(str, 0, sizeof(str));
+-	strcpy(str, __DATE__);
++	strcpy(str, BUILD_DATE);
+ 	fwrite(str, sizeof(str), 1, f);
+ 
+ 	game.autosaved = autosave;
+@@ -526,7 +530,7 @@ ReadGame(char *filename)
+ 
+ 	fread(str, sizeof(str), 1, f);
+ 
+-	if (strcmp(str, __DATE__))
++	if (strcmp(str, BUILD_DATE))
+ 	{
+ 		fclose(f);
+ 		gi.error("Savegame from an older version.\n");
diff --git a/debian/patches/series b/debian/patches/series
index 8b9c105..ad7e33b 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,3 @@
 Append-to-C-LD-FLAGS-instead-of-overriding-them-to-o.patch
 Remove-unwanted-rpaths-from-LDFLAGS.patch
+ctf-Use-SOURCE_DATE_EPOCH-for-reproducible-build.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/yquake2.git



More information about the Pkg-games-commits mailing list