summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2013-03-30 09:14:43 (GMT)
committerKevin Smith <git@kismith.co.uk>2013-03-30 11:46:04 (GMT)
commit2d7a63e9323f03edd72668f582e894ab64ab4023 (patch)
tree97a52c423ef831e560e55628a07d9db9c8935f49
parent497b647fe034a3d2cdc6d75ce0ff70e3df3aaf04 (diff)
downloadswift-2d7a63e9323f03edd72668f582e894ab64ab4023.zip
swift-2d7a63e9323f03edd72668f582e894ab64ab4023.tar.bz2
Making stuff build against non-bundled libraries
Change-Id: I2c00de607e204f7d2c474aa9d4c18cde86d575ec
-rw-r--r--BuildTools/SCons/SConscript.boot6
-rw-r--r--BuildTools/SCons/SConstruct48
-rw-r--r--Swift/Packaging/Debian/debian/control.in2
-rwxr-xr-xSwift/Packaging/Debian/package.sh4
-rw-r--r--Swiften/Base/Paths.cpp2
5 files changed, 44 insertions, 18 deletions
diff --git a/BuildTools/SCons/SConscript.boot b/BuildTools/SCons/SConscript.boot
index 3e9e48c..97a4387 100644
--- a/BuildTools/SCons/SConscript.boot
+++ b/BuildTools/SCons/SConscript.boot
@@ -48,6 +48,12 @@ vars.Add(PackageVariable("icu", "ICU library location", "no"))
vars.Add(PathVariable("libidn_includedir", "LibIDN headers location", None, PathVariable.PathAccept))
vars.Add(PathVariable("libidn_libdir", "LibIDN library location", None, PathVariable.PathAccept))
vars.Add("libidn_libname", "LibIDN library name", "libidn" if os.name == "nt" else "idn")
+vars.Add(PathVariable("libminiupnpc_includedir", "LibMiniUPNPC headers location", None, PathVariable.PathAccept))
+vars.Add(PathVariable("libminiupnpc_libdir", "LibMiniUPNPC library location", None, PathVariable.PathAccept))
+vars.Add("libminiupnpc_libname", "LibMiniUPNPC library name", "libminiupnpc" if os.name == "nt" else "miniupnpc")
+vars.Add(PathVariable("libnatpmp_includedir", "LibNATPMP headers location", None, PathVariable.PathAccept))
+vars.Add(PathVariable("libnatpmp_libdir", "LibNATPMP library location", None, PathVariable.PathAccept))
+vars.Add("libnatpmp_libname", "LibNATPMP library name", "libnatpmp" if os.name == "nt" else "natpmp")
vars.Add(PathVariable("sqlite_includedir", "SQLite headers location", None, PathVariable.PathAccept))
vars.Add(PathVariable("sqlite_libdir", "SQLite library location", None, PathVariable.PathAccept))
vars.Add("sqlite_libname", "SQLite library name", "libsqlite3" if os.name == "nt" else "sqlite3")
diff --git a/BuildTools/SCons/SConstruct b/BuildTools/SCons/SConstruct
index 698217f..1de598f 100644
--- a/BuildTools/SCons/SConstruct
+++ b/BuildTools/SCons/SConstruct
@@ -335,25 +335,45 @@ if not env.get("HAVE_ICU", False) and not env.get("HAVE_LIBIDN", False) :
# LibMiniUPnPc
if env["experimental"] :
- #libminiupnpc_conf_env = conf_env.Clone()
- #conf = Configure(libminiupnpc_conf_env)
- #if conf.CheckCHeader("miniupnpc.h") and conf.CheckLib(env["libminiupnpc_libname"]) :
- # print "NOT IMPLEMENTED YET"
- #else :
- env["LIBMINIUPNPC_BUNDLED"] = 1
- #conf.Finish()
+ libminiupnpc_flags = {"CPPPATH": ["/usr/include/miniupnpc/"]}
+ libminiupnpc_conf_env = conf_env.Clone()
+ if env.get("libminiupnpc_libdir", None) :
+ libminiupnpc_flags["LIBPATH"] = [env["libminiupnpc_libdir"]]
+ if env.get("libminiupnpc_includedir", None) :
+ libminiupnpc_flags["CPPPATH"] = [env["libminiupnpc_includedir"]]
+ libminiupnpc_conf_env.MergeFlags(libminiupnpc_flags)
+ conf = Configure(libminiupnpc_conf_env)
+ if conf.CheckCHeader("miniupnpc.h") and conf.CheckLib(env["libminiupnpc_libname"]) and False :
+ # ^ False because APIs aren't stable
+ env["HAVE_LIBMINIUPNPC"] = 1
+ env["LIBMINIUPNPC_FLAGS"] = { "LIBS": ["miniupnpc"] }
+ env["LIBMINIUPNPC_FLAGS"].update(libminiupnpc_flags)
+ else :
+ env["HAVE_LIBMINIUPNPC"] = 1
+ env["LIBMINIUPNPC_BUNDLED"] = 1
+ conf.Finish()
else :
env["LIBMINIUPNPC_FLAGS"] = {}
# LibNATPMP
if env["experimental"] :
- #libnatpmp_conf_env = conf_env.Clone()
- #conf = Configure(libnatpmp_conf_env)
- #if conf.CheckCHeader("natpmp.h") and conf.CheckLib(env["libnatpmp_libname"]) :
- # print "NOT IMPLEMENTED YET"
- #else :
- env["LIBNATPMP_BUNDLED"] = 1
- #conf.Finish()
+ libnatpmp_flags = {}
+ libnatpmp_conf_env = conf_env.Clone()
+ if env.get("libnatpmp_libdir", None) :
+ libnatpmp_flags["LIBPATH"] = [env["libnatpmp_libdir"]]
+ if env.get("libnatpmp_includedir", None) :
+ libnatpmp_flags["CPPPATH"] = [env["libnatpmp_includedir"]]
+ libnatpmp_conf_env.MergeFlags(libnatpmp_flags)
+ conf = Configure(libnatpmp_conf_env)
+ if conf.CheckCHeader("natpmp.h") and conf.CheckLib(env["libnatpmp_libname"]) and False:
+ # ^ False because APIs aren't stable
+ env["HAVE_LIBNATPMP"] = 1
+ env["LIBNATPMP_FLAGS"] = { "LIBS": ["natpmp"] }
+ env["LIBNATPMP_FLAGS"].update(libnatpmp_flags)
+ else :
+ env["HAVE_LIBNATPMP"] = 1
+ env["LIBNATPMP_BUNDLED"] = 1
+ conf.Finish()
else :
env["LIBNATPMP_FLAGS"] = {}
diff --git a/Swift/Packaging/Debian/debian/control.in b/Swift/Packaging/Debian/debian/control.in
index c42d1d0..dd7be88 100644
--- a/Swift/Packaging/Debian/debian/control.in
+++ b/Swift/Packaging/Debian/debian/control.in
@@ -3,7 +3,7 @@ Section: net
Priority: optional
Maintainer: Swift Package Maintainer <packages@swift.im>
Uploaders: Remko Tronçon <dev@el-tramo.be>, Kevin Smith <kevin@kismith.co.uk>
-Build-Depends: debhelper (>= 7), scons (>= 1.2.0), libssl-dev (>= 0.9.8g), libqt4-dev (>= 4.5.0), libxml2-dev (>= 2.7.6), libxss-dev (>= 1.2.0), libboost-dev (>= 1.34.1), libboost-filesystem-dev (>= 1.34.1), libboost-program-options-dev (>= 1.34.1), libboost-regex-dev (>= 1.34.1), libboost-signals-dev (>= 1.34.1), libboost-system-dev (>= 1.34.1), libboost-thread-dev (>= 1.34.1), libboost-date-time-dev (>= 1.34.1), libidn11-dev (>= 1.10), docbook-xsl (>= 1.75.0), docbook-xml (>= 4.5), xsltproc, libxml2-utils %WEBKIT_DEPENDENCY%
+Build-Depends: debhelper (>= 7), scons (>= 1.2.0), libssl-dev (>= 0.9.8g), libqt4-dev (>= 4.5.0), libxml2-dev (>= 2.7.6), libxss-dev (>= 1.2.0), libboost-dev (>= 1.34.1), libboost-filesystem-dev (>= 1.34.1), libboost-program-options-dev (>= 1.34.1), libboost-regex-dev (>= 1.34.1), libboost-signals-dev (>= 1.34.1), libboost-system-dev (>= 1.34.1), libboost-thread-dev (>= 1.34.1), libboost-date-time-dev (>= 1.34.1), libidn11-dev (>= 1.10), docbook-xsl (>= 1.75.0), docbook-xml (>= 4.5), xsltproc, libxml2-utils, libhunspell-dev, libnatpmp-dev, libminiupnpc-dev, libsqlite3-dev %WEBKIT_DEPENDENCY%
Standards-Version: 3.9.3
Vcs-Git: git://swift.im/swift
Vcs-Browser: http://swift.im/git/swift
diff --git a/Swift/Packaging/Debian/package.sh b/Swift/Packaging/Debian/package.sh
index d4b6484..8c7c89f 100755
--- a/Swift/Packaging/Debian/package.sh
+++ b/Swift/Packaging/Debian/package.sh
@@ -50,9 +50,9 @@ else
rm -rf $DIRNAME/.git
find $DIRNAME -name .gitignore | xargs rm -f
if [ -z "$SWIFT_COPY_UUID" ]; then
- find $DIRNAME/3rdParty -type f | grep -v SConscript | xargs rm -f
+ find $DIRNAME/3rdParty -type f | grep -v SConscript | grep -v miniupnp | grep -v natpmp |xargs rm -f
else
- find $DIRNAME/3rdParty -type f | grep -v uuid | grep -v SConscript | xargs rm -f
+ find $DIRNAME/3rdParty -type f | grep -v uuid | grep -v SConscript | grep -v miniupnp | grep -v natpmp || xargs rm -f
fi
find $DIRNAME/3rdParty -depth -empty -type d -exec rmdir {} \;
rm -rf $DIRNAME/3rdParty/SCons
diff --git a/Swiften/Base/Paths.cpp b/Swiften/Base/Paths.cpp
index edebc30..d434cc1 100644
--- a/Swiften/Base/Paths.cpp
+++ b/Swiften/Base/Paths.cpp
@@ -30,7 +30,7 @@ boost::filesystem::path Paths::getExecutablePath() {
#elif defined(SWIFTEN_PLATFORM_LINUX)
ByteArray path;
path.resize(4096);
- ssize_t size = readlink("/proc/self/exe", reinterpret_cast<char*>(vecptr(path)), path.size());
+ size_t size = static_cast<size_t>(readlink("/proc/self/exe", reinterpret_cast<char*>(vecptr(path)), path.size()));
if (size > 0) {
path.resize(size);
return boost::filesystem::path(std::string(reinterpret_cast<const char*>(vecptr(path)), path.size()).c_str()).parent_path();