Debian Codegraph @

debian/patches/Pick-up-date-from-SOURCE_DATE_EPOCH-for-reproducible-buil.patch

raw
1 From: Simon McVittie <[email protected]>
2 Date: Thu, 2 Apr 2015 11:10:26 +0100
3 Subject: Pick up date from SOURCE_DATE_EPOCH, for reproducible builds
4
5 The goal of reproducible builds is that a rebuild of the same source
6 code with the same compiler, libraries, etc. should result in the same
7 binaries. SOURCE_DATE_EPOCH provides a standard way for build systems
8 to fill in the date of the latest source change, typically from a git
9 commit or from metadata like the debian/changelog in Debian packages.
10
11 Forwarded: https://github.com/OpenArena/gamecode/pull/18
12 Applied-upstream: https://github.com/OpenArena/gamecode/commit/3150715fd76beeaf0e9fc54c2d5d5df0a40ebce2
13 ---
14 Makefile | 5 +++++
15 code/game/g_main.c | 4 ++--
16 code/qcommon/q_shared.h | 4 ++++
17 3 files changed, 11 insertions(+), 2 deletions(-)
18
19 diff --git a/Makefile b/Makefile
20 index 6eeba4f..4f9a310 100644
21 --- a/Makefile
22 +++ b/Makefile
23 @@ -840,6 +840,11 @@ else
24 DEPEND_CFLAGS =
25 endif
26
27 +# https://reproducible-builds.org/specs/source-date-epoch/
28 +ifdef SOURCE_DATE_EPOCH
29 + BASE_CFLAGS += -DPRODUCT_DATE=\\\"$(shell date --date="@$$SOURCE_DATE_EPOCH" "+%b %_d %Y" | sed -e 's/ /\\\ /'g)\\\"
30 +endif
31 +
32 BASE_CFLAGS += -DPRODUCT_VERSION=\\\"$(VERSION)\\\"
33
34 ifeq ($(V),1)
35 diff --git a/code/game/g_main.c b/code/game/g_main.c
36 index 48baac7..426973e 100644
37 --- a/code/game/g_main.c
38 +++ b/code/game/g_main.c
39 @@ -204,7 +204,7 @@ static cvarTable_t gameCvarTable[] = {
40
41 // noset vars
42 { NULL, "gamename", GAMEVERSION , CVAR_SERVERINFO | CVAR_ROM, 0, qfalse },
43 - { NULL, "gamedate", __DATE__ , CVAR_ROM, 0, qfalse },
44 + { NULL, "gamedate", PRODUCT_DATE , CVAR_ROM, 0, qfalse },
45 { &g_restarted, "g_restarted", "0", CVAR_ROM, 0, qfalse },
46 { NULL, "sv_mapname", "", CVAR_SERVERINFO | CVAR_ROM, 0, qfalse },
47
48 @@ -693,7 +693,7 @@ void G_InitGame( int levelTime, int randomSeed, int restart ) {
49
50 G_Printf ("------- Game Initialization -------\n");
51 G_Printf ("gamename: %s\n", GAMEVERSION);
52 - G_Printf ("gamedate: %s\n", __DATE__);
53 + G_Printf ("gamedate: %s\n", PRODUCT_DATE);
54
55 srand( randomSeed );
56
57 diff --git a/code/qcommon/q_shared.h b/code/qcommon/q_shared.h
58 index f8b1365..56e2ab8 100644
59 --- a/code/qcommon/q_shared.h
60 +++ b/code/qcommon/q_shared.h
61 @@ -42,6 +42,10 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
62 #define PRODUCT_VERSION "1.35"
63 #endif
64
65 +#ifndef PRODUCT_DATE
66 +# define PRODUCT_DATE __DATE__
67 +#endif
68 +
69 #define Q3_VERSION PRODUCT_NAME " " PRODUCT_VERSION
70
71 #define MAX_TEAMNAME 32