From d9c8d48677df0f0dffb9c1f2cb35542cb59a27c8 Mon Sep 17 00:00:00 2001
From: Dennis Schridde <devurandom@gmx.net>
Date: Sat, 23 Sep 2017 00:40:40 +0200
Subject: Allow to override Swiften libdir

The libdir for Swiften was hardcoded to "lib". With this patch it is possible
 to override it.

License:
This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for
 details.

Test-Information:
Build with SWIFTEN_LIBDIR=lib64 and observe that files are installed into the
 desired directory (i.e. /usr/lib64, if SWIFTEN_INSTALLDIR=/usr).

Change-Id: I4d844b93a189254b5923f9cd58190b0f6a65b9ac

diff --git a/BuildTools/SCons/SConscript.boot b/BuildTools/SCons/SConscript.boot
index 6ac4981..d9678a5 100644
--- a/BuildTools/SCons/SConscript.boot
+++ b/BuildTools/SCons/SConscript.boot
@@ -425,6 +425,8 @@ for path in ["SWIFT_INSTALLDIR", "SWIFTEN_INSTALLDIR", "SLUIFT_INSTALLDIR"] :
             env[path] = Dir(ARGUMENTS[path]).abspath
         else :
             env[path] = Dir("#/" + ARGUMENTS[path]).abspath
+if ARGUMENTS.get("SWIFTEN_LIBDIR", "") :
+    env["SWIFTEN_LIBDIR"] = ARGUMENTS["SWIFTEN_LIBDIR"]
 
 
 ################################################################################
diff --git a/Swiften/SConscript b/Swiften/SConscript
index e0f87ce..f52637b 100644
--- a/Swiften/SConscript
+++ b/Swiften/SConscript
@@ -618,8 +618,9 @@ if env["SCONS_STAGE"] == "build" :
 
     # Install swiften
     if swiften_env.get("SWIFTEN_INSTALLDIR", "") :
-        swiften_env.Install(os.path.join(swiften_env["SWIFTEN_INSTALLDIR"], "lib"), swiften_lib)
+        swiften_libdir = swiften_env.get("SWIFTEN_LIBDIR", "lib")
+        swiften_env.Install(os.path.join(swiften_env["SWIFTEN_INSTALLDIR"], swiften_libdir), swiften_lib)
         for alias in myenv["SWIFTEN_LIBRARY_ALIASES"] :
-            myenv.Command(myenv.File(os.path.join(swiften_env["SWIFTEN_INSTALLDIR"], "lib", alias)), [env.Value(swiften_lib[0].name), swiften_lib[0]], symlink)
+            myenv.Command(myenv.File(os.path.join(swiften_env["SWIFTEN_INSTALLDIR"], swiften_libdir, alias)), [env.Value(swiften_lib[0].name), swiften_lib[0]], symlink)
         for include in swiften_includes :
             swiften_env.Install(os.path.join(swiften_env["SWIFTEN_INSTALLDIR"], "include", os.path.dirname(include)), "#/" + include)
-- 
cgit v0.10.2-6-g49f6