mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
generate-version: add a define for “extra” version information
This will be set to “rrr-gNNNNNNN” when building from git, and the empty string otherwise.
This commit is contained in:
parent
02259f60a6
commit
efd023ad32
1 changed files with 6 additions and 4 deletions
|
|
@ -22,14 +22,16 @@ else
|
|||
new_version="${default_version}"
|
||||
fi
|
||||
|
||||
major=$(echo "${new_version}" | sed -r 's/([0-9]+)\.([0-9]+)\.([0-9]+).*/\1/')
|
||||
minor=$(echo "${new_version}" | sed -r 's/([0-9]+)\.([0-9]+)\.([0-9]+).*/\2/')
|
||||
patch=$(echo "${new_version}" | sed -r 's/([0-9]+)\.([0-9]+)\.([0-9]+).*/\3/')
|
||||
major=$(echo "${new_version}" | sed -r 's/([0-9]+)\.([0-9]+)\.([0-9]+)(-([0-9]+-g[a-z0-9]+) .*)?/\1/')
|
||||
minor=$(echo "${new_version}" | sed -r 's/([0-9]+)\.([0-9]+)\.([0-9]+)(-([0-9]+-g[a-z0-9]+) .*)?/\2/')
|
||||
patch=$(echo "${new_version}" | sed -r 's/([0-9]+)\.([0-9]+)\.([0-9]+)(-([0-9]+-g[a-z0-9]+) .*)?/\3/')
|
||||
extra=$(echo "${new_version}" | sed -r 's/([0-9]+)\.([0-9]+)\.([0-9]+)(-([0-9]+-g[a-z0-9]+) .*)?/\5/')
|
||||
|
||||
new_version="#define FOOT_VERSION \"${new_version}\"
|
||||
#define FOOT_MAJOR ${major}
|
||||
#define FOOT_MINOR ${minor}
|
||||
#define FOOT_PATCH ${patch}"
|
||||
#define FOOT_PATCH ${patch}
|
||||
#define FOOT_EXTRA \"${extra}\""
|
||||
|
||||
if [ -f "${out_file}" ]; then
|
||||
old_version=$(cat "${out_file}")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue