From 48389cafdbf211d70fa56f453c6d3b652482a139 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Remko=20Tron=C3=A7on?= <git@el-tramo.be>
Date: Tue, 1 Mar 2011 21:29:51 +0100
Subject: Fixed linking order.


diff --git a/Sluift/SConscript b/Sluift/SConscript
index 816c234..eeb2f24 100644
--- a/Sluift/SConscript
+++ b/Sluift/SConscript
@@ -1,7 +1,16 @@
 Import(["env", "conf_env"])
 
 if env["SCONS_STAGE"] == "build" :
+	lib_env = env.Clone()
+	lib_env.UseFlags(env["LUA_FLAGS"])
+	lib_env.UseFlags(env["SWIFTEN_FLAGS"])
+	lib_env.UseFlags(env["SWIFTEN_DEP_FLAGS"])
+	sluift_lib = lib_env.StaticLibrary("SluiftCore", [
+			"sluift.cpp"
+		]);
+
 	myenv = env.Clone()
+	myenv.Append(LIBS = sluift_lib)
 	myenv.UseFlags(env["LUA_FLAGS"])
 	myenv.UseFlags(env["SWIFTEN_FLAGS"])
 	myenv.UseFlags(env["SWIFTEN_DEP_FLAGS"])
@@ -11,10 +20,6 @@ if env["SCONS_STAGE"] == "build" :
 	elif myenv["PLATFORM"] == "darwin" :
 		myenv["SHLIBSUFFIX"] = ".so"
 
-	sluift_lib = myenv.StaticLibrary("SluiftCore", [
-			"sluift.cpp"
-		]);
-
 	def patchLua(env, target, source) :
 		f = open(source[0].abspath, "r")
 		contents = f.read()
@@ -25,17 +30,13 @@ if env["SCONS_STAGE"] == "build" :
 		f.write(contents)
 		f.close()
 
-	sluift_bin_env = myenv.Clone()
-	sluift_bin_env.Append(LIBS = sluift_lib)
-	sluift_bin_env.Command("lua.c", ["#/3rdParty/Lua/src/lua.c"], env.Action(patchLua, cmdstr = "$GENCOMSTR"))
-	if sluift_bin_env.get("HAVE_READLINE", False) :
-		sluift_bin_env.Append(CPPDEFINES = ["LUA_USE_READLINE"])
-		sluift_bin_env.MergeFlags(sluift_bin_env["READLINE_FLAGS"])
-	env["SLUIFT"] = sluift_bin_env.Program("sluift", [
+	myenv.Command("lua.c", ["#/3rdParty/Lua/src/lua.c"], env.Action(patchLua, cmdstr = "$GENCOMSTR"))
+	if myenv.get("HAVE_READLINE", False) :
+		myenv.Append(CPPDEFINES = ["LUA_USE_READLINE"])
+		myenv.MergeFlags(myenv["READLINE_FLAGS"])
+	env["SLUIFT"] = myenv.Program("sluift", [
 			"lua.c",
 			"linit.c",
 		])
 
-	sluift_dll_env = myenv.Clone()
-	sluift_dll_env.Append(LIBS = sluift_lib)
-	sluift_dll_env.SharedLibrary("sluift", []);
+	myenv.SharedLibrary("sluift", []);
-- 
cgit v0.10.2-6-g49f6