summaryrefslogtreecommitdiffstats
blob: 816c234d9a440adc985b52a38f7ee8c555be1b77 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
Import(["env", "conf_env"])

if env["SCONS_STAGE"] == "build" :
	myenv = env.Clone()
	myenv.UseFlags(env["LUA_FLAGS"])
	myenv.UseFlags(env["SWIFTEN_FLAGS"])
	myenv.UseFlags(env["SWIFTEN_DEP_FLAGS"])
	myenv["SHLIBPREFIX"] = ""
	if myenv["PLATFORM"] == "win32" :
		myenv.Append(CPPDEFINES = ["SLUIFT_BUILD_DLL"])
	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()
		f.close()
		contents = contents.replace("LUA_RELEASE", "\"== Sluift XMPP Console ==\"")
		contents = contents.replace("LUA_COPYRIGHT", "")
		f = open(target[0].abspath, "w")
		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", [
			"lua.c",
			"linit.c",
		])

	sluift_dll_env = myenv.Clone()
	sluift_dll_env.Append(LIBS = sluift_lib)
	sluift_dll_env.SharedLibrary("sluift", []);