summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2011-03-16 20:26:53 (GMT)
committerRemko Tronçon <git@el-tramo.be>2011-03-16 20:26:53 (GMT)
commit2feadc01a56269094e6c533ca23b4357b65ab2a9 (patch)
tree6ad254cfbdce462df5bcb7baab0000a1b1e0fafb
parentc019d185626f6e9220f139a6e0d5543d1fc97f09 (diff)
downloadswift-2feadc01a56269094e6c533ca23b4357b65ab2a9.zip
swift-2feadc01a56269094e6c533ca23b4357b65ab2a9.tar.bz2
Some more Swiften packaging improvements & fixes.
-rw-r--r--BuildTools/SCons/SConstruct2
-rw-r--r--Swiften/Config/.gitignore1
-rw-r--r--Swiften/Config/SConscript4
-rw-r--r--Swiften/Config/swiften-config.cpp21
-rw-r--r--Swiften/SConscript1
5 files changed, 19 insertions, 10 deletions
diff --git a/BuildTools/SCons/SConstruct b/BuildTools/SCons/SConstruct
index 6f1b6eb..86f4cda 100644
--- a/BuildTools/SCons/SConstruct
+++ b/BuildTools/SCons/SConstruct
@@ -209,7 +209,7 @@ env["TEST_IGNORE_RESULT"] = "ignore_test_result" in ARGUMENTS
env["DIST"] = "dist" in ARGUMENTS or env.GetOption("clean")
for path in ["SWIFT_INSTALLDIR", "SWIFTEN_INSTALLDIR"] :
if ARGUMENTS.get(path, "") :
- if os.path.isabs(path) :
+ if os.path.isabs(ARGUMENTS[path]) :
env[path] = Dir(ARGUMENTS[path]).abspath
else :
env[path] = Dir("#/" + ARGUMENTS[path]).abspath
diff --git a/Swiften/Config/.gitignore b/Swiften/Config/.gitignore
index 4514b26..2ae0953 100644
--- a/Swiften/Config/.gitignore
+++ b/Swiften/Config/.gitignore
@@ -1,2 +1,3 @@
swiften-config
swiften-config.h
+Paths.cpp
diff --git a/Swiften/Config/SConscript b/Swiften/Config/SConscript
index 933e4a3..357a5e6 100644
--- a/Swiften/Config/SConscript
+++ b/Swiften/Config/SConscript
@@ -27,11 +27,13 @@ libflags = replaceSwiftenPath(" ".join([swiften_env.subst("$_LIBDIRFLAGS"), swif
config_flags += cStringVariable(swiften_env, "LIBFLAGS", libflags)
config_env = env.Clone()
-config_env.MergeFlags(config_env["SWIFTEN_FLAGS"])
+# Create a local copy of Paths.cpp to avoid a Swiften dependency
+config_env.Install(".", "#/Swiften/Base/Paths.cpp")
config_env.MergeFlags(config_env["BOOST_FLAGS"])
config_env.MergeFlags(config_env["PLATFORM_FLAGS"])
config_env.WriteVal("swiften-config.h", config_env.Value(config_flags))
swiften_config = config_env.Program("swiften-config", [
+ "Paths.cpp",
"swiften-config.cpp"
])
diff --git a/Swiften/Config/swiften-config.cpp b/Swiften/Config/swiften-config.cpp
index d381faa..b3875cb 100644
--- a/Swiften/Config/swiften-config.cpp
+++ b/Swiften/Config/swiften-config.cpp
@@ -6,16 +6,15 @@
#include <iostream>
+#include <boost/algorithm/string.hpp>
#include <boost/program_options/options_description.hpp>
#include <boost/program_options/variables_map.hpp>
#include <boost/program_options.hpp>
#include <boost/version.hpp>
#include <string>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Base/Platform.h>
#include <Swiften/Base/Paths.h>
-#include <Swiften/Base/String.h>
#include "swiften-config.h"
@@ -72,28 +71,34 @@ int main(int argc, char* argv[]) {
// Detect whether we're running in-place or not
boost::filesystem::path executablePath = Paths::getExecutablePath();
- boost::filesystem::path topPath = executablePath / ".." / "..";
- bool inPlace = true;
+ boost::filesystem::path topSourcePath = executablePath / ".." / "..";
+ boost::filesystem::path topInstallPath = executablePath / "..";
+ bool inPlace = !boost::filesystem::exists(topInstallPath / "include" / "Swiften" / "Swiften.h");
// Replace "#" variables with the correct path
for(size_t i = 0; i < libs.size(); ++i) {
if (inPlace) {
std::string lib = libs[i];
- String::replaceAll(lib, '#', topPath.string());
+ boost::replace_all(lib, "#", topSourcePath.string());
libs[i] = lib;
}
else {
- // TODO
+ std::string lib = libs[i];
+ boost::replace_all(lib, "#", (topInstallPath / "lib").string());
+ boost::erase_all(lib, "/Swiften");
+ libs[i] = lib;
}
}
for(size_t i = 0; i < cflags.size(); ++i) {
if (inPlace) {
std::string cflag = cflags[i];
- String::replaceAll(cflag, '#', topPath.string());
+ boost::replace_all(cflag, "#", topSourcePath.string());
cflags[i] = cflag;
}
else {
- // TODO
+ std::string cflag = cflags[i];
+ boost::replace_all(cflag, "#", (topInstallPath / "include").string());
+ cflags[i] = cflag;
}
}
diff --git a/Swiften/SConscript b/Swiften/SConscript
index 7b762d6..8a2972a 100644
--- a/Swiften/SConscript
+++ b/Swiften/SConscript
@@ -326,6 +326,7 @@ if env["SCONS_STAGE"] == "build" :
swiften_header += "#include <Swiften/" + file + ">\n"
swiften_includes.append("Swiften/" + file)
swiften_env.WriteVal("Swiften.h", swiften_env.Value(swiften_header))
+ swiften_includes.append("Swiften/Swiften.h")
# Install swiften
if swiften_env.get("SWIFTEN_INSTALLDIR", "") :