aboutsummaryrefslogtreecommitdiff
path: root/contrib/_incr_version
blob: 376be44c8f13d4ef3bd547ed0a0638dd1e52abf3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/sh -eu
old_version="$1"
new_version="$2"
sed -i meson.build -e "s/version: '$old_version'/version: '$new_version'/g"

printf "Backwards-incompatible ABI changes? (y/n) "
read inc_age
if [ "$inc_age" = 'n' ]
then
	printf "Interface(s) added, removed, or changed? (y/n) "
	read inc_current
fi

so_version=$(egrep '^so_version =' meson.build | cut -d'[' -f2- | cut -d']' -f1)
current=$(echo "$so_version" | cut -d',' -f1 | sed -e "s/'//g" -e "s/ //g")
revision=$(echo "$so_version" | cut -d',' -f2 | sed -e "s/'//g" -e "s/ //g")
age=$(echo "$so_version" | cut -d',' -f3 | sed -e "s/'//g" -e "s/ //g")

if [ "$inc_age" = 'y' ]
then
	age=$((age+1))
	current=$((current+1))
elif [ "$inc_current" = 'y' ]
then
	current=$((current+1))
fi
revision=$((revision+1))

sed -i meson.build \
	-e "s/so_version = .*/so_version = ['$current', '$revision', '$age']/g"

git add meson.build
git commit -m "Update version to $new_version"