From 641b00837460f4a3efae3cfccd79d13b544588c5 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Fri, 11 Oct 2019 19:13:43 +0100 Subject: [PATCH] Build: Add configure defines to detailed version output --- Makefile.src.in | 4 +++- projects/determineversion.vbs | 1 + src/crashlog.cpp | 6 ++++-- src/rev.cpp.in | 5 +++++ src/rev.h | 1 + 5 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Makefile.src.in b/Makefile.src.in index dc3a5f48b3..f091975124 100644 --- a/Makefile.src.in +++ b/Makefile.src.in @@ -115,6 +115,8 @@ RES := $(shell if [ "`cat $(CONFIG_CACHE_VERSION) 2>/dev/null`" != "$(VERSION) $ # If there is a change in the configure invocation, make sure we recompile rev.cpp RES := $(shell if [ "`cat $(CONFIG_CACHE_INVOCATION) 2>/dev/null`" != "$(CONFIGURE_INVOCATION)" ]; then echo "$(CONFIGURE_INVOCATION)" > $(CONFIG_CACHE_INVOCATION); fi ) +CONFIGURE_DEFINES := $(filter-out PERSONAL_DIR=% GLOBAL_DATA_DIR=%,$(patsubst -D%,%,$(filter -D%,$(CFLAGS)))) + ifndef MAKEDEPEND # The slow, but always correct, dep-check DEP_MASK := %.d @@ -278,7 +280,7 @@ endif # Revision files $(SRC_DIR)/rev.cpp: $(CONFIG_CACHE_VERSION) $(CONFIG_CACHE_INVOCATION) $(SRC_DIR)/rev.cpp.in - $(Q)cat $(SRC_DIR)/rev.cpp.in | sed "s@\!\!ISODATE\!\!@$(ISODATE)@g;s@!!VERSION!!@$(VERSION)@g;s@!!MODIFIED!!@$(MODIFIED)@g;s@!!DATE!!@`date +%d.%m.%y`@g;s@!!GITHASH!!@$(GITHASH)@g;s@!!ISTAG!!@$(ISTAG)@g;s@!!ISSTABLETAG!!@$(ISSTABLETAG)@g;s@\!\!CONFIGURE_INVOCATION\!\!@$(CONFIGURE_INVOCATION)@g;" > $(SRC_DIR)/rev.cpp + $(Q)cat $(SRC_DIR)/rev.cpp.in | sed "s@\!\!ISODATE\!\!@$(ISODATE)@g;s@!!VERSION!!@$(VERSION)@g;s@!!MODIFIED!!@$(MODIFIED)@g;s@!!DATE!!@`date +%d.%m.%y`@g;s@!!GITHASH!!@$(GITHASH)@g;s@!!ISTAG!!@$(ISTAG)@g;s@!!ISSTABLETAG!!@$(ISSTABLETAG)@g;s@\!\!CONFIGURE_INVOCATION\!\!@$(CONFIGURE_INVOCATION)@g;s@\!\!CONFIGURE_DEFINES\!\!@$(CONFIGURE_DEFINES)@g;" > $(SRC_DIR)/rev.cpp $(SRC_DIR)/os/windows/ottdres.rc: $(CONFIG_CACHE_VERSION) $(SRC_DIR)/os/windows/ottdres.rc.in $(Q)cat $(SRC_DIR)/os/windows/ottdres.rc.in | sed "s@\!\!ISODATE\!\!@$(ISODATE)@g;s@!!VERSION!!@$(VERSION)@g;s@!!DATE!!@`date +%d.%m.%y`@g;s@!!GITHASH!!@$(GITHASH)@g;s@!!ISTAG!!@$(ISTAG)@g;s@!!ISSTABLETAG!!@$(ISSTABLETAG)@g" > $(SRC_DIR)/os/windows/ottdres.rc diff --git a/projects/determineversion.vbs b/projects/determineversion.vbs index a00778f2d1..62c5df81d1 100755 --- a/projects/determineversion.vbs +++ b/projects/determineversion.vbs @@ -31,6 +31,7 @@ Sub UpdateFile(modified, isodate, version, cur_date, githash, istag, isstabletag FindReplaceInFile filename, "!!ISTAG!!", istag FindReplaceInFile filename, "!!ISSTABLETAG!!", isstabletag FindReplaceInFile filename, "!!CONFIGURE_INVOCATION!!", "" + FindReplaceInFile filename, "!!CONFIGURE_DEFINES!!", "" End Sub Sub UpdateFiles(version) diff --git a/src/crashlog.cpp b/src/crashlog.cpp index df00ebddc4..ae77006bf4 100644 --- a/src/crashlog.cpp +++ b/src/crashlog.cpp @@ -146,7 +146,8 @@ char *CrashLog::LogOpenTTDVersion(char *buffer, const char *last) const " Endian: %s\n" " Dedicated: %s\n" " Build date: %s\n" - " Configure: %s\n\n", + " Configure: %s\n" + " Defines: %s\n\n", _openttd_revision, _openttd_revision_modified, _openttd_newgrf_version, @@ -166,7 +167,8 @@ char *CrashLog::LogOpenTTDVersion(char *buffer, const char *last) const "no", #endif _openttd_build_date, - _openttd_build_configure + _openttd_build_configure, + _openttd_build_configure_defines ); } diff --git a/src/rev.cpp.in b/src/rev.cpp.in index eae70d7bff..6608a190e5 100644 --- a/src/rev.cpp.in +++ b/src/rev.cpp.in @@ -53,6 +53,11 @@ const char _openttd_build_date[] = __DATE__ " " __TIME__; */ const char _openttd_build_configure[] = "!!CONFIGURE_INVOCATION!!"; +/** + * The configure defines used to build OpenTTD + */ +const char _openttd_build_configure_defines[] = "!!CONFIGURE_DEFINES!!"; + /** * The git revision hash of this version. */ diff --git a/src/rev.h b/src/rev.h index a1a99c51c7..f6f2c853d7 100644 --- a/src/rev.h +++ b/src/rev.h @@ -16,6 +16,7 @@ extern const char _openttd_revision[]; extern const char _openttd_build_date[]; extern const char _openttd_revision_hash[]; extern const char _openttd_build_configure[]; +extern const char _openttd_build_configure_defines[]; extern const byte _openttd_revision_modified; extern const byte _openttd_revision_tagged; extern const uint32 _openttd_newgrf_version;