[yquake2] 07/09: Add patch to replace __DATE__ with BUILDDATE, and define that macro from the debian/changelog date

Simon McVittie smcv at debian.org
Tue May 5 10:40:26 UTC 2015


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

smcv pushed a commit to branch master
in repository yquake2.

commit a829c295449ef869ec28016ecfc926e5577675b8
Author: Simon McVittie <smcv at debian.org>
Date:   Tue May 5 10:46:13 2015 +0100

    Add patch to replace __DATE__ with BUILDDATE, and define that macro from the debian/changelog date
    
      - build with TZ=UTC and LC_ALL=C.UTF-8 to make that deterministic
---
 debian/changelog                                   |  3 ++
 ...TE-macro-which-overrides-__DATE__-for-rep.patch | 51 ++++++++++++++++++++++
 debian/patches/series                              |  1 +
 debian/rules                                       | 14 +++++-
 4 files changed, 67 insertions(+), 2 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index c60c788..853174b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -8,6 +8,9 @@ yquake2 (5.30~dfsg1-1) UNRELEASED; urgency=medium
       using as our LIBDIR
   * Use https and cgit for Vcs-Browser
   * Stop using numbered patches for gbp pq
+  * Add patch to replace __DATE__ with BUILDDATE, and define that macro
+    from the debian/changelog date
+    - build with TZ=UTC and LC_ALL=C.UTF-8 to make that deterministic
 
  -- Simon McVittie <smcv at debian.org>  Tue, 05 May 2015 10:26:54 +0100
 
diff --git a/debian/patches/Add-BUILDDATE-macro-which-overrides-__DATE__-for-rep.patch b/debian/patches/Add-BUILDDATE-macro-which-overrides-__DATE__-for-rep.patch
new file mode 100644
index 0000000..bb0460c
--- /dev/null
+++ b/debian/patches/Add-BUILDDATE-macro-which-overrides-__DATE__-for-rep.patch
@@ -0,0 +1,51 @@
+From: Simon McVittie <smcv at debian.org>
+Date: Tue, 5 May 2015 10:44:00 +0100
+Subject: Add BUILDDATE macro which overrides __DATE__, for reproducible builds
+
+---
+ src/common/header/common.h   | 4 ++++
+ src/common/misc.c            | 2 +-
+ src/game/savegame/savegame.c | 2 +-
+ 3 files changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/src/common/header/common.h b/src/common/header/common.h
+index f4c930d..76d7e6a 100644
+--- a/src/common/header/common.h
++++ b/src/common/header/common.h
+@@ -63,6 +63,10 @@
+  #define CPUSTRING "Unknown"
+ #endif
+ 
++#ifndef BUILDDATE
++#define BUILDDATE __DATE__
++#endif
++
+ #ifdef _WIN32
+  #define CFGDIR "YamagiQ2"
+ #else
+diff --git a/src/common/misc.c b/src/common/misc.c
+index 61ebe06..f54d659 100644
+--- a/src/common/misc.c
++++ b/src/common/misc.c
+@@ -241,7 +241,7 @@ Qcommon_Init(int argc, char **argv)
+ 	dedicated = Cvar_Get("dedicated", "0", CVAR_NOSET);
+ #endif
+ 
+-	s = va("%s %s %s %s", YQ2VERSION, CPUSTRING, __DATE__, BUILDSTRING);
++	s = va("%s %s %s %s", YQ2VERSION, CPUSTRING, BUILDDATE, BUILDSTRING);
+ 	Cvar_Get("version", s, CVAR_SERVERINFO | CVAR_NOSET);
+ 
+ 	if (dedicated->value)
+diff --git a/src/game/savegame/savegame.c b/src/game/savegame/savegame.c
+index ce235e2..7456cec 100644
+--- a/src/game/savegame/savegame.c
++++ b/src/game/savegame/savegame.c
+@@ -217,7 +217,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", BUILDDATE, CVAR_SERVERINFO | CVAR_LATCH);
+ 	maxclients = gi.cvar("maxclients", "4", CVAR_SERVERINFO | CVAR_LATCH);
+ 	maxspectators = gi.cvar("maxspectators", "4", CVAR_SERVERINFO);
+ 	deathmatch = gi.cvar("deathmatch", "0", CVAR_LATCH);
diff --git a/debian/patches/series b/debian/patches/series
index 99be82b..5f01473 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,4 @@
 Append-to-C-LD-FLAGS-instead-of-overriding-them-to-o.patch
 Fix-spelling-errors-detected-by-lintian.patch
 Optionally-link-libopenal-at-compile-time.patch
+Add-BUILDDATE-macro-which-overrides-__DATE__-for-rep.patch
diff --git a/debian/rules b/debian/rules
index 0ab1695..29e0a5c 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,13 +1,23 @@
 #!/usr/bin/make -f
 
-DEB_CPPFLAGS_MAINT_APPEND += -DLIBDIR=\"/usr/lib/yamagi-quake2/\"
+export LC_ALL=C.UTF-8
+export TZ=UTC
+
+DEB_CPPFLAGS_MAINT_APPEND += -I$(CURDIR) -include debian/yquake2.h
 DEB_LDFLAGS_MAINT_APPEND  += -Wl,--as-needed -Wl,-z,defs
 export DEB_CPPFLAGS_MAINT_APPEND DEB_LDFLAGS_MAINT_APPEND
 
 %:
 	dh $@
 
-override_dh_auto_build:
+debian/yquake2.h:
+	date --utc --date="`dpkg-parsechangelog -SDate`" \
+		"+#define BUILDDATE \"%b %_d %Y\"" > $@
+
+export LC_ALL=C.UTF-8
+export TZ=UTC
+
+override_dh_auto_build: debian/yquake2.h
 	dh_auto_build -- \
 		DLOPEN_LIBGL=no \
 		DLOPEN_OPENAL=no \

-- 
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