summaryrefslogtreecommitdiffstats
blob: cd650615fee0eea0baf785ea0212ad7a25bff47e (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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
Import(["env", "conf_env"])

if env.get("LUA_BUNDLED", False) :

################################################################################
# Module flags
################################################################################

	if env["SCONS_STAGE"] == "flags" :
		cppdefines = []
		if not env["optimize"] :
			cppdefines.append("LUA_USE_APICHECK")
		if env["PLATFORM"] == "win32" :
			pass
		elif env["PLATFORM"] == "darwin" :
			cppdefines += ["LUA_USE_POSIX", "LUA_USE_DLOPEN"]
		else :
			cppdefines += ["LUA_USE_POSIX", "LUA_USE_DLOPEN"]

		env["LUA_FLAGS"] = {
				"CPPDEFINES": cppdefines,
				"CPPPATH": [Dir("src")],
				"LIBPATH": [Dir(".")],
				"LIBS": ["Swiften_Lua"],
			}

################################################################################
# Build
################################################################################

	if env["SCONS_STAGE"] == "build" :
		myenv = env.Clone()

		# Remove warn flags
		myenv.Replace(CCFLAGS = [flag for flag in env["CCFLAGS"] if flag not in ["-W", "-Wall"]])
		myenv.MergeFlags(myenv["LUA_FLAGS"])
		myenv.MergeFlags(myenv["PLATFORM_FLAGS"])
		myenv.StaticLibrary("Swiften_Lua", [
			"src/lapi.c",
			"src/lcode.c",
			"src/ldebug.c",
			"src/ldo.c",
			"src/ldump.c",
			"src/lfunc.c",
			"src/lgc.c",
			"src/llex.c",
			"src/lmem.c",
			"src/lobject.c",
			"src/lopcodes.c",
			"src/lparser.c",
			"src/lstate.c",
			"src/lstring.c",
			"src/ltable.c",
			"src/ltm.c",
			"src/lundump.c",
			"src/lvm.c",
			"src/lzio.c",
			"src/lauxlib.c",
			"src/lbaselib.c",
			"src/ldblib.c",
			"src/liolib.c",
			"src/lmathlib.c",
			"src/loslib.c",
			"src/ltablib.c",
			"src/lstrlib.c",
			"src/loadlib.c",
		])

		lua_env = myenv.Clone()
		lua_env.MergeFlags(lua_env["LUA_FLAGS"])
		lua_env.Program("lua", [
				"src/linit.c",
				"src/lua.c",
			])