aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts
diff options
context:
space:
mode:
authorVaxry <[email protected]>2023-10-10 20:21:57 +0100
committerGitHub <[email protected]>2023-10-10 20:21:57 +0100
commit914851b91aeb450592e2d62749169298ac48fb0c (patch)
treedc495cfd7cbb507462184c13fb2c66c8f6d407f7 /scripts
parent3219c84433874c3b852a254b7b3047f0e19913d8 (diff)
downloadHyprland-914851b91aeb450592e2d62749169298ac48fb0c.tar.gz
Hyprland-914851b91aeb450592e2d62749169298ac48fb0c.zip
internal: better versioning (#3543)
* better versioning * meson: better versioning * nix: better versioning --------- Co-authored-by: Mihai Fufezan <[email protected]>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/generateVersion.sh14
1 files changed, 14 insertions, 0 deletions
diff --git a/scripts/generateVersion.sh b/scripts/generateVersion.sh
new file mode 100755
index 00000000..01bf1539
--- /dev/null
+++ b/scripts/generateVersion.sh
@@ -0,0 +1,14 @@
+#!/bin/sh
+cp ./src/version.h.in ./src/version.h -fr
+
+HASH=$(git rev-parse HEAD)
+BRANCH=$(git rev-parse --abbrev-ref HEAD)
+MESSAGE=$(git show ${GIT_COMMIT_HASH} | head -n 5 | tail -n 1 | sed -e 's/#//g' -e 's/\"//g')
+DIRTY=$(git diff-index --quiet HEAD -- || echo \"dirty\")
+TAG=$(git describe --tags)
+
+awk -i inplace "{sub(/@HASH@/,\"${HASH}\")}1" ./src/version.h
+awk -i inplace "{sub(/@BRANCH@/,\"${BRANCH}\")}1" ./src/version.h
+awk -i inplace "{sub(/@MESSAGE@/,\"${MESSAGE}\")}1" ./src/version.h
+awk -i inplace "{sub(/@DIRTY@/,\"${DIRTY}\")}1" ./src/version.h
+awk -i inplace "{sub(/@TAG@/,\"${TAG}\")}1" ./src/version.h \ No newline at end of file