Merge pull request #142 from smcv/source-date-epoch

Override __DATE__ from SOURCE_DATE_EPOCH if set
This commit is contained in:
Yamagi 2016-07-05 18:50:31 +02:00 committed by GitHub
commit 0da70104e2
4 changed files with 14 additions and 3 deletions

View file

@ -165,6 +165,13 @@ CFLAGS += -DOSTYPE=\"$(OSTYPE)\" -DARCH=\"$(ARCH)\"
# ---------- # ----------
# 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
# ----------
# Systemwide installation # Systemwide installation
ifeq ($(WITH_SYSTEMWIDE),yes) ifeq ($(WITH_SYSTEMWIDE),yes)
CFLAGS += -DSYSTEMWIDE CFLAGS += -DSYSTEMWIDE

View file

@ -44,6 +44,10 @@
#error ARCH should be defined by the build system #error ARCH should be defined by the build system
#endif #endif
#ifndef BUILD_DATE
#define BUILD_DATE __DATE__
#endif
#ifdef _WIN32 #ifdef _WIN32
#define CFGDIR "YamagiQ2" #define CFGDIR "YamagiQ2"
#else #else

View file

@ -241,7 +241,7 @@ Qcommon_Init(int argc, char **argv)
dedicated = Cvar_Get("dedicated", "0", CVAR_NOSET); dedicated = Cvar_Get("dedicated", "0", CVAR_NOSET);
#endif #endif
s = va("%s %s %s %s", YQ2VERSION, ARCH, __DATE__, OSTYPE); s = va("%s %s %s %s", YQ2VERSION, ARCH, BUILD_DATE, OSTYPE);
Cvar_Get("version", s, CVAR_SERVERINFO | CVAR_NOSET); Cvar_Get("version", s, CVAR_SERVERINFO | CVAR_NOSET);
if (dedicated->value) if (dedicated->value)

View file

@ -207,7 +207,7 @@ void
InitGame(void) InitGame(void)
{ {
gi.dprintf("Game is starting up.\n"); gi.dprintf("Game is starting up.\n");
gi.dprintf("Game is %s built on %s.\n", GAMEVERSION, __DATE__); gi.dprintf("Game is %s built on %s.\n", GAMEVERSION, BUILD_DATE);
gun_x = gi.cvar("gun_x", "0", 0); gun_x = gi.cvar("gun_x", "0", 0);
gun_y = gi.cvar("gun_y", "0", 0); gun_y = gi.cvar("gun_y", "0", 0);
@ -223,7 +223,7 @@ InitGame(void)
/* latched vars */ /* latched vars */
sv_cheats = gi.cvar("cheats", "0", CVAR_SERVERINFO | CVAR_LATCH); sv_cheats = gi.cvar("cheats", "0", CVAR_SERVERINFO | CVAR_LATCH);
gi.cvar("gamename", GAMEVERSION, 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); maxclients = gi.cvar("maxclients", "4", CVAR_SERVERINFO | CVAR_LATCH);
maxspectators = gi.cvar("maxspectators", "4", CVAR_SERVERINFO); maxspectators = gi.cvar("maxspectators", "4", CVAR_SERVERINFO);
deathmatch = gi.cvar("deathmatch", "0", CVAR_LATCH); deathmatch = gi.cvar("deathmatch", "0", CVAR_LATCH);