Install LuaJIT manually

This commit is contained in:
mpeterv 2015-12-05 22:45:51 +03:00
parent 62f94dab1b
commit b017fbc4be

View File

@ -141,6 +141,12 @@ def copy_files(path, *files):
if src is not None: if src is not None:
shutil.copy(src, path) shutil.copy(src, path)
def exe(name):
if os.name == "nt":
return name + ".exe"
else:
return name
class Program(object): class Program(object):
def __init__(self, version): def __init__(self, version):
version = self.translations.get(version, version) version = self.translations.get(version, version)
@ -460,17 +466,17 @@ class RioLua(Lua):
self.defines.append("#define LUA_COMPAT_5_1") self.defines.append("#define LUA_COMPAT_5_1")
def set_files(self): def set_files(self):
self.lua_file = "lua" self.lua_file = exe("lua")
self.luac_file = "luac" self.luac_file = exe("luac")
self.arch_file = "liblua.a" self.arch_file = "liblua.a"
self.dll_file = None self.dll_file = None
if opts.target == "mingw": if os.name == "nt":
self.lua_file += ".exe"
self.luac_file += ".exe"
self.arch_file = "liblua5" + self.major_version[2] + ".a"
self.dll_file = "lua5" + self.major_version[2] + ".dll" self.dll_file = "lua5" + self.major_version[2] + ".dll"
if opts.target == "cl":
self.arch_file = None
@staticmethod @staticmethod
def make(): def make():
run_command("make", opts.target) run_command("make", opts.target)
@ -488,6 +494,7 @@ class RioLua(Lua):
copy_files(os.path.join(opts.location, "include"), copy_files(os.path.join(opts.location, "include"),
"lua.h", "luaconf.h", "lualib.h", "lauxlib.h", lua_hpp) "lua.h", "luaconf.h", "lualib.h", "lauxlib.h", lua_hpp)
copy_files(os.path.join(opts.location, "lib"), self.arch_file) copy_files(os.path.join(opts.location, "lib"), self.arch_file)
class LuaJIT(Lua): class LuaJIT(Lua):
@ -527,14 +534,34 @@ class LuaJIT(Lua):
run_command("make", "PREFIX=" + quote(opts.location)) run_command("make", "PREFIX=" + quote(opts.location))
def make_install(self): def make_install(self):
run_command("make install", "PREFIX=" + quote(opts.location), luajit_file = exe("luajit")
"INSTALL_TNAME=lua", "INSTALL_TSYM=luajit_symlink", lua_file = exe("lua")
"INSTALL_LJLIBD=" + quote(os.path.join( arch_file = "libluajit.a"
opts.location, "share", "lua", self.major_version)), target_arch_file = "liblua.a"
"INSTALL_INC=" + quote(os.path.join(opts.location, "include"))) self.dll_file = None
if os.path.exists(os.path.join(opts.location, "bin", "luajit_symlink")): if os.name == "nt":
os.remove(os.path.join(opts.location, "bin", "luajit_symlink")) self.arch_file = "lua51.lib"
target_arch_file = "lua51.lib"
self.dll_file = "lua51.dll"
os.chdir("src")
copy_files(os.path.join(opts.location, "bin"), self.dll_file)
shutil.copy(luajit_file, os.path.join(opts.location, "bin", lua_file))
copy_files(os.path.join(opts.location, "include"),
"lua.h", "luaconf.h", "lualib.h", "lauxlib.h", "lua.hpp")
copy_files(os.path.join(opts.location, "lib"))
shutil.copy(arch_file, os.path.join(opts.location, target_arch_file))
jitlib_path = os.path.join(
opts.location, "share", "lua", self.major_version, "jit")
if os.path.exists(jitlib_path):
shutil.rmtree(jitlib_path)
copy_dir("jit", jitlib_path)
class LuaRocks(Program): class LuaRocks(Program):
name = "luarocks" name = "luarocks"