From 776c8daa27edb935c4e6d4822c47542e1c2b5ad9 Mon Sep 17 00:00:00 2001 From: Nikita Smith Date: Thu, 7 Nov 2024 15:06:21 -0800 Subject: [PATCH] updated build.sh to define git hash --- build.bat | 1 - build.sh | 8 ++++++-- src/linker/lnk.c | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/build.bat b/build.bat index 3bbde071..446e23a2 100644 --- a/build.bat +++ b/build.bat @@ -89,7 +89,6 @@ popd :: --- Get Current Git Commit Id ---------------------------------------------- for /f %%i in ('call git describe --always --dirty') do set compile=%compile% -DBUILD_GIT_HASH=\"%%i\" for /f %%i in ('call git rev-parse HEAD') do set compile=%compile% -DBUILD_GIT_HASH_FULL=\"%%i\" -for /f %%i in ('call git rev-parse --abbrev-ref HEAD') do set compile=%compile% -DBUILD_GIT_BRANCH=\"%%i\" :: --- Build & Run Metaprogram ------------------------------------------------ if "%no_meta%"=="1" echo [skipping metagen] diff --git a/build.sh b/build.sh index e70e3389..03bde82c 100644 --- a/build.sh +++ b/build.sh @@ -14,13 +14,17 @@ if [ -v gcc ]; then compiler="${CC:-gcc}"; echo "[gcc compile]"; fi # --- Unpack Command Line Build Arguments ------------------------------------- auto_compile_flags='' +# --- Get Current Git Commit Id ----------------------------------------------- +git_hash=$(git rev-parse HEAD) +git_hash_full=$(git rev-parse HEAD) + # --- Compile/Link Line Definitions ------------------------------------------- -clang_common='-I../src/ -I../local/ -g -Wno-unknown-warning-option -fdiagnostics-absolute-paths -Wall -Wno-missing-braces -Wno-unused-function -Wno-writable-strings -Wno-unused-value -Wno-unused-variable -Wno-unused-local-typedef -Wno-deprecated-register -Wno-deprecated-declarations -Wno-unused-but-set-variable -Wno-single-bit-bitfield-constant-conversion -Wno-compare-distinct-pointer-types -Wno-initializer-overrides -Wno-incompatible-pointer-types-discards-qualifiers -Wno-for-loop-analysis -Xclang -flto-visibility-public-std -D_USE_MATH_DEFINES -Dstrdup=_strdup -Dgnu_printf=printf' +clang_common="-I../src/ -I../local/ -g -DBUILD_GIT_HASH=\"$git_hash\" -DBUILD_GIT_HASH_FULL=\"$git_hash_full\" -Wno-unknown-warning-option -fdiagnostics-absolute-paths -Wall -Wno-missing-braces -Wno-unused-function -Wno-writable-strings -Wno-unused-value -Wno-unused-variable -Wno-unused-local-typedef -Wno-deprecated-register -Wno-deprecated-declarations -Wno-unused-but-set-variable -Wno-single-bit-bitfield-constant-conversion -Wno-compare-distinct-pointer-types -Wno-initializer-overrides -Wno-incompatible-pointer-types-discards-qualifiers -Wno-for-loop-analysis -Xclang -flto-visibility-public-std -D_USE_MATH_DEFINES -Dstrdup=_strdup -Dgnu_printf=printf" clang_debug="$compiler -g -O0 -DBUILD_DEBUG=1 ${clang_common} ${auto_compile_flags}" clang_release="$compiler -g -O2 -DBUILD_DEBUG=0 ${clang_common} ${auto_compile_flags}" clang_link="-lpthread -lm -lrt -ldl" clang_out="-o" -gcc_common='-I../src/ -I../local/ -g -Wno-unknown-warning-option -Wall -Wno-missing-braces -Wno-unused-function -Wno-attributes -Wno-unused-value -Wno-unused-variable -Wno-unused-local-typedef -Wno-deprecated-declarations -Wno-unused-but-set-variable -Wno-compare-distinct-pointer-types -D_USE_MATH_DEFINES -Dstrdup=_strdup -Dgnu_printf=printf' +gcc_common="-I../src/ -I../local/ -g -DBUILD_GIT_HASH=\"$git_hash\" -DBUILD_GIT_HASH_FULL=\"$git_hash_full\" -Wno-unknown-warning-option -Wall -Wno-missing-braces -Wno-unused-function -Wno-attributes -Wno-unused-value -Wno-unused-variable -Wno-unused-local-typedef -Wno-deprecated-declarations -Wno-unused-but-set-variable -Wno-compare-distinct-pointer-types -D_USE_MATH_DEFINES -Dstrdup=_strdup -Dgnu_printf=printf" gcc_debug="$compiler -g -O0 -DBUILD_DEBUG=1 ${gcc_common} ${auto_compile_flags}" gcc_release="$compiler -g -O2 -DBUILD_DEBUG=0 ${gcc_common} ${auto_compile_flags}" gcc_link="-lpthread -lm -lrt -ldl" diff --git a/src/linker/lnk.c b/src/linker/lnk.c index 99bd07a4..03f6deff 100644 --- a/src/linker/lnk.c +++ b/src/linker/lnk.c @@ -10,7 +10,7 @@ #define BUILD_VERSION_PATCH 13 #define BUILD_RELEASE_PHASE_STRING_LITERAL "ALPHA" #define BUILD_VERSION_STRING Stringify(BUILD_VERSION_MAJOR) "." Stringify(BUILD_VERSION_MINOR) "." Stringify(BUILD_VERSION_PATCH) -#define BUILD_TITLE "Epic Games Tools (R) RAD COFF/PE Linker " BUILD_VERSION_STRING " (" BUILD_GIT_BRANCH "-" BUILD_GIT_HASH_FULL ")" +#define BUILD_TITLE "Epic Games Tools (R) RAD COFF/PE Linker " BUILD_VERSION_STRING " (" BUILD_GIT_HASH_FULL ")" ////////////////////////////////