build: use meson for version info
This commit is contained in:
@@ -76,14 +76,7 @@ abs_path() {
|
||||
}
|
||||
|
||||
get_version() {
|
||||
local major minor micro
|
||||
local F="${1:-"$GITDIR/configure.ac"}"
|
||||
|
||||
vars="$(sed -n 's/^m4_define(\[nm_\(major\|minor\|micro\)_version\], *\[\([0-9]\+\)\]) *$/local \1='\''\2'\''/p' "$F" 2>/dev/null)"
|
||||
eval "$vars"
|
||||
|
||||
[[ -n "$major" && -n "$minor" && "$micro" ]] || return 1
|
||||
echo "$major.$minor.$micro"
|
||||
grep -E -m1 '^\s+version:' "$GITDIR/meson.build" | cut -d"'" -f2
|
||||
}
|
||||
|
||||
write_changelog() {
|
||||
|
@@ -44,14 +44,7 @@ usage() {
|
||||
}
|
||||
|
||||
get_version() {
|
||||
local major minor micro
|
||||
local F="./configure.ac"
|
||||
|
||||
vars="$(sed -n 's/^m4_define(\[nm_\(major\|minor\|micro\)_version\], *\[\([0-9]\+\)\]) *$/local \1='\''\2'\''/p' "$F" 2>/dev/null)"
|
||||
eval "$vars"
|
||||
|
||||
[[ -n "$major" && -n "$minor" && "$micro" ]] || return 1
|
||||
echo "$major.$minor.$micro"
|
||||
grep -E -m1 '^\s+version:' meson.build | cut -d"'" -f2
|
||||
}
|
||||
|
||||
bool() {
|
||||
|
@@ -94,9 +94,9 @@ do_command() {
|
||||
}
|
||||
|
||||
parse_version() {
|
||||
local MAJ="$(sed -n '1,20 s/^m4_define(\[nm_major_version\], \[\([0-9]\+\)\])$/\1/p' ./configure.ac)"
|
||||
local MIN="$(sed -n '1,20 s/^m4_define(\[nm_minor_version\], \[\([0-9]\+\)\])$/\1/p' ./configure.ac)"
|
||||
local MIC="$(sed -n '1,20 s/^m4_define(\[nm_micro_version\], \[\([0-9]\+\)\])$/\1/p' ./configure.ac)"
|
||||
local VERSION=$(grep -E -m1 '^\s+version:' "$GITDIR/meson.build" \
|
||||
| cut -d"'" -f2 \
|
||||
| sed 's/\./ /g')
|
||||
|
||||
re='^(0|[1-9][0-9]*) (0|[1-9][0-9]*) (0|[1-9][0-9]*)$'
|
||||
[[ "$MAJ $MIN $MIC" =~ $re ]] || return 1
|
||||
|
Reference in New Issue
Block a user