get_version.sh (419B)
1 #!/bin/sh 2 # Gets the version number from git, or from the contents of .version 3 cd "${MESON_SOURCE_ROOT}" 4 VERSION= 5 if test -f ".version" 6 then 7 VERSION=$(cat .version) 8 fi 9 if test -d "./.git" 10 then 11 git submodule init > /dev/null 12 git submodule update > /dev/null 13 VERSION=$(git describe --tags) 14 VERSION=${VERSION#v} 15 echo $VERSION > .version 16 fi 17 if test "x$VERSION" = "x" 18 then 19 VERSION="unknown" 20 fi 21 echo "$VERSION"