[openarena] 02/07: Use Debian changelog date as a replacement for __DATE__, for reproducible builds

Simon McVittie smcv at debian.org
Sun May 3 20:50:58 UTC 2015


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

smcv pushed a commit to branch master
in repository openarena.

commit 6db219823b52c85d364d117bc67791823013514f
Author: Simon McVittie <smcv at debian.org>
Date:   Wed Apr 29 08:50:57 2015 +0100

    Use Debian changelog date as a replacement for __DATE__, for reproducible builds
---
 debian/changelog                                   |  2 +
 ...E__-to-be-avoided-for-reproducible-builds.patch | 62 ++++++++++++++++++++++
 debian/patches/series                              |  1 +
 debian/rules                                       |  2 +
 4 files changed, 67 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 284f59f..d4ebd67 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,8 @@ openarena (0.8.8-12) UNRELEASED; urgency=medium
 
   * Disable patch numbers in debian/patches, to reduce diffstat when patches
     are re-ordered
+  * Use Debian changelog date as a replacement for __DATE__, for reproducible
+    builds
 
  -- Simon McVittie <smcv at debian.org>  Wed, 29 Apr 2015 08:42:12 +0100
 
diff --git a/debian/patches/Allow-__DATE__-to-be-avoided-for-reproducible-builds.patch b/debian/patches/Allow-__DATE__-to-be-avoided-for-reproducible-builds.patch
new file mode 100644
index 0000000..a404eac
--- /dev/null
+++ b/debian/patches/Allow-__DATE__-to-be-avoided-for-reproducible-builds.patch
@@ -0,0 +1,62 @@
+From: Simon McVittie <smcv at debian.org>
+Date: Thu, 2 Apr 2015 11:10:26 +0100
+Subject: Allow __DATE__ to be avoided, for reproducible builds
+
+---
+ Makefile                | 4 ++++
+ code/game/g_main.c      | 4 ++--
+ code/qcommon/q_shared.h | 4 ++++
+ 3 files changed, 10 insertions(+), 2 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 9732cc6..a0f4193 100644
+--- a/Makefile
++++ b/Makefile
+@@ -850,6 +850,10 @@ else
+   DEPEND_CFLAGS =
+ endif
+ 
++ifdef PRODUCT_DATE
++  BASE_CFLAGS += -DPRODUCT_DATE=\\\"$(shell echo $(PRODUCT_DATE) | sed -e 's/ /\\\ /'g)\\\"
++endif
++
+ BASE_CFLAGS += -DPRODUCT_VERSION=\\\"$(VERSION)\\\"
+ 
+ ifeq ($(OPENARENA_081_COMPATIBLE),1)
+diff --git a/code/game/g_main.c b/code/game/g_main.c
+index 48baac7..426973e 100644
+--- a/code/game/g_main.c
++++ b/code/game/g_main.c
+@@ -204,7 +204,7 @@ static cvarTable_t		gameCvarTable[] = {
+ 
+ 	// noset vars
+ 	{ NULL, "gamename", GAMEVERSION , CVAR_SERVERINFO | CVAR_ROM, 0, qfalse  },
+-	{ NULL, "gamedate", __DATE__ , CVAR_ROM, 0, qfalse  },
++	{ NULL, "gamedate", PRODUCT_DATE , CVAR_ROM, 0, qfalse  },
+ 	{ &g_restarted, "g_restarted", "0", CVAR_ROM, 0, qfalse  },
+ 	{ NULL, "sv_mapname", "", CVAR_SERVERINFO | CVAR_ROM, 0, qfalse  },
+ 
+@@ -693,7 +693,7 @@ void G_InitGame( int levelTime, int randomSeed, int restart ) {
+         
+         G_Printf ("------- Game Initialization -------\n");
+         G_Printf ("gamename: %s\n", GAMEVERSION);
+-        G_Printf ("gamedate: %s\n", __DATE__);
++        G_Printf ("gamedate: %s\n", PRODUCT_DATE);
+ 
+ 	srand( randomSeed );
+ 
+diff --git a/code/qcommon/q_shared.h b/code/qcommon/q_shared.h
+index 446add3..ded56bb 100644
+--- a/code/qcommon/q_shared.h
++++ b/code/qcommon/q_shared.h
+@@ -42,6 +42,10 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+   #define PRODUCT_VERSION "OAX"
+ #endif
+ 
++#ifndef PRODUCT_DATE
++#  define PRODUCT_DATE __DATE__
++#endif
++
+ #define Q3_VERSION PRODUCT_NAME " " PRODUCT_VERSION
+ 
+ #define MAX_TEAMNAME 32
diff --git a/debian/patches/series b/debian/patches/series
index 0b38c50..a443db9 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -5,3 +5,4 @@
 0040-Add-OPENARENA_081_COMPATIBLE-define-for-network-comp.patch
 openarena_hurd_support.patch
 Use-LDFLAGS-on-non-Linux-too.patch
+Allow-__DATE__-to-be-avoided-for-reproducible-builds.patch
diff --git a/debian/rules b/debian/rules
index a4905cf..815d4b8 100755
--- a/debian/rules
+++ b/debian/rules
@@ -8,6 +8,7 @@ Q3PLATFORM         := $(shell /usr/share/ioquake3/q3arch platform HOST)
 Q3COMPILE_ARCH     := $(shell /usr/share/ioquake3/q3arch arch     BUILD)
 Q3COMPILE_PLATFORM := $(shell /usr/share/ioquake3/q3arch platform BUILD)
 distro             := $(shell lsb_release -is)
+PRODUCT_DATE := $(shell date --date="`dpkg-parsechangelog -SDate`" "+%b %_d %Y")
 
 # the Q3 engine's build system doesn't respect CPPFLAGS, so put them in CFLAGS
 CFLAGS += $(CPPFLAGS) -fsigned-char
@@ -34,6 +35,7 @@ GAME_OPTIONS = \
 	BUILD_GAME_SO=1 \
 	CROSS_COMPILING=1 \
 	VERSION=$(DEB_VERSION)/$(distro) \
+	PRODUCT_DATE='$(PRODUCT_DATE)' \
 	$(NULL)
 
 TARGET = release

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



More information about the Pkg-games-commits mailing list