Set version date to commit date instead of build date

Fixes #2688

This commit updates `build_odin.sh` and `build.bat` so that date of the commit
is used for the version tag, instead of the build time.
This commit is contained in:
Hasan Yasin Ozturk
2023-07-31 17:29:56 +03:00
parent be6f355665
commit 3d16880d95
2 changed files with 11 additions and 5 deletions
+7 -4
View File
@@ -8,17 +8,20 @@ set -eu
: ${ODIN_VERSION=dev-$(date +"%Y-%m")}
: ${GIT_SHA=}
CPPFLAGS="$CPPFLAGS -DODIN_VERSION_RAW=\"$ODIN_VERSION\""
CXXFLAGS="$CXXFLAGS -std=c++14"
LDFLAGS="$LDFLAGS -pthread -lm -lstdc++"
if [ -d ".git" ]; then
GIT_SHA=$(git rev-parse --short HEAD || :)
if [ "$GIT_SHA" ]; then
if [ -d ".git" ] && [ $(which git) ]; then
versionTag=( $(git show --pretty='%cd %h' --date=format:%Y-%m --no-patch --no-notes HEAD) )
if [ $? -eq 0 ]; then
ODIN_VERSION="${versionTag[0]}"
GIT_SHA="${versionTag[1]}"
CPPFLAGS="$CPPFLAGS -DGIT_SHA=\"$GIT_SHA\""
fi
fi
CPPFLAGS="$CPPFLAGS -DODIN_VERSION_RAW=\"$ODIN_VERSION\""
DISABLED_WARNINGS="-Wno-switch -Wno-macro-redefined -Wno-unused-value"
OS=$(uname)