mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-22 20:11:44 +00:00
Let FTE know about git revision info, for people that refuse to use svn...
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5844 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
440a8e7b53
commit
c3038db058
3 changed files with 102 additions and 46 deletions
|
@ -17,29 +17,53 @@ INCLUDE_DIRECTORIES(
|
||||||
engine
|
engine
|
||||||
)
|
)
|
||||||
|
|
||||||
EXECUTE_PROCESS(COMMAND
|
IF (EXISTS ${CMAKE_SOURCE_DIR}/.svn)
|
||||||
"svnversion"
|
EXECUTE_PROCESS(COMMAND
|
||||||
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
"svnversion"
|
||||||
OUTPUT_VARIABLE FTE_REVISON
|
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
||||||
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE
|
OUTPUT_VARIABLE FTE_REVISON
|
||||||
)
|
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
|
)
|
||||||
|
|
||||||
IF (NOT "${FTE_REVISON}" STREQUAL "")
|
IF (NOT "${FTE_REVISON}" STREQUAL "")
|
||||||
MESSAGE(STATUS "FTE SVN Revision ${FTE_REVISON}")
|
MESSAGE(STATUS "FTE SVN Revision ${FTE_REVISON}")
|
||||||
IF(FTE_REVISON MATCHES "M")
|
IF(FTE_REVISON MATCHES "M")
|
||||||
MESSAGE(STATUS "--- PRIVATE CHANGES DETECTED ---")
|
MESSAGE(STATUS "--- PRIVATE CHANGES DETECTED ---")
|
||||||
SET(FTE_REVISON SVNREVISION=${FTE_REVISON})
|
SET(FTE_REVISON SVNREVISION=${FTE_REVISON})
|
||||||
ELSE()
|
ELSE()
|
||||||
MESSAGE(STATUS "No local changes")
|
MESSAGE(STATUS "No local changes")
|
||||||
EXECUTE_PROCESS(COMMAND
|
EXECUTE_PROCESS(COMMAND
|
||||||
svn info --show-item last-changed-date --no-newline
|
svn info --show-item last-changed-date --no-newline
|
||||||
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
||||||
OUTPUT_VARIABLE FTE_DATE
|
OUTPUT_VARIABLE FTE_DATE
|
||||||
)
|
)
|
||||||
|
|
||||||
SET(FTE_REVISON SVNREVISION=${FTE_REVISON} SVNDATE="${FTE_DATE}")
|
SET(FTE_REVISON SVNREVISION=${FTE_REVISON} SVNDATE=${FTE_DATE})
|
||||||
|
ENDIF()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
IF (EXISTS ${CMAKE_SOURCE_DIR}/.git)
|
||||||
|
EXECUTE_PROCESS(COMMAND
|
||||||
|
git describe --always --long --dirty
|
||||||
|
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
||||||
|
OUTPUT_VARIABLE FTE_REVISON_GIT
|
||||||
|
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
|
)
|
||||||
|
EXECUTE_PROCESS(COMMAND
|
||||||
|
git log -1 --format=%cs
|
||||||
|
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
||||||
|
OUTPUT_VARIABLE FTE_DATE
|
||||||
|
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
|
)
|
||||||
|
EXECUTE_PROCESS(COMMAND
|
||||||
|
git branch --show-current
|
||||||
|
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
||||||
|
OUTPUT_VARIABLE FTE_BRANCH
|
||||||
|
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
|
)
|
||||||
|
MESSAGE(STATUS "FTE GIT ${FTE_BRANCH} Revision git-${FTE_REVISON_GIT}, ${FTE_DATE}")
|
||||||
|
SET(FTE_REVISON SVNREVISION=git-${FTE_REVISON_GIT} SVNDATE=${FTE_DATE} FTE_BRANCH=${FTE_BRANCH})
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
#plugins need visibility hidden in order to avoid conflicts with function names that match the engine.
|
#plugins need visibility hidden in order to avoid conflicts with function names that match the engine.
|
||||||
#this is consistent with how windows works so no great loss.
|
#this is consistent with how windows works so no great loss.
|
||||||
|
|
|
@ -1,3 +1,28 @@
|
||||||
|
#FTEQW Makefile
|
||||||
|
|
||||||
|
#make m-rel plugins-rel sv-rel [FTE_TARGET=$ARCH]
|
||||||
|
|
||||||
|
#only limited forms of cross-making is supported
|
||||||
|
#only the following 3 are supported
|
||||||
|
#linux->win32 (FTE_TARGET=win32) RPM Package: "mingw32-gcc", DEB Package: "mingw32"
|
||||||
|
#linux->win64 (FTE_TARGET=win64) RPM Package: "mingw32-gcc", DEB Package: "mingw32"
|
||||||
|
#linux->linux 32 (FTE_TARGET=linux32)
|
||||||
|
#linux->linux 64 (FTE_TARGET=linux64)
|
||||||
|
#linux->linux x32 (FTE_TARGET=linux_x32)
|
||||||
|
#linux->linux armhf (FTE_TARGET=linux_armhf)
|
||||||
|
#linux->linux arm64/aarch64 (FTE_TARGET=linux_arm64)
|
||||||
|
#linux->linux *others* (FTE_TARGET=linux CC=other-gcc)
|
||||||
|
#linux->morphos (FTE_TARGET=morphos)
|
||||||
|
#linux->macosx (FTE_TARGET=macosx) or (FTE_TARGET=macosx_x86)
|
||||||
|
#linux->javascript (FTE_TARGET=web)
|
||||||
|
#linux->nacl (FTE_TARGET=nacl NARCH=x86_64) deprecated.
|
||||||
|
#win32->nacl
|
||||||
|
#linux->droid (make droid)
|
||||||
|
#win32->droid (make droid)
|
||||||
|
#if you are cross compiling, you'll need to use FTE_TARGET=mytarget
|
||||||
|
#note: cross compiling will typically require 'make makelibs FTE_TARGET=mytarget', which avoids installing lots of extra system packages.
|
||||||
|
|
||||||
|
#
|
||||||
CC=gcc
|
CC=gcc
|
||||||
WINDRES=windres
|
WINDRES=windres
|
||||||
STRIP?=strip
|
STRIP?=strip
|
||||||
|
@ -19,13 +44,23 @@ else
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(SVNREVISION),)
|
ifeq ($(SVNREVISION),)
|
||||||
|
#try subversion firstly...
|
||||||
SVN_VERSION:=$(shell test -d $(BASE_DIR)/../.svn && svnversion $(BASE_DIR))
|
SVN_VERSION:=$(shell test -d $(BASE_DIR)/../.svn && svnversion $(BASE_DIR))
|
||||||
SVN_DATE:=$(shell test -d $(BASE_DIR)/../.svn && cd $(BASE_DIR) && svn info --show-item last-changed-date --no-newline)
|
SVN_DATE:=$(shell test -d $(BASE_DIR)/../.svn && cd $(BASE_DIR) && svn info --show-item last-changed-date --no-newline)
|
||||||
|
ifeq (,$(SVN_VERSION))
|
||||||
|
#try to get git version info instead.
|
||||||
|
SVN_VERSION:=$(shell test -d $(BASE_DIR)/../.git && cd $(BASE_DIR) && git describe --long --always --dirty)
|
||||||
|
SVN_DATE:=$(shell test -d $(BASE_DIR)/../.git && git log -1 --format=%cs $(BASE_DIR))
|
||||||
|
ifneq (,$(SVN_VERSION))
|
||||||
|
#make sure its prefixed with something specific. we use versions for versioning, which will confuse the update mechanism if they're inconsistent - like random hashses that have no implied ordering...
|
||||||
|
SVN_VERSION:=git-$(SVN_VERSION)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
SVNREVISION=
|
SVNREVISION=
|
||||||
ifneq (,$(SVN_VERSION))
|
ifneq (,$(SVN_VERSION))
|
||||||
SVNREVISION+=-DSVNREVISION=$(SVN_VERSION)
|
SVNREVISION+=-DSVNREVISION=$(SVN_VERSION)
|
||||||
endif
|
endif
|
||||||
ifneq (M,$(findstring M,$(SVN_VERSION)))
|
ifneq (M,$(findstring M,$(SVN_VERSION)))
|
||||||
SVNREVISION+=-DSVNDATE=$(SVN_DATE)
|
SVNREVISION+=-DSVNDATE=$(SVN_DATE)
|
||||||
endif
|
endif
|
||||||
|
@ -49,26 +84,6 @@ SPEEXDSPVER=1.2.0
|
||||||
FREETYPEVER=2.10.1
|
FREETYPEVER=2.10.1
|
||||||
BULLETVER=2.87
|
BULLETVER=2.87
|
||||||
|
|
||||||
#only limited forms of cross-making is supported
|
|
||||||
#only the following 3 are supported
|
|
||||||
#linux->win32 (FTE_TARGET=win32) RPM Package: "mingw32-gcc", DEB Package: "mingw32"
|
|
||||||
#linux->win64 (FTE_TARGET=win64) RPM Package: "mingw32-gcc", DEB Package: "mingw32"
|
|
||||||
#linux->linux 32 (FTE_TARGET=linux32)
|
|
||||||
#linux->linux 64 (FTE_TARGET=linux64)
|
|
||||||
#linux->linux x32 (FTE_TARGET=linux_x32)
|
|
||||||
#linux->linux armhf (FTE_TARGET=linux_armhf)
|
|
||||||
#linux->linux arm64/aarch64 (FTE_TARGET=linux_arm64)
|
|
||||||
#linux->linux *others* (FTE_TARGET=linux CC=other-gcc)
|
|
||||||
#linux->morphos (FTE_TARGET=morphos)
|
|
||||||
#linux->macosx (FTE_TARGET=macosx) or (FTE_TARGET=macosx_x86)
|
|
||||||
#linux->javascript (FTE_TARGET=web)
|
|
||||||
#linux->nacl (FTE_TARGET=nacl NARCH=x86_64) deprecated.
|
|
||||||
#win32->nacl
|
|
||||||
#linux->droid (make droid)
|
|
||||||
#win32->droid (make droid)
|
|
||||||
#if you are cross compiling, you'll need to use FTE_TARGET=mytarget
|
|
||||||
#note: cross compiling will typically require 'make makelibs FTE_TARGET=mytarget', which avoids installing lots of extra system packages.
|
|
||||||
|
|
||||||
#cygwin's make's paths confuses non-cygwin things
|
#cygwin's make's paths confuses non-cygwin things
|
||||||
RELEASE_DIR=$(BASE_DIR)/release
|
RELEASE_DIR=$(BASE_DIR)/release
|
||||||
DEBUG_DIR=$(BASE_DIR)/debug
|
DEBUG_DIR=$(BASE_DIR)/debug
|
||||||
|
@ -2431,3 +2446,7 @@ install: sv-rel gl-rel mingl-rel qcc-rel
|
||||||
$(INSTALL_PROGRAM) $(RELEASE_DIR)/$(EXE_NAME)-sv $(DESTDIR)$(bindir)/$(EXE_NAME)-sv
|
$(INSTALL_PROGRAM) $(RELEASE_DIR)/$(EXE_NAME)-sv $(DESTDIR)$(bindir)/$(EXE_NAME)-sv
|
||||||
$(INSTALL_PROGRAM) $(RELEASE_DIR)/fteqcc $(DESTDIR)$(bindir)/fteqcc
|
$(INSTALL_PROGRAM) $(RELEASE_DIR)/fteqcc $(DESTDIR)$(bindir)/fteqcc
|
||||||
|
|
||||||
|
version:
|
||||||
|
@echo $(SVN_VERSION)
|
||||||
|
@echo $(SVN_DATE)
|
||||||
|
|
||||||
|
|
|
@ -5196,12 +5196,20 @@ static void COM_Version_f (void)
|
||||||
Con_Printf("^4"ENGINEWEBSITE"\n");
|
Con_Printf("^4"ENGINEWEBSITE"\n");
|
||||||
Con_Printf("%s\n", version_string());
|
Con_Printf("%s\n", version_string());
|
||||||
|
|
||||||
|
#ifdef FTE_BRANCH
|
||||||
|
Con_Printf("Branch: "STRINGIFY(FTE_BRANCH)"\n");
|
||||||
|
#endif
|
||||||
#if defined(SVNREVISION) && defined(SVNDATE)
|
#if defined(SVNREVISION) && defined(SVNDATE)
|
||||||
Con_Printf("SVN Revision: %s - %s\n",STRINGIFY(SVNREVISION), STRINGIFY(SVNDATE));
|
if (!strncmp(STRINGIFY(SVNREVISION), "git-", 4))
|
||||||
|
Con_Printf("GIT Revision: %s - %s\n",STRINGIFY(SVNREVISION), STRINGIFY(SVNDATE));
|
||||||
|
else
|
||||||
|
Con_Printf("SVN Revision: %s - %s\n",STRINGIFY(SVNREVISION), STRINGIFY(SVNDATE));
|
||||||
#else
|
#else
|
||||||
Con_TPrintf ("Exe: %s %s\n", __DATE__, __TIME__);
|
Con_TPrintf ("Exe: %s %s\n", __DATE__, __TIME__);
|
||||||
#ifdef SVNREVISION
|
#ifdef SVNREVISION
|
||||||
if (strcmp(STRINGIFY(SVNREVISION), "-"))
|
if (!strncmp(STRINGIFY(SVNREVISION), "git-", 4))
|
||||||
|
Con_Printf("GIT Revision: %s\n",STRINGIFY(SVNREVISION));
|
||||||
|
else if (strcmp(STRINGIFY(SVNREVISION), "-"))
|
||||||
Con_Printf("SVN Revision: %s\n",STRINGIFY(SVNREVISION));
|
Con_Printf("SVN Revision: %s\n",STRINGIFY(SVNREVISION));
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
@ -8078,10 +8086,15 @@ char *version_string(void)
|
||||||
#ifdef OFFICIAL_RELEASE
|
#ifdef OFFICIAL_RELEASE
|
||||||
Q_snprintfz(s, sizeof(s), "%s v%i.%02i", DISTRIBUTION, FTE_VER_MAJOR, FTE_VER_MINOR);
|
Q_snprintfz(s, sizeof(s), "%s v%i.%02i", DISTRIBUTION, FTE_VER_MAJOR, FTE_VER_MINOR);
|
||||||
#elif defined(SVNREVISION) && defined(SVNDATE)
|
#elif defined(SVNREVISION) && defined(SVNDATE)
|
||||||
Q_snprintfz(s, sizeof(s), "%s SVN %s", DISTRIBUTION, STRINGIFY(SVNREVISION)); //if both are defined then its a known unmodified svn revision.
|
if (!strncmp(STRINGIFY(SVNREVISION), "git-", 4))
|
||||||
|
Q_snprintfz(s, sizeof(s), "%s %s", DISTRIBUTION, STRINGIFY(SVNREVISION)); //if both are defined then its a known unmodified svn revision.
|
||||||
|
else
|
||||||
|
Q_snprintfz(s, sizeof(s), "%s SVN %s", DISTRIBUTION, STRINGIFY(SVNREVISION)); //if both are defined then its a known unmodified svn revision.
|
||||||
#else
|
#else
|
||||||
#if defined(SVNREVISION)
|
#if defined(SVNREVISION)
|
||||||
if (strcmp(STRINGIFY(SVNREVISION), "-"))
|
if (!strncmp(STRINGIFY(SVNREVISION), "git-", 4))
|
||||||
|
Q_snprintfz(s, sizeof(s), "%s %s %s", DISTRIBUTION, STRINGIFY(SVNREVISION), __DATE__);
|
||||||
|
else if (strcmp(STRINGIFY(SVNREVISION), "-"))
|
||||||
Q_snprintfz(s, sizeof(s), "%s SVN %s %s", DISTRIBUTION, STRINGIFY(SVNREVISION), __DATE__);
|
Q_snprintfz(s, sizeof(s), "%s SVN %s %s", DISTRIBUTION, STRINGIFY(SVNREVISION), __DATE__);
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue