diff options
author | midipix <writeonce@midipix.org> | 2018-12-24 11:35:15 -0500 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2018-12-24 11:38:00 -0500 |
commit | f296131ba9eb41c6a8e4279c3f1d3f17aaf25692 (patch) | |
tree | b929d29806e22c63a9ac711a379e4690bcca7223 | |
parent | 8c6daffbe0801b50c71fbb5a0ce87185701898e7 (diff) | |
download | dalist-f296131ba9eb41c6a8e4279c3f1d3f17aaf25692.tar.bz2 dalist-f296131ba9eb41c6a8e4279c3f1d3f17aaf25692.tar.xz |
build system: version.sh: generate macro for date of last git commit.
-rwxr-xr-x | sysinfo/version.sh | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/sysinfo/version.sh b/sysinfo/version.sh index 1a73794..a9e5992 100755 --- a/sysinfo/version.sh +++ b/sysinfo/version.sh @@ -54,11 +54,20 @@ fi cd "$srcdir" gitver=$(git rev-parse --verify HEAD 2>/dev/null) || gitver="unknown" -macro=$(echo "$prefix"_GIT_VERSION | tr '[:lower:]' '[:upper:]') +cvdate=$(git show -s --format=%ci $gitver) +vmacro=$(printf '%s' "$prefix"'_GIT_VERSION' | tr '[:lower:]' '[:upper:]') +dmacro=$(printf '%s' "$prefix"'_GIT_DATE ' | tr '[:lower:]' '[:upper:]') + + +# three cd "$workdir" -mkdir -p $(dirname "$output") -printf "#define $macro\t\"$gitver\"\n" > "$output" +mkdir -p $(dirname "$output") + +printf '#define %s "%s"\n#define %s "%s"\n' \ + "$vmacro" "$gitver" \ + "$dmacro" "$cvdate" \ + > "$output" # all done exit 0 |