X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=tools%2Fdefine_versions.sh;h=37eca614f326044c60e0a2cdebdbea3327168a08;hb=db3223478c914f5b9ef97343ae2f262d3e99f74b;hp=6f5c17773cbdcaec32c404e89b054fcedd11fd89;hpb=155388ec3c9df48487bb30dde8fea4d05b5e1b7e;p=ardour.git diff --git a/tools/define_versions.sh b/tools/define_versions.sh index 6f5c17773c..37eca614f3 100644 --- a/tools/define_versions.sh +++ b/tools/define_versions.sh @@ -2,15 +2,50 @@ # this is sourced by build and package, and executed from within build/{osx,linux}_packaging # -major_version=`grep -m 1 '^MAJOR = ' ../../wscript | awk '{print $3}' | sed "s/'//g"` -minor_version=`grep -m 1 '^MINOR = ' ../../wscript | awk '{print $3}' | sed "s/'//g"` -release_version=${major_version}.${minor_version} -r=`cut -d'"' -f2 < ../../libs/ardour/revision.cc | sed -e 1d -e "s/[0-9][0-9]*\.[0-9][0-9]*-//"` -if echo $r | grep -q -e - ; then - revcount=`echo $r | cut -d- -f1` +if uname -a | grep arwin >/dev/null 2>&1 ; then + EXTENDED_RE=-E +else + EXTENDED_RE=-r fi -commit=`echo $r | cut -d- -f2` -version=${release_version}${revcount:+.$revcount} + +GIT_REV_REGEXP='([0-9][0-9]*)\.([0-9][0-9]*)\-?([pr][rc]e?[0-9]*)?-?([0-9][0-9]*)?(-g([a-f0-9]+))?' + +major_version=`cut -d'"' -f2 < ../../libs/ardour/revision.cc | sed $EXTENDED_RE -e 1d -e "s/$GIT_REV_REGEXP/\1/"` +minor_version=`cut -d'"' -f2 < ../../libs/ardour/revision.cc | sed $EXTENDED_RE -e 1d -e "s/$GIT_REV_REGEXP/\2/"` + +# Tracks tags with "MAJOR.MINOR.MICRO" +# Ardour doesn't use this + +micro_version=`cut -d'"' -f2 < ../../libs/ardour/revision.cc | sed $EXTENDED_RE -e 1d -e "s/$GIT_REV_REGEXP/\3/"` + +# +# RC e.g. 8.1-rc3 (optional) +# OR +# PRE e.g. 9.3-pre0 (optional) +# +# Tracks does not use -rcN based tagging +# +rc=`cut -d'"' -f2 < ../../libs/ardour/revision.cc | sed $EXTENDED_RE -e 1d -e "s/$GIT_REV_REGEXP/\3/"` + +# +# revision count since tag +# +r=`cut -d'"' -f2 < ../../libs/ardour/revision.cc | sed $EXTENDED_RE -e 1d -e "s/$GIT_REV_REGEXP/\4/"` + +# +# git short sha1 commit ID +# +commit=`cut -d'"' -f2 < ../../libs/ardour/revision.cc | sed $EXTENDED_RE -e 1d -e "s/$GIT_REV_REGEXP/\6/"` + +if [ "x$rc" != "x" ] ; then + revcount=$rc${r:+.$r} +elif [ "x$r" != "x" ] ; then + revcount=$r +else + revcount=0 +fi + +release_version=${major_version}.${minor_version}${revcount:+.$revcount} # # Figure out the Build Type