2012-05-05 23:24:46 -04:00
|
|
|
#!/bin/sh
|
2012-05-05 22:58:16 -04:00
|
|
|
##### -*- mode:shell-script; indent-tabs-mode:nil; sh-basic-offset:2 -*-
|
|
|
|
|
|
|
|
src_repo="$(pwd)"
|
|
|
|
tmp_dir=${TMP_DIR:="/tmp"}
|
|
|
|
|
|
|
|
parse_version () {
|
2012-05-05 21:12:08 -04:00
|
|
|
local ver="$1" major="" minor="" micro="" rev=""
|
|
|
|
local next=major
|
|
|
|
for x in $(echo "$1" | sed -e 's/\([._~-]\)/ \1 /g'); do
|
|
|
|
if [ $next = rev ]; then
|
|
|
|
rev="${rev}${x}"
|
|
|
|
elif [ "$x" = "." ] || [ "$x" = "_" ] || [ "$x" = "~" ] || [ "$x" = "-" ]; then
|
|
|
|
if [ "$x" = "_" ] || [ "$x" = "~" ] || [ "$x" = "-" ]; then
|
|
|
|
next=rev
|
|
|
|
eval $next='$x'
|
|
|
|
else
|
|
|
|
case $next in
|
|
|
|
major) next=minor;;
|
|
|
|
minor) next=micro;;
|
|
|
|
micro) next=rev;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
local tmp="$(eval echo \$$next)"
|
|
|
|
eval $next='${tmp}${x}'
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
local cmajor cminor cmicro crev cver
|
|
|
|
cmajor=${major:="0"}
|
|
|
|
cminor=${minor:="0"}
|
|
|
|
cmicro=${micro:="0"}
|
|
|
|
crev="$(echo "$rev" | sed -e 's/[._~-]//')"
|
|
|
|
cver="${cmajor}.${cminor}.${cmicro}"
|
2012-05-06 00:51:15 -04:00
|
|
|
if [ -n "${micro}" ] && echo "$micro" | grep '^\(alpha\|beta\|rc\)' >/dev/null; then
|
|
|
|
rev="~${micro}"
|
|
|
|
micro="0"
|
|
|
|
ver="${major}.${minor}${rev}"
|
|
|
|
fi
|
2012-05-05 21:12:08 -04:00
|
|
|
[ -n "$crev" ] && cver="${cver}.${crev}"
|
2012-05-05 22:58:16 -04:00
|
|
|
echo "ver='$ver'"
|
|
|
|
echo "major='$major'"
|
|
|
|
echo "minor='$minor'"
|
|
|
|
echo "micro='$micro'"
|
|
|
|
echo "rev='$rev'"
|
2012-05-05 21:12:08 -04:00
|
|
|
echo "cver='$cver'"
|
|
|
|
echo "cmajor='$cmajor'"
|
|
|
|
echo "cminor='$cminor'"
|
|
|
|
echo "cmicro='$cmicro'"
|
|
|
|
echo "crev='$crev'"
|
2012-05-05 22:58:16 -04:00
|
|
|
}
|
|
|
|
|
2012-05-06 01:26:56 -04:00
|
|
|
set_fs_ver () {
|
|
|
|
local ver="$1" major="$2" minor="$3" micro="$4" rev="$5"
|
|
|
|
sed -e "s|\(AC_SUBST(SWITCH_VERSION_MAJOR, \[\).*\(\])\)|\1$major\2|" \
|
|
|
|
-e "s|\(AC_SUBST(SWITCH_VERSION_MINOR, \[\).*\(\])\)|\1$minor\2|" \
|
|
|
|
-e "s|\(AC_SUBST(SWITCH_VERSION_MICRO, \[\).*\(\])\)|\1$micro\2|" \
|
|
|
|
-e "s|\(AC_INIT(\[freeswitch\], \[\).*\(\], BUG-REPORT-ADDRESS)\)|\1$ver\2|" \
|
|
|
|
-i configure.in
|
|
|
|
if [ -n "$rev" ]; then
|
|
|
|
sed -e "s|\(AC_SUBST(SWITCH_VERSION_REVISION, \[\).*\(\])\)|\1$rev\2|" \
|
|
|
|
-e "s|#\(AC_SUBST(SWITCH_VERSION_REVISION\)|\1|" \
|
|
|
|
-i configure.in
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
gnuize () {
|
|
|
|
./bootstrap.sh -j
|
|
|
|
mv bootstrap.sh rebootstrap.sh
|
|
|
|
rm -f docs/AUTHORS
|
|
|
|
rm -f docs/COPYING
|
|
|
|
rm -f docs/ChangeLog
|
|
|
|
rm -rf .git
|
|
|
|
}
|
|
|
|
|
2012-05-05 22:58:16 -04:00
|
|
|
if [ ! -d .git ]; then
|
|
|
|
echo "error: must be run from within the top level of a FreeSWITCH git tree." 1>&2
|
|
|
|
exit 1;
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z "$1" ]; then
|
2012-05-05 21:12:08 -04:00
|
|
|
echo "usage: $0 <version> <build-number>" 1>&2
|
2012-05-05 22:58:16 -04:00
|
|
|
exit 1;
|
|
|
|
fi
|
|
|
|
|