[ioquake3] 01/01: Add and use a patch to avoid __DATE__, for reproducible builds; we use the date of the latest changelog entry instead
Simon McVittie
smcv at debian.org
Thu Apr 2 10:16:05 UTC 2015
This is an automated email from the git hooks/post-receive script.
smcv pushed a commit to branch debian-experimental
in repository ioquake3.
commit 9887074018912975464f9a0d1299a4ecd48b081b
Author: Simon McVittie <smcv at debian.org>
Date: Thu Apr 2 11:10:35 2015 +0100
Add and use a patch to avoid __DATE__, for reproducible builds; we use the date of the latest changelog entry instead
---
debian/changelog | 7 ++
...E__-to-be-avoided-for-reproducible-builds.patch | 99 ++++++++++++++++++++++
debian/patches/series | 1 +
debian/rules | 14 ++-
4 files changed, 118 insertions(+), 3 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index 5c355dd..135af54 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+ioquake3 (1.36+u20150228+dfsg1-2) UNRELEASED; urgency=medium
+
+ * Add and use a patch to avoid __DATE__, for reproducible builds;
+ we use the date of the latest changelog entry instead
+
+ -- Simon McVittie <smcv at debian.org> Sun, 15 Mar 2015 12:36:21 +0000
+
ioquake3 (1.36+u20150228+dfsg1-1) experimental; urgency=medium
* New upstream snapshot
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..439f7aa
--- /dev/null
+++ b/debian/patches/Allow-__DATE__-to-be-avoided-for-reproducible-builds.patch
@@ -0,0 +1,99 @@
+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/common.c | 4 ++--
+ code/qcommon/q_shared.h | 4 ++++
+ code/sys/sys_main.c | 2 +-
+ 5 files changed, 13 insertions(+), 5 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index c5b1418..cdf8feb 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1119,6 +1119,10 @@ else
+ STRIP_FLAG = -s
+ endif
+
++ifdef PRODUCT_DATE
++ BASE_CFLAGS += -DPRODUCT_DATE=\\\"$(shell echo $(PRODUCT_DATE) | sed -e 's/ /\\\ /'g)\\\"
++endif
++
+ BASE_CFLAGS += -DPRODUCT_VERSION=\\\"$(VERSION)\\\"
+ BASE_CFLAGS += -Wformat=2 -Wno-format-zero-length -Wformat-security -Wno-format-nonliteral
+ BASE_CFLAGS += -Wstrict-aliasing=2 -Wmissing-format-attribute
+diff --git a/code/game/g_main.c b/code/game/g_main.c
+index e3903bf..6d9d9fa 100644
+--- a/code/game/g_main.c
++++ b/code/game/g_main.c
+@@ -101,7 +101,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 },
+
+ // latched vars
+@@ -408,7 +408,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/common.c b/code/qcommon/common.c
+index 3f06c75..400e8a8 100644
+--- a/code/qcommon/common.c
++++ b/code/qcommon/common.c
+@@ -2637,7 +2637,7 @@ void Com_Init( char *commandLine ) {
+ char *s;
+ int qport;
+
+- Com_Printf( "%s %s %s\n", Q3_VERSION, PLATFORM_STRING, __DATE__ );
++ Com_Printf( "%s %s %s\n", Q3_VERSION, PLATFORM_STRING, PRODUCT_DATE );
+
+ if ( setjmp (abortframe) ) {
+ Sys_Error ("Error during initialization");
+@@ -2756,7 +2756,7 @@ void Com_Init( char *commandLine ) {
+
+ com_introPlayed = Cvar_Get( "com_introplayed", "0", CVAR_ARCHIVE);
+
+- s = va("%s %s %s", Q3_VERSION, PLATFORM_STRING, __DATE__ );
++ s = va("%s %s %s", Q3_VERSION, PLATFORM_STRING, PRODUCT_DATE );
+ com_version = Cvar_Get ("version", s, CVAR_ROM | CVAR_SERVERINFO );
+ com_gamename = Cvar_Get("com_gamename", GAMENAME_FOR_MASTER, CVAR_SERVERINFO | CVAR_INIT);
+ com_protocol = Cvar_Get("com_protocol", va("%i", PROTOCOL_VERSION), CVAR_SERVERINFO | CVAR_INIT);
+diff --git a/code/qcommon/q_shared.h b/code/qcommon/q_shared.h
+index 90996a2..15a0e13 100644
+--- a/code/qcommon/q_shared.h
++++ b/code/qcommon/q_shared.h
+@@ -62,6 +62,10 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ #define PRODUCT_VERSION "1.36"
+ #endif
+
++#ifndef PRODUCT_DATE
++# define PRODUCT_DATE __DATE__
++#endif
++
+ #define Q3_VERSION PRODUCT_NAME " " PRODUCT_VERSION
+
+ #define MAX_TEAMNAME 32
+diff --git a/code/sys/sys_main.c b/code/sys/sys_main.c
+index 60cdb50..fe68672 100644
+--- a/code/sys/sys_main.c
++++ b/code/sys/sys_main.c
+@@ -551,7 +551,7 @@ void Sys_ParseArgs( int argc, char **argv )
+ if( !strcmp( argv[1], "--version" ) ||
+ !strcmp( argv[1], "-v" ) )
+ {
+- const char* date = __DATE__;
++ const char* date = PRODUCT_DATE;
+ #ifdef DEDICATED
+ fprintf( stdout, Q3_VERSION " dedicated server (%s)\n", date );
+ #else
diff --git a/debian/patches/series b/debian/patches/series
index eda843e..dc13cdd 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -5,3 +5,4 @@ Run-in-a-window-by-default-on-new-installations.patch
Add-support-for-the-GNU-Hurd-architecture.patch
Don-t-crash-if-more-than-128-modes-are-available.patch
ui-reinstate-minimal-code-to-determine-whether-this-.patch
+Allow-__DATE__-to-be-avoided-for-reproducible-builds.patch
diff --git a/debian/rules b/debian/rules
index e1256bf..7549e6e 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,6 +1,14 @@
#!/usr/bin/make -f
#export DH_VERBOSE=1
+DEB_CPPFLAGS_MAINT_APPEND := \
+ -DWITH_OPENARENA \
+ $(NULL)
+
+DEB_CFLAGS_MAINT_APPEND := \
+ -fsigned-char \
+ $(NULL)
+
include /usr/share/dpkg/default.mk
Q3ARCH := $(shell $(CURDIR)/debian/q3arch arch HOST)
@@ -8,8 +16,7 @@ Q3PLATFORM := $(shell $(CURDIR)/debian/q3arch platform HOST)
Q3COMPILE_ARCH := $(shell $(CURDIR)/debian/q3arch arch BUILD)
Q3COMPILE_PLATFORM := $(shell $(CURDIR)/debian/q3arch platform BUILD)
distro := $(shell lsb_release -is)
-
-CFLAGS += -fsigned-char -DWITH_OPENARENA $(CPPFLAGS)
+PRODUCT_DATE := $(shell date --date="`dpkg-parsechangelog -SDate`" "+%b %_d %Y")
%:
dh $@ --parallel
@@ -42,7 +49,8 @@ OPTIONS := \
BUILD_GAME_SO=1 \
BUILD_GAME_QVM=0 \
VERSION=$(DEB_VERSION)/$(distro) \
- CFLAGS="$(CFLAGS)" \
+ PRODUCT_DATE='$(PRODUCT_DATE)' \
+ CFLAGS='$(CFLAGS) $(CPPFLAGS)' \
NO_STRIP=1 \
$(NULL)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/ioquake3.git
More information about the Pkg-games-commits
mailing list