summaryrefslogtreecommitdiff
path: root/include/version.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2010-12-24 20:05:52 -0500
committerAdam <Adam@anope.org>2010-12-24 20:05:52 -0500
commitfaf1e3710ef2d86c6b4a562814d6cfaa064723a9 (patch)
tree5e5aec2de28769d456fe2f0982cc2317407cf478 /include/version.cpp
parente54cffd9b78f5c55a6a68671a811d2f9577ae846 (diff)
Fixed version.cpp to work ok if we are on a tag, and
prevent version.cpp from prepending version.sh's VERSION_EXTRA on every build
Diffstat (limited to 'include/version.cpp')
-rw-r--r--include/version.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/include/version.cpp b/include/version.cpp
index ae3ee883e..8cf362726 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 : "") << (version_extra.find(it->second) == std::string::npos ? it->second : "") << "\"" << std::endl;
else
fd << "#define VERSION_" << it->first << " " << it->second << std::endl;
}