diff --git a/GNUmakefile b/GNUmakefile index 9d87bf0e2..23e12a98c 100755 --- a/GNUmakefile +++ b/GNUmakefile @@ -11,6 +11,19 @@ ifeq ($(GNUSTEP_HOST_OS),mingw32) endif GNUSTEP_OBJ_DIR_BASENAME := $(GNUSTEP_OBJ_DIR_NAME) +VERSION := $(shell cat src/Cocoa/oolite-version.xcconfig | cut -d '=' -f 2) +VER_MAJ := $(shell echo $(VERSION) | cut -d. -f1) +VER_MIN := $(shell echo $(VERSION) | cut -d. -f2) +VER_REV := $(shell echo $(VERSION) | cut -d. -f3) +ifeq ($(VER_REV),) + VER_REV = 0 +endif +VER_DATE := $(shell date +%y%m%d) +VER_GITREV := $(shell git rev-list --count HEAD) +VER_GITHASH := $(shell git rev-parse --short=7 HEAD) +VER_FULL := $(VER_MAJ).$(VER_MIN).$(VER_REV).$(VER_GITREV)-$(VER_DATE)-$(VER_GITHASH) + + ifeq ($(GNUSTEP_HOST_OS),mingw32) vpath %.rc src/SDL/OOResourcesWin @@ -104,8 +117,8 @@ endif # add specific flags if building modern ifeq ($(modern),yes) - ADDITIONAL_CFLAGS += -DOOLITE_MODERN_BUILD=1 - ADDITIONAL_OBJCFLAGS += -DOOLITE_MODERN_BUILD=1 + ADDITIONAL_CFLAGS += -DOOLITE_MODERN_BUILD=1 -DOO_VERSION_FULL=\"$(VER_FULL)\" + ADDITIONAL_OBJCFLAGS += -DOOLITE_MODERN_BUILD=1 -DOO_VERSION_FULL=\"$(VER_FULL)\" # link time optimizations ifeq ($(lto),yes) ADDITIONAL_CFLAGS += -flto diff --git a/GNUmakefile.postamble b/GNUmakefile.postamble index ad431c440..cd93fdd80 100644 --- a/GNUmakefile.postamble +++ b/GNUmakefile.postamble @@ -9,11 +9,13 @@ POST_BUILD_ENV = \ GNUSTEP_HOST_CPU="$(GNUSTEP_HOST_CPU)" \ MINGW_PREFIX="$(MINGW_PREFIX)" \ DEBUG="$(debug)" \ + DEPLOYMENT_RELEASE_CONFIGURATION="$(DEPLOYMENT_RELEASE_CONFIGURATION)" \ MODERN="$(modern)" \ ESPEAK="$(ESPEAK)" \ USE_DEPS="$(use_deps)" \ STRIP_BIN="$(strip)" \ - STRIP="$(STRIP)" + STRIP="$(STRIP)" \ + VER_FULL="$(VER_FULL)" after-all:: @$(POST_BUILD_ENV) ShellScripts/common/post_build.sh diff --git a/Makefile b/Makefile index ac877f027..7d5140dcb 100755 --- a/Makefile +++ b/Makefile @@ -41,7 +41,7 @@ release-deployment: .PHONY: release-snapshot release-snapshot: - $(MAKE) -f GNUmakefile SNAPSHOT_BUILD=yes VERSION_STRING=$(VER) debug=no + $(MAKE) -f GNUmakefile SNAPSHOT_BUILD=yes debug=no mkdir -p AddOns && rm -rf AddOns/Basic-debug.oxp && cp -rf DebugOXP/Debug.oxp AddOns/Basic-debug.oxp .PHONY: debug diff --git a/src/Core/Entities/PlayerEntity.m b/src/Core/Entities/PlayerEntity.m index ce584003f..cca448385 100644 --- a/src/Core/Entities/PlayerEntity.m +++ b/src/Core/Entities/PlayerEntity.m @@ -10075,7 +10075,7 @@ - (void) setGuiToIntroFirstGo:(BOOL)justCobra if ([[arguments objectAtIndex:i] isEqual:@"-showversion"]) { OOGUIRow ms_start = msgLine; - NSString *version = [NSString stringWithFormat:@"Version %@", [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]]; + NSString *version = [NSString stringWithFormat:@"Version %s", OO_VERSION_FULL]; OOGUIRow i = msgLine = [gui addLongText:version startingAtRow:ms_start align:GUI_ALIGN_CENTER]; for (i-- ; i >= ms_start; i--) { diff --git a/src/Core/OOLogHeader.m b/src/Core/OOLogHeader.m index 1839d8839..b842f2bdd 100644 --- a/src/Core/OOLogHeader.m +++ b/src/Core/OOLogHeader.m @@ -161,10 +161,10 @@ void OOPrintLogHeader(void) #endif NSString *versionString = nil; - #if (defined (SNAPSHOT_BUILD) && defined (OOLITE_SNAPSHOT_VERSION)) - versionString = @"development version " OOLITE_SNAPSHOT_VERSION; + #if (defined (SNAPSHOT_BUILD)) + versionString = @"development version " @OO_VERSION_FULL; #else - versionString = [NSString stringWithFormat:@"version %@", [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]]; + versionString = [NSString stringWithFormat:@"version %s", OO_VERSION_FULL]; #endif if (versionString == nil) versionString = @""; diff --git a/src/Core/Universe.m b/src/Core/Universe.m index ee70aca4e..8c3afa3e1 100644 --- a/src/Core/Universe.m +++ b/src/Core/Universe.m @@ -5229,8 +5229,8 @@ - (void) drawUniverse // should come after the HUD to avoid it being overlapped by it [self drawMessage]; -#if (defined (SNAPSHOT_BUILD) && defined (OOLITE_SNAPSHOT_VERSION)) - [self drawWatermarkString:@"Development version " @OOLITE_SNAPSHOT_VERSION]; +#if (defined (SNAPSHOT_BUILD)) + [self drawWatermarkString:@"Development version " @OO_VERSION_FULL]; #endif OOLog(@"universe.profile.drawHUD", @"%@", @"End HUD drawing"); diff --git a/src/SDL/main.m b/src/SDL/main.m index 7f75b523d..dd24fb586 100644 --- a/src/SDL/main.m +++ b/src/SDL/main.m @@ -49,6 +49,11 @@ uint32_t gDebugFlags = 0; #endif +// This macro is normally defined in the build command +#ifndef OO_VERSION_FULL +#define OO_VERSION_FULL "Undefined" +#endif + /** * \ingroup cli * Entry point for Linux and Windows systems. @@ -186,6 +191,7 @@ int main(int argc, char *argv[]) "--xml"TABS3 TABS4"When compiling or exporting\n"TABS3 TABS4"system descriptions, use xml\n"TABS3 TABS4"format *\n" "\n" "Options marked with \"*\" are available only in Test Release configuration.\n" + "Version "OO_VERSION_FULL"\n" "Built with " #if OOLITE_HAVE_CLANG "Clang version " STRINGIFY(__clang_major__) "." STRINGIFY(__clang_minor__) "." STRINGIFY(__clang_patchlevel__) diff --git a/tools/mkmanifest.sh b/tools/mkmanifest.sh index 0153bff47..1d380a8b6 100755 --- a/tools/mkmanifest.sh +++ b/tools/mkmanifest.sh @@ -18,7 +18,12 @@ echo "{" echo " title = \"Oolite core\";" echo " identifier = \"org.oolite.oolite\";" echo " " -echo " version = \"$OOLITE_VERSION\";" +echo " version = \"$VER_FULL\";" +if [ "$DEPLOYMENT_RELEASE_CONFIGURATION" = "yes" ]; then + echo " debug_functionality_support = no;" +else + echo " debug_functionality_support = yes;" +fi echo " required_oolite_version = \"$OOLITE_VERSION\";" echo " " echo " license = \"GPL 2+ / CC-BY-NC-SA 3.0 - see LICENSE.md for details\";"