diff options
-rwxr-xr-x | Config | 8 | ||||
-rw-r--r-- | include/version.cpp | 9 |
2 files changed, 12 insertions, 5 deletions
@@ -168,11 +168,11 @@ if [ ! "$NO_INTRO" ] ; then VERSION=`git describe --tags` VERSION_BUILD=`echo "$VERSION" | cut -d'-' -f2` VERSION_EXTRA=`echo "$VERSION" | cut -d'-' -f3` - if [ "$VERSION_BUILD" == "$VERSION_EXTRA" ] ; then - VERSION_EXTRA="" + # Only do this if we are not on a tag, src/version.sh will be all we need then. + if [ "$VERSION_BUILD" != "$VERSION_EXTRA" ] ; then + echo "#define VERSION_BUILD $VERSION_BUILD" > include/version.h + echo "#define VERSION_EXTRA \"$VERSION_EXTRA\"" >> include/version.h fi - echo "#define VERSION_BUILD $VERSION_BUILD" > include/version.h - echo "#define VERSION_EXTRA \"$VERSION_EXTRA\"" >> include/version.h fi cat $SOURCE_DIR/.BANNER | sed "s/CURVER/$VERSION/" | sed "s@SOURCE_DIR@$SOURCE_DIR@" | $PAGER echo "" diff --git a/include/version.cpp b/include/version.cpp index ae3ee883e..9b8f38c45 100644 --- a/include/version.cpp +++ b/include/version.cpp @@ -54,12 +54,19 @@ int main(int argc, char *argv[]) std::string version_build = "#define VERSION_BUILD 1"; std::string build = "#define BUILD 1"; + std::string version_extra; if (fd.is_open()) { while (getline(fd, filebuf)) { if (!filebuf.find("#define VERSION_BUILD")) version_build = filebuf; + else if (!filebuf.find("#define VERSION_EXTRA")) + { + size_t q = filebuf.find('"'); + + version_extra = filebuf.substr(q + 1, filebuf.length() - q - 2); + } else if (!filebuf.find("#define BUILD")) { size_t tab = filebuf.find(' '); @@ -89,7 +96,7 @@ int main(int argc, char *argv[]) for (std::list<std::pair<std::string, std::string> >::iterator it = versions.begin(), it_end = versions.end(); it != it_end; ++it) { if (it->first == "EXTRA") - fd << "#define VERSION_EXTRA \"" << it->second << "\"" << std::endl; + fd << "#define VERSION_EXTRA \"" << (!version_extra.empty() ? version_extra : "") << it->second << "\"" << std::endl; else fd << "#define VERSION_" << it->first << " " << it->second << std::endl; } |