summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2011-04-29 21:36:05 (GMT)
committerRemko Tronçon <git@el-tramo.be>2011-04-29 21:36:05 (GMT)
commitfa41e2adea4ddbb2eb0d05cbfa0dec7e290d55d5 (patch)
treecb23841b9c569acc513c9e0971f775365c48b7ae /Swiften/SConscript
parent0ad85cdec57d49b697215103cc73463eacc76eb5 (diff)
parent27042edc19e393b24e7953c668a7cec820b710d8 (diff)
downloadswift-fa41e2adea4ddbb2eb0d05cbfa0dec7e290d55d5.zip
swift-fa41e2adea4ddbb2eb0d05cbfa0dec7e290d55d5.tar.bz2
Merge branch 'swift-1.x'
* swift-1.x: Build Swiften as a DLL in Debian package. Added versioning to Swiften. Conflicts: BuildTools/Copyrighter.py
Diffstat (limited to 'Swiften/SConscript')
-rw-r--r--Swiften/SConscript23
1 files changed, 19 insertions, 4 deletions
diff --git a/Swiften/SConscript b/Swiften/SConscript
index 41de5b5..53f9201 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", "GCONF", "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) :
@@ -198,9 +208,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"),
@@ -354,6 +364,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)