-
-
Notifications
You must be signed in to change notification settings - Fork 152
/
set-version
executable file
·40 lines (32 loc) · 963 Bytes
/
set-version
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
34
35
36
37
38
39
40
#!/bin/sh
# vim: expandtab sw=4 ts=4 sts=4:
if [ -z "$1" ] ; then
echo "Usage: set-version VERSION [SOVERSION]"
exit 1
fi
version=$1
if [ -z "$2" ] ; then
soversion=`sed -n 's/set (GAMMU_SOVERSION "\([^"]*\)".*/\1/p' < CMakeLists.txt`
else
soversion=$2
fi
do_replace() {
sed "s/@GAMMU_VERSION@/$version/; s/@GAMMU_SOVERSION@/$soversion/;" < $1 > $2
}
echo "Setting version to $version (soversion=$soversion)"
# Packaging
do_replace cmake/templates/gammu.spec.in gammu.spec
do_replace cmake/templates/description-pak.in description-pak
# CMakeLists.txt
sed -i "
s/set (GAMMU_VERSION \"[^\"]*\"\\(.*\\))/set (GAMMU_VERSION \"$version\"\1)/;
s/set (GAMMU_SOVERSION \"[^\"]*\"\\(.*\\))/set (GAMMU_SOVERSION \"$soversion\"\1)/;
" CMakeLists.txt
# Update ChangeLog
if ! grep -q " - $version" ChangeLog ; then
sed -i -e '/^=========$/ a\
' -e '/^=========$/ a\
2017???? - '"$version"'
' ChangeLog
fi
make update-man