Skip to content

Commit

Permalink
normalise references to versions everywhere. use git tag instead of j…
Browse files Browse the repository at this point in the history
…ust the hash
  • Loading branch information
Razish committed Oct 4, 2023
1 parent 14d3b21 commit c1de4aa
Show file tree
Hide file tree
Showing 35 changed files with 75 additions and 315 deletions.
27 changes: 14 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
#============================================================================
# Copyright (C) 2013 - 2018, OpenJK contributors
#
#
# This file is part of the OpenJK source code.
#
#
# OpenJK is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
#============================================================================
Expand Down Expand Up @@ -246,7 +246,7 @@ elseif (("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU") OR ("${CMAKE_C_COMPILER_ID}" M

# enable somewhat modern C++
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

if("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-comment")
Expand Down Expand Up @@ -320,17 +320,18 @@ else()
message(STATUS "SOURCE_DATE_EPOCH is set ($ENV{SOURCE_DATE_EPOCH}): SOURCE_DATE set to \"${SOURCE_DATE}\"")
endif()

# Current Git SHA1 hash
# Current Git tag/version
# ideally we would separate the hash suffix into its own variable, but sed is not available everywhere
execute_process(
COMMAND "git" "rev-parse" "--short" "HEAD"
OUTPUT_VARIABLE GIT_HASH
RESULT_VARIABLE GIT_HASH_ERROR
COMMAND "git" "describe" "--tag"
OUTPUT_VARIABLE GIT_TAG
RESULT_VARIABLE GIT_TAG_ERROR
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(GIT_HASH_ERROR AND NOT GIT_HASH_ERROR EQUAL 0)
message(WARNING "Unable to determine Git revision")
set(GIT_HASH UNKNOWN)
if(GIT_TAG_ERROR AND NOT GIT_TAG_ERROR EQUAL 0)
message(WARNING "Unable to determine Git tag")
set(GIT_TAG vUNKNOWN)
endif()
message(STATUS "Git revision is ${GIT_HASH}")
message(STATUS "Git tag is ${GIT_TAG}")

configure_file(shared/qcommon/q_version.h.in shared/qcommon/q_version.h @ONLY)

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ If you have the Mac App Store Version of Jedi Academy, follow these steps to get
### Using OpenJK as a base for a new mod

* [Fork](https://github.com/JACoders/OpenJK/fork) the project on GitHub
* Change the GAMEVERSION define in codemp/game/g_local.h from "OpenJK" to your project name
* Change the JK_VERSION define in codemp/qcommon/game_version.h from "OpenJK" to your project name
* If you make a nice change, please consider back-porting to upstream via pull request as described above. This is so everyone benefits without having to reinvent the wheel for every project.


Expand Down
4 changes: 2 additions & 2 deletions code/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ if(BuildSPEngine OR BuildJK2SPEngine)
"${SPDir}/qcommon/z_memman_pc.cpp"
"${SPDir}/qcommon/qfiles.h"
"${SPDir}/qcommon/qcommon.h"
"${SPDir}/qcommon/stv_version.h"
"${SPDir}/qcommon/game_version.h"
"${SPDir}/qcommon/timing.h"
"${SPDir}/qcommon/MiniHeap.h"

Expand All @@ -190,7 +190,7 @@ if(BuildSPEngine OR BuildJK2SPEngine)
)
source_group("common" FILES ${SPEngineCommonFiles})
set(SPEngineFiles ${SPEngineFiles} ${SPEngineCommonFiles})

set(SPEngineCommonSafeFiles
"${SharedDir}/qcommon/safe/files.cpp"
"${SharedDir}/qcommon/safe/files.h"
Expand Down
11 changes: 1 addition & 10 deletions code/client/cl_console.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.

#include "client.h"
#include "qcommon/stringed_ingame.h"
#include "qcommon/stv_version.h"
#include "qcommon/q_version.h"
#include "qcommon/game_version.h"

int g_console_field_width = 78;

Expand Down Expand Up @@ -575,14 +574,6 @@ void Con_DrawSolidConsole( float frac )
(lines-(SMALLCHAR_HEIGHT+SMALLCHAR_HEIGHT/2)), JK_VERSION[x] );
}

const char *revision = "revision: " GIT_HASH;
i = strlen(revision);

for (x = 0; x < i; x++) {
SCR_DrawSmallChar( cls.glconfig.vidWidth - (i - x + 1) * SMALLCHAR_WIDTH,
(lines - (SMALLCHAR_HEIGHT * 2 + SMALLCHAR_HEIGHT / 2)), revision[x] );
}

// draw the text
con.vislines = lines;
rows = (lines-SMALLCHAR_WIDTH)/SMALLCHAR_WIDTH; // rows of text to draw
Expand Down
3 changes: 0 additions & 3 deletions code/game/g_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.

//==================================================================

// the "gameversion" client command will print this plus compile date
#define GAMEVERSION "OpenJK-" GIT_HASH

#define BODY_QUEUE_SIZE 8

#define Q3_INFINITE 16777216
Expand Down
6 changes: 3 additions & 3 deletions code/game/g_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
//rww - RAGDOLL_END

#include "qcommon/ojk_saved_game_helper.h"
#include "qcommon/q_version.h"
#include "qcommon/game_version.h"

extern void WP_SaberLoadParms( void );
extern qboolean G_PlayerSpawned( void );
Expand Down Expand Up @@ -617,7 +617,7 @@ void G_InitCvars( void ) {
g_developer = gi.cvar ("developer", "", 0);

// noset vars
gi.cvar( "gamename", GAMEVERSION , CVAR_SERVERINFO | CVAR_ROM );
gi.cvar( "gamename", JK_VERSION , CVAR_SERVERINFO | CVAR_ROM );
gi.cvar( "gamedate", SOURCE_DATE , CVAR_ROM );
g_skippingcin = gi.cvar ("skippingCinematic", "0", CVAR_ROM);

Expand Down Expand Up @@ -734,7 +734,7 @@ void InitGame( const char *mapname, const char *spawntarget, int checkSum, cons
g_qbLoadTransition = qbLoadTransition;

gi.Printf ("------- Game Initialization -------\n");
gi.Printf ("gamename: %s\n", GAMEVERSION);
gi.Printf ("gamename: %s\n", JK_VERSION);
gi.Printf ("gamedate: %s\n", SOURCE_DATE);

srand( randomSeed );
Expand Down
8 changes: 2 additions & 6 deletions code/qcommon/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,9 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.

#include "q_shared.h"
#include "qcommon.h"
#include "qcommon/q_version.h"
#include "sstring.h" // to get Gil's string class, because MS's doesn't compile properly in here
#include "stringed_ingame.h"
#include "stv_version.h"
#include "game_version.h"
#include "../shared/sys/sys_local.h"
#if defined(_WIN32)
#define WIN32_LEAN_AND_MEAN
Expand All @@ -55,7 +54,6 @@ cvar_t *com_cl_running;
cvar_t *com_logfile; // 1 = buffer log, 2 = flush after each print
cvar_t *com_showtrace;
cvar_t *com_version;
cvar_t *com_revision;
cvar_t *com_buildScript; // for automated data building scripts
cvar_t *com_bootlogo;
cvar_t *cl_paused;
Expand Down Expand Up @@ -1128,9 +1126,7 @@ void Com_Init( char *commandLine ) {
Cmd_AddCommand ("freeze", Com_Freeze_f);
}

s = va("%s %s %s", JK_VERSION, PLATFORM_STRING, SOURCE_DATE );
com_version = Cvar_Get ("version", s, CVAR_ROM | CVAR_SERVERINFO );
com_revision = Cvar_Get ("revision", GIT_HASH, CVAR_ROM | CVAR_SERVERINFO );
com_version = Cvar_Get ("version", JK_VERSION " " PLATFORM_STRING " " SOURCE_DATE, CVAR_ROM | CVAR_SERVERINFO );

#ifdef JK2_MODE
JK2SP_Init();
Expand Down
23 changes: 14 additions & 9 deletions code/qcommon/stv_version.h → code/qcommon/game_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,21 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
===========================================================================
*/

#include "qcommon/q_version.h"

// Current version of the single player game
#include "../win32/AutoVersion.h"
#define VERSION_MAJOR_RELEASE 1
#define VERSION_MINOR_RELEASE 0
#define VERSION_EXTERNAL_BUILD 1
#define VERSION_INTERNAL_BUILD 1

#define VERSION_STRING XSTRING(VERSION_MAJOR_RELEASE) ", " XSTRING(VERSION_MINOR_RELEASE) ", " XSTRING(VERSION_EXTERNAL_BUILD) ", " XSTRING(VERSION_INTERNAL_BUILD) // "a, b, c, d"
#define VERSION_STRING_DOTTED XSTRING(VERSION_MAJOR_RELEASE) "." XSTRING(VERSION_MINOR_RELEASE) "." XSTRING(VERSION_EXTERNAL_BUILD) "." XSTRING(VERSION_INTERNAL_BUILD) // "a.b.c.d"

#ifdef _DEBUG
#define JK_VERSION "(debug)OpenJK: v" VERSION_STRING_DOTTED
#elif defined FINAL_BUILD
#define JK_VERSION "OpenJK: v" VERSION_STRING_DOTTED
#if defined(_DEBUG)
#define JK_VERSION "(debug)OpenJK: " GIT_TAG
#define JK_VERSION_OLD "(debug)JA: v" VERSION_STRING_DOTTED
#else
#define JK_VERSION "(internal)OpenJK: v" VERSION_STRING_DOTTED
#define JK_VERSION "OpenJK: " GIT_TAG
#define JK_VERSION_OLD "JA: v" VERSION_STRING_DOTTED
#endif
// end


1 change: 0 additions & 1 deletion code/qcommon/qcommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,6 @@ extern cvar_t *com_timescale;
extern cvar_t *com_sv_running;
extern cvar_t *com_cl_running;
extern cvar_t *com_version;
extern cvar_t *com_revision;
extern cvar_t *com_homepath;
#ifndef _WIN32
extern cvar_t *com_ansiColor;
Expand Down
6 changes: 2 additions & 4 deletions code/server/sv_ccmds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
#include "../game/weapons.h"
#include "../game/g_items.h"
#include "../game/statindex.h"

#include "../win32/AutoVersion.h"

#include "../qcommon/game_version.h"

/*
===============================================================================
Expand Down Expand Up @@ -386,7 +384,7 @@ static void SV_Status_f( void ) {

Com_Printf( "name : %s^7\n", cl->name );
Com_Printf( "score : %i\n", cl->gentity->client->persistant[PERS_SCORE] );
Com_Printf( "version : %s %s %i\n", STATUS_OS, VERSION_STRING_DOTTED, PROTOCOL_VERSION );
Com_Printf( "version : %s %s %i\n", STATUS_OS, JK_VERSION, PROTOCOL_VERSION );
#ifdef JK2_MODE
Com_Printf( "game : Jedi Outcast %s\n", FS_GetCurrentGameDir() );
#else
Expand Down
2 changes: 1 addition & 1 deletion code/server/sv_init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ void SV_SpawnServer( const char *server, ForceReload_e eForceReload, qboolean bA
// shut down the existing game if it is running
SV_ShutdownGameProgs(qtrue);

Com_Printf ("------ Server Initialization ------\n%s\nrevision: %s\n", com_version->string, com_revision->string);
Com_Printf ("------ Server Initialization ------\n%s\n", com_version->string);
Com_Printf ("Server: %s\n",server);

// Moved up from below to help reduce fragmentation
Expand Down
1 change: 0 additions & 1 deletion code/ui/ui_atoms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.

#include "ui_local.h"
#include "gameinfo.h"
#include "../qcommon/stv_version.h"

uiimport_t ui;
uiStatic_t uis;
Expand Down
2 changes: 1 addition & 1 deletion code/ui/ui_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ USER INTERFACE MAIN
extern stringID_table_t animTable [MAX_ANIMATIONS+1];

#include "../qcommon/stringed_ingame.h"
#include "../qcommon/stv_version.h"
#include "../qcommon/q_shared.h"
#include "../qcommon/game_version.h"

extern qboolean ItemParse_model_g2anim_go( itemDef_t *item, const char *animName );
extern qboolean ItemParse_asset_model_go( itemDef_t *item, const char *name );
Expand Down
102 changes: 0 additions & 102 deletions code/win32/AutoVersion.h

This file was deleted.

8 changes: 4 additions & 4 deletions code/win32/game.rc
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,18 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
// TEXTINCLUDE
//

1 TEXTINCLUDE
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END

2 TEXTINCLUDE
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END

3 TEXTINCLUDE
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
Expand All @@ -51,7 +51,7 @@ END
//
// Version
//
#include "AutoVersion.h"
#include "../qcommon/game_version.h"

VS_VERSION_INFO VERSIONINFO
FILEVERSION VERSION_MAJOR_RELEASE,VERSION_MINOR_RELEASE,VERSION_EXTERNAL_BUILD,VERSION_INTERNAL_BUILD
Expand Down
Loading

0 comments on commit c1de4aa

Please sign in to comment.