From 534a87a59c15de5024fbf58a11225f17c683f76c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Remko=20Tron=C3=A7on?= <git@el-tramo.be>
Date: Sat, 14 Sep 2013 10:17:17 +0200
Subject: Install Sluift

Change-Id: Ia08269b51528b4458418939e5478cb320f4ba40d

diff --git a/BuildTools/SCons/SConscript.boot b/BuildTools/SCons/SConscript.boot
index b0e14ee..4e7e037 100644
--- a/BuildTools/SCons/SConscript.boot
+++ b/BuildTools/SCons/SConscript.boot
@@ -308,7 +308,7 @@ env["TEST_CREATE_LIBRARIES"] = "create_test_libraries" in ARGUMENTS
 
 # Packaging
 env["DIST"] = "dist" in ARGUMENTS or env.GetOption("clean")
-for path in ["SWIFT_INSTALLDIR", "SWIFTEN_INSTALLDIR"] :
+for path in ["SWIFT_INSTALLDIR", "SWIFTEN_INSTALLDIR", "SLUIFT_INSTALLDIR"] :
 	if ARGUMENTS.get(path, "") :
 		if os.path.isabs(ARGUMENTS[path]) :
 			env[path] = Dir(ARGUMENTS[path]).abspath
diff --git a/Sluift/SConscript b/Sluift/SConscript
index c4d3b28..5d2242e 100644
--- a/Sluift/SConscript
+++ b/Sluift/SConscript
@@ -41,11 +41,8 @@ elif env["SCONS_STAGE"] == "build" :
 	sluift_env.UseFlags(env.get("LUA_FLAGS", {}))
 	sluift_env.UseFlags(env["SWIFTEN_FLAGS"])
 	sluift_env.UseFlags(env["SWIFTEN_DEP_FLAGS"])
-	sluift_env["SHLIBPREFIX"] = ""
 	if sluift_env["PLATFORM"] == "win32" :
 		sluift_env.Append(CPPDEFINES = ["SLUIFT_BUILD_DLL"])
-	elif sluift_env["PLATFORM"] == "darwin" :
-		sluift_env["SHLIBSUFFIX"] = ".so"
 
 	# Generate a customized lua.c
 	sluift_env["SLUIFT_VERSION"] = Version.getBuildVersion(env.Dir("#").abspath, "sluift")
@@ -85,4 +82,3 @@ elif env["SCONS_STAGE"] == "build" :
 		SConscript(["SConscript.variant"], variant_dir = sluift_variant,
 				duplicate = 0,
 				exports = ['sluift_sources', 'sluift_variant', 'sluift_env'])
-
diff --git a/Sluift/SConscript.variant b/Sluift/SConscript.variant
index bf5d85e..92ee493 100644
--- a/Sluift/SConscript.variant
+++ b/Sluift/SConscript.variant
@@ -1,3 +1,5 @@
+import os
+
 Import('env')
 Import('sluift_env')
 Import('sluift_variant')
@@ -8,7 +10,16 @@ if sluift_variant == 'exe' :
 		"#/Sluift/lua.c",
 		"#/Sluift/linit.c",
 	])
+	if sluift_env.get("SLUIFT_INSTALLDIR", "") :
+		sluift_env.Install(os.path.join(sluift_env["SLUIFT_INSTALLDIR"], "bin"), env["SLUIFT"])
 else :
-	sluift_env.SharedLibrary("sluift", sluift_sources + [
-		"#/Sluift/dll.c"
-	])
+	sluift_env["SLUIFT_DLL_SUFFIX"] = "${SHLIBSUFFIX}"
+	if sluift_env["PLATFORM"] == "darwin" :
+		sluift_env["SLUIFT_DLL_SUFFIX"] = ".so"
+	sluift_dll = sluift_env.SharedLibrary(sluift_env.File("sluift${SLUIFT_DLL_SUFFIX}"), 
+			sluift_sources + ["#/Sluift/dll.c"])
+	if sluift_env.get("SLUIFT_INSTALLDIR", False) and sluift_env.get("LUA_VERSION", False) :
+		sluift_env.Install(
+				os.path.join(sluift_env["SLUIFT_INSTALLDIR"], "lib", "lua", sluift_env["LUA_VERSION"]), 
+				sluift_dll)
+
-- 
cgit v0.10.2-6-g49f6