]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
build: fix buildstring
authorbones_was_here <bones_was_here@xonotic.au>
Mon, 6 Nov 2023 11:17:10 +0000 (21:17 +1000)
committerbones_was_here <bones_was_here@xonotic.au>
Mon, 4 Dec 2023 08:08:05 +0000 (18:08 +1000)
The revision was always "-", there was code duplication and
inconsistency, the meaning of some strings was unclear.

Frees up some space in the `status` "version:" line by moving
gamenetworkfiltername to "protocol:" which seems like a more relevant
section anyway.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
builddate.c
cl_demo.c
host.c
makefile.inc
sv_ccmds.c
sv_main.c

index e38d9b18fc8655a3f6eb129290838aec07a39a86..7106dc9b669e41a19a90e92c539e150da6f6f1cd 100644 (file)
@@ -3,14 +3,15 @@
 
 extern const char *buildstring;
 const char *buildstring =
-#ifndef NO_BUILD_TIMESTAMPS
-__TIME__ " " __DATE__ " "
-#endif
-#ifdef SVNREVISION
-STRINGIFY(SVNREVISION)
+#ifdef VCREVISION
+STRINGIFY(VCREVISION)
 #else
 "-"
 #endif
+#ifndef NO_BUILD_TIMESTAMPS
+//" " __TIME__
+" " __DATE__
+#endif
 #ifdef BUILDTYPE
 " " STRINGIFY(BUILDTYPE)
 #endif
index b1f2e685716f0c1ff4b2a1bf4659c8194342899d..502a7fac4581fe0aa5ed7d9b51ecd3d1b5810651 100644 (file)
--- a/cl_demo.c
+++ b/cl_demo.c
@@ -509,7 +509,7 @@ static void CL_FinishTimeDemo (void)
        fpsmax = cls.td_onesecondmaxfps;
        // LadyHavoc: timedemo now prints out 7 digits of fraction, and min/avg/max
        Con_Printf("%i frames %5.7f seconds %5.7f fps, one-second fps min/avg/max: %.0f %.0f %.0f (%i seconds)\n", frames, time, totalfpsavg, fpsmin, fpsavg, fpsmax, cls.td_onesecondavgcount);
-       Log_Printf("benchmark.log", "date %s | enginedate %s | demo %s | commandline %s | run %d | result %i frames %5.7f seconds %5.7f fps, one-second fps min/avg/max: %.0f %.0f %.0f (%i seconds)\n", Sys_TimeString("%Y-%m-%d %H:%M:%S"), buildstring, cls.demoname, cmdline.string, benchmark_runs + 1, frames, time, totalfpsavg, fpsmin, fpsavg, fpsmax, cls.td_onesecondavgcount);
+       Log_Printf("benchmark.log", "date %s | enginedate %s | demo %s | commandline %s | run %d | result %i frames %5.7f seconds %5.7f fps, one-second fps min/avg/max: %.0f %.0f %.0f (%i seconds)\n", Sys_TimeString("%Y-%m-%d %H:%M:%S"), engineversion, cls.demoname, cmdline.string, benchmark_runs + 1, frames, time, totalfpsavg, fpsmin, fpsavg, fpsmax, cls.td_onesecondavgcount);
        if (Sys_CheckParm("-benchmark"))
        {
                ++benchmark_runs;
diff --git a/host.c b/host.c
index 5ecf7972fc6bd4bcc251f6497c8d392700a5aef3..924e655e200bb679da3afd9478df5ea69a21e3f2 100644 (file)
--- a/host.c
+++ b/host.c
@@ -156,7 +156,7 @@ static void Host_Quit_f(cmd_state_t *cmd)
 
 static void Host_Version_f(cmd_state_t *cmd)
 {
-       Con_Printf("Version: %s build %s\n", gamename, buildstring);
+       Con_Printf("Version: %s\n", engineversion);
 }
 
 static void Host_Framerate_c(cvar_t *var)
@@ -365,7 +365,6 @@ Host_Init
 static void Host_Init (void)
 {
        int i;
-       const char* os;
        char vabuf[1024];
 
        host.hook.ConnectLocal = NULL;
@@ -445,8 +444,7 @@ static void Host_Init (void)
        FS_Init();
 
        // construct a version string for the corner of the console
-       os = DP_OS_NAME;
-       dpsnprintf (engineversion, sizeof (engineversion), "%s %s %s", gamename, os, buildstring);
+       dpsnprintf (engineversion, sizeof (engineversion), "%s %s%s, buildstring: %s", gamename, DP_OS_NAME, cls.state == ca_dedicated ? " dedicated" : "", buildstring);
        Con_Printf("%s\n", engineversion);
 
        // initialize process nice level
index 90e2bf86aaca8a5e9853a262f3a182c0b45a2a69..ff2a68df9d94265e73560fc46e1155b77cfaba27 100644 (file)
@@ -209,9 +209,13 @@ DO_CC=$(CC) $(CFLAGS) -c $< -o $@
 
 
 # Link
-LDFLAGS_DEBUG=-g -ggdb $(OPTIM_DEBUG) -DSVNREVISION=`{ test -d .svn && svnversion; } || { test -d .git && git describe --always; } || echo -` -DBUILDTYPE=debug
-LDFLAGS_PROFILE=-g -pg -fprofile-arcs $(OPTIM_RELEASE) -DSVNREVISION=`{ test -d .svn && svnversion; } || { test -d .git && git describe --always; } || echo -` -DBUILDTYPE=profile
-LDFLAGS_RELEASE=$(OPTIM_RELEASE) -DSVNREVISION=`{ test -d .svn && svnversion; } || { test -d .git && git describe --always; } || echo -` -DBUILDTYPE=release
+
+# not checking for .git directory before running `git describe` because that would stop it working in a subdirectory
+VCREVISION=$(shell { test -d .svn && svnversion; } || git describe --always --dirty='~' 2>/dev/null || echo -)
+
+LDFLAGS_DEBUG=-g -ggdb $(OPTIM_DEBUG)                  -DVCREVISION=$(VCREVISION) -DBUILDTYPE=debug
+LDFLAGS_PROFILE=-g -pg -fprofile-arcs $(OPTIM_RELEASE) -DVCREVISION=$(VCREVISION) -DBUILDTYPE=profile
+LDFLAGS_RELEASE=$(OPTIM_RELEASE)                       -DVCREVISION=$(VCREVISION) -DBUILDTYPE=release
 
 
 ##### UNIX specific variables #####
index 036f4c63f1588cae58155a02479a9ec77f9ae1b7..a28b07893d7dc971511275c3d3d677627f8ba19b 100644 (file)
@@ -736,8 +736,9 @@ static void SV_Status_f(cmd_state_t *cmd)
        for (players = 0, i = 0;i < svs.maxclients;i++)
                if (svs.clients[i].active)
                        players++;
+
        print ("host:     %s\n", Cvar_VariableString (&cvars_all, "hostname", CF_SERVER));
-       print ("version:  %s build %s (gamename %s)\n", gamename, buildstring, gamenetworkfiltername);
+       print ("version:  %s\n", engineversion);
        print ("protocol: %i (%s)\n", Protocol_NumberForEnum(sv.protocol), Protocol_NameForEnum(sv.protocol));
        print ("map:      %s\n", sv.name);
        print ("timing:   %s\n", SV_TimingReport(vabuf, sizeof(vabuf)));
index c4168d2e5d41f0d264695d084a69311104fa1e33..0f4fb8fe8cd0ac638bcc00a0b3b1de0b5ca12f55 100644 (file)
--- a/sv_main.c
+++ b/sv_main.c
@@ -796,7 +796,7 @@ void SV_SendServerinfo (client_t *client)
 
        SZ_Clear (&client->netconnection->message);
        MSG_WriteByte (&client->netconnection->message, svc_print);
-       dpsnprintf (message, sizeof (message), "\nServer: %s build %s (progs %i crc)\n", gamename, buildstring, prog->filecrc);
+       dpsnprintf (message, sizeof (message), "\nServer: %s (progs %i crc)\n", engineversion, prog->filecrc);
        MSG_WriteString (&client->netconnection->message,message);
 
        SV_StopDemoRecording(client); // to split up demos into different files