diff options
author | Remko Tronçon <git@el-tramo.be> | 2011-04-29 20:58:33 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2011-04-29 20:58:33 (GMT) |
commit | eebe97fcc00607addc4629c3223c255dfd5ba85b (patch) | |
tree | 7ef892c2fad215baf20d48cf54bf1aea47c12741 | |
parent | b20be6f8e9a46d7226a95aed542067b5917fd266 (diff) | |
download | swift-eebe97fcc00607addc4629c3223c255dfd5ba85b.zip swift-eebe97fcc00607addc4629c3223c255dfd5ba85b.tar.bz2 |
Added versioning to Swiften.
-rwxr-xr-x | BuildTools/Copyrighter.py | 2 | ||||
-rw-r--r-- | Swiften/.gitignore | 1 | ||||
-rw-r--r-- | Swiften/SConscript | 23 |
3 files changed, 21 insertions, 5 deletions
diff --git a/BuildTools/Copyrighter.py b/BuildTools/Copyrighter.py index ec6220e..a768f0d 100755 --- a/BuildTools/Copyrighter.py +++ b/BuildTools/Copyrighter.py @@ -136,7 +136,7 @@ elif sys.argv[1] == "check-all-copyrights" : for (path, dirs, files) in os.walk(".") : if "3rdParty" in path or ".sconf" in path or "Swift.app" in path : continue - for filename in [os.path.join(path, file) for file in files if (file.endswith(".cpp") or file.endswith(".h")) and not "ui_" in file and not "moc_" in file and not "qrc_" in file and not "BuildVersion.h" in file and not "Swiften.h" in file and not "swiften-config.h" in file] : + for filename in [os.path.join(path, file) for file in files if (file.endswith(".cpp") or file.endswith(".h")) and not "ui_" in file and not "moc_" in file and not "qrc_" in file and not "BuildVersion.h" in file and not "Swiften.h" in file and not "Version.h" in file and not "swiften-config.h" in file] : ok &= check_copyright(filename) if not ok : sys.exit(-1) diff --git a/Swiften/.gitignore b/Swiften/.gitignore index c21d6aa..de234f5 100644 --- a/Swiften/.gitignore +++ b/Swiften/.gitignore @@ -1,3 +1,4 @@ *.a *.o Swiften.h +Version.h diff --git a/Swiften/SConscript b/Swiften/SConscript index 8a2972a..46b901b 100644 --- a/Swiften/SConscript +++ b/Swiften/SConscript @@ -1,4 +1,4 @@ -import os +import os, re, Version Import("env") @@ -9,9 +9,19 @@ Import("env") swiften_dep_modules = ["BOOST", "LIBIDN", "ZLIB", "OPENSSL", "LIBXML", "EXPAT", "AVAHI"] if env["SCONS_STAGE"] == "flags" : + env["SWIFTEN_VERSION"] = Version.getBuildVersion(env.Dir("#").abspath, "swift") + version_match = re.match("(\d+)\.(\d+).*", env["SWIFTEN_VERSION"]) + if version_match : + env["SWIFTEN_VERSION_MAJOR"] = int(version_match.group(1)) + env["SWIFTEN_VERSION_MINOR"] = int(version_match.group(2)) + else : + env["SWIFTEN_VERSION_MAJOR"] = 0 + env["SWIFTEN_VERSION_MINOR"] = 0 + env["SWIFTEN_VERSION_PATCH"] = 0 + swiften_env = env.Clone() swiften_env["LIBPATH"] = [Dir(".")] - swiften_env["LIBS"] = ["Swiften"] + swiften_env["LIBS"] = ["Swiften" + str(swiften_env["SWIFTEN_VERSION_MAJOR"])] dep_env = env.Clone() for module in swiften_dep_modules : if env.get(module + "_BUNDLED", False) : @@ -178,9 +188,9 @@ if env["SCONS_STAGE"] == "build" : ]) if ARGUMENTS.get("swiften_dll", False) : - swiften_lib = myenv.SharedLibrary("Swiften", sources + swiften_env["SWIFTEN_OBJECTS"]) + swiften_lib = myenv.SharedLibrary("Swiften" + str(swiften_env["SWIFTEN_VERSION_MAJOR"]), sources + swiften_env["SWIFTEN_OBJECTS"]) else : - swiften_lib = myenv.StaticLibrary("Swiften", sources + swiften_env["SWIFTEN_OBJECTS"]) + swiften_lib = myenv.StaticLibrary("Swiften" + str(swiften_env["SWIFTEN_VERSION_MAJOR"]), sources + swiften_env["SWIFTEN_OBJECTS"]) env.Append(UNITTEST_SOURCES = [ File("Avatars/UnitTest/VCardUpdateAvatarManagerTest.cpp"), @@ -328,6 +338,11 @@ if env["SCONS_STAGE"] == "build" : swiften_env.WriteVal("Swiften.h", swiften_env.Value(swiften_header)) swiften_includes.append("Swiften/Swiften.h") + version_header = "#pragma once\n\n" + version_header += "#define SWIFTEN_VERSION 0x%02X%02X%02X\n" % (swiften_env["SWIFTEN_VERSION_MAJOR"], swiften_env["SWIFTEN_VERSION_MINOR"], swiften_env["SWIFTEN_VERSION_PATCH"]) + swiften_env.WriteVal("Version.h", swiften_env.Value(version_header)) + swiften_includes.append("Swiften/Version.h") + # Install swiften if swiften_env.get("SWIFTEN_INSTALLDIR", "") : swiften_env.Install(os.path.join(swiften_env["SWIFTEN_INSTALLDIR"], "lib"), swiften_lib) |