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"]) myenv["SHLIBPREFIX"] = "" if myenv["PLATFORM"] == "win32" : myenv.Append(CPPDEFINES = ["SLUIFT_BUILD_DLL"]) elif myenv["PLATFORM"] == "darwin" : myenv["SHLIBSUFFIX"] = ".so" 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() 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", ]) myenv.SharedLibrary("sluift", []);