I attached a patch to do this. However, I did not run a build with those changes yet to check that everything is working. I will update this ticket when I've done it.
Here is a copy past from the commit message:
This commit adds a get-tb-version script which uses the git tags tooutput the Tor Browser version and its build directory. The outputshould be used with 'eval' in shell scripts to define the variables.It takes as argument the type of version (release, alpha or beta).If the current commit is tagged with tag tbb-4.2-build15, get-tb-versionwill output this: TORBROWSER_VERSION=4.2 TORBROWSER_BUILDDIR=4.2-build15 TORBROWSER_SYMLINK_VERSION=1If the current commit is not tagged, get-tb-version will use the versionfrom the last tagged commit in history. The build directory will includethe commit hash rather than a build number. The output will be somethinglike this: TORBROWSER_VERSION=4.0 TORBROWSER_BUILDDIR=4.0-1a98e3efb368 TORBROWSER_SYMLINK_VERSION=0The TORBROWSER_BUILDDIR variable is used as the build directory.The TORBROWSER_SYMLINK_VERSION variable indicate whether we shouldcreate a symlink TORBROWSER_VERSION -> TORBROWSER_BUILDDIR.The various files which source the versions files and useTORBROWSER_VERSION have been updated to eval the output ofget-tb-version too, and use TORBROWSER_BUILDDIR as build directory.