mirror of
https://github.com/DrBeef/ioq3quest.git
synced 2025-02-18 10:01:28 +00:00
Pick up date from SOURCE_DATE_EPOCH, for reproducible builds
The goal of reproducible builds is that a rebuild of the same source code with the same compiler, libraries, etc. should result in the same binaries. SOURCE_DATE_EPOCH provides a standard way for build systems to fill in the date of the latest source change, typically from a git commit or from metadata like the debian/changelog in Debian packages. This does not change anything if SOURCE_DATE_EPOCH is not defined; the intention is that a larger build system like a Debian package will define it. Please see https://reproducible-builds.org/ for more information about reproducible builds.
This commit is contained in:
parent
8417c184b4
commit
9c76b546e3
5 changed files with 14 additions and 5 deletions
5
Makefile
5
Makefile
|
@ -1098,6 +1098,11 @@ else
|
||||||
STRIP_FLAG = -s
|
STRIP_FLAG = -s
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# https://reproducible-builds.org/specs/source-date-epoch/
|
||||||
|
ifdef SOURCE_DATE_EPOCH
|
||||||
|
BASE_CFLAGS += -DPRODUCT_DATE=\\\"$(shell date --date="@$$SOURCE_DATE_EPOCH" "+%b %_d %Y" | sed -e 's/ /\\\ /'g)\\\"
|
||||||
|
endif
|
||||||
|
|
||||||
BASE_CFLAGS += -DPRODUCT_VERSION=\\\"$(VERSION)\\\"
|
BASE_CFLAGS += -DPRODUCT_VERSION=\\\"$(VERSION)\\\"
|
||||||
BASE_CFLAGS += -Wformat=2 -Wno-format-zero-length -Wformat-security -Wno-format-nonliteral
|
BASE_CFLAGS += -Wformat=2 -Wno-format-zero-length -Wformat-security -Wno-format-nonliteral
|
||||||
BASE_CFLAGS += -Wstrict-aliasing=2 -Wmissing-format-attribute
|
BASE_CFLAGS += -Wstrict-aliasing=2 -Wmissing-format-attribute
|
||||||
|
|
|
@ -101,7 +101,7 @@ static cvarTable_t gameCvarTable[] = {
|
||||||
|
|
||||||
// noset vars
|
// noset vars
|
||||||
{ NULL, "gamename", GAMEVERSION , CVAR_SERVERINFO | CVAR_ROM, 0, qfalse },
|
{ 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 },
|
{ &g_restarted, "g_restarted", "0", CVAR_ROM, 0, qfalse },
|
||||||
|
|
||||||
// latched vars
|
// latched vars
|
||||||
|
@ -408,7 +408,7 @@ void G_InitGame( int levelTime, int randomSeed, int restart ) {
|
||||||
|
|
||||||
G_Printf ("------- Game Initialization -------\n");
|
G_Printf ("------- Game Initialization -------\n");
|
||||||
G_Printf ("gamename: %s\n", GAMEVERSION);
|
G_Printf ("gamename: %s\n", GAMEVERSION);
|
||||||
G_Printf ("gamedate: %s\n", __DATE__);
|
G_Printf ("gamedate: %s\n", PRODUCT_DATE);
|
||||||
|
|
||||||
srand( randomSeed );
|
srand( randomSeed );
|
||||||
|
|
||||||
|
|
|
@ -2639,7 +2639,7 @@ void Com_Init( char *commandLine ) {
|
||||||
char *s;
|
char *s;
|
||||||
int qport;
|
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) ) {
|
if ( setjmp (abortframe) ) {
|
||||||
Sys_Error ("Error during initialization");
|
Sys_Error ("Error during initialization");
|
||||||
|
@ -2760,7 +2760,7 @@ void Com_Init( char *commandLine ) {
|
||||||
com_introPlayed = Cvar_Get( "com_introplayed", "0", CVAR_ARCHIVE);
|
com_introPlayed = Cvar_Get( "com_introplayed", "0", CVAR_ARCHIVE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
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_version = Cvar_Get ("version", s, CVAR_ROM | CVAR_SERVERINFO );
|
||||||
com_gamename = Cvar_Get("com_gamename", GAMENAME_FOR_MASTER, CVAR_SERVERINFO | CVAR_INIT);
|
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);
|
com_protocol = Cvar_Get("com_protocol", va("%i", PROTOCOL_VERSION), CVAR_SERVERINFO | CVAR_INIT);
|
||||||
|
|
|
@ -70,6 +70,10 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
#define PRODUCT_VERSION "1.36"
|
#define PRODUCT_VERSION "1.36"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef PRODUCT_DATE
|
||||||
|
# define PRODUCT_DATE __DATE__
|
||||||
|
#endif
|
||||||
|
|
||||||
#define Q3_VERSION PRODUCT_NAME " " PRODUCT_VERSION
|
#define Q3_VERSION PRODUCT_NAME " " PRODUCT_VERSION
|
||||||
|
|
||||||
#define MAX_TEAMNAME 32
|
#define MAX_TEAMNAME 32
|
||||||
|
|
|
@ -553,7 +553,7 @@ void Sys_ParseArgs( int argc, char **argv )
|
||||||
if( !strcmp( argv[1], "--version" ) ||
|
if( !strcmp( argv[1], "--version" ) ||
|
||||||
!strcmp( argv[1], "-v" ) )
|
!strcmp( argv[1], "-v" ) )
|
||||||
{
|
{
|
||||||
const char* date = __DATE__;
|
const char* date = PRODUCT_DATE;
|
||||||
#ifdef DEDICATED
|
#ifdef DEDICATED
|
||||||
fprintf( stdout, Q3_VERSION " dedicated server (%s)\n", date );
|
fprintf( stdout, Q3_VERSION " dedicated server (%s)\n", date );
|
||||||
#else
|
#else
|
||||||
|
|
Loading…
Reference in a new issue