From d25d70512faf81a4fe2c6764e771ee3290f88a37 Mon Sep 17 00:00:00 2001 From: George Roman <30772943+georgeroman@users.noreply.github.com> Date: Tue, 5 Jun 2018 17:36:57 +0300 Subject: build.builtin: Remove EXEWRAPPER sections (#812) --- src/luarocks/build/builtin.lua | 84 +----------------------------------------- 1 file changed, 1 insertion(+), 83 deletions(-) (limited to 'src') diff --git a/src/luarocks/build/builtin.lua b/src/luarocks/build/builtin.lua index 68fb75ed..e8b0943d 100644 --- a/src/luarocks/build/builtin.lua +++ b/src/luarocks/build/builtin.lua @@ -18,38 +18,13 @@ local function execute(...) return fs.execute(...) end ---- Makes an RC file with an embedded Lua script, for building .exes on Windows --- @return nil if could open files, error otherwise -local function make_rc(luafilename, rcfilename) - --TODO EXEWRAPPER - local rcfile = io.open(rcfilename, "w") - if not rcfile then - error("Could not open "..rcfilename.." for writing.") - end - rcfile:write("STRINGTABLE\r\nBEGIN\r\n") - - local i = 1 - for line in io.lines(luafilename) do - if not line:match("^#!") then - rcfile:write(i .. " \"") - line = line:gsub("\\", "\\\\"):gsub('"', '""'):gsub("[\r\n]+", "") - rcfile:write(line .. "\\r\\n\"\r\n") - i = i + 1 - end - end - - rcfile:write("END\r\n") - - rcfile:close() -end - --- Driver function for the builtin build back-end. -- @param rockspec table: the loaded rockspec. -- @return boolean or (nil, string): true if no errors ocurred, -- nil and an error message otherwise. function builtin.run(rockspec) assert(type(rockspec) == "table") - local compile_object, compile_library, compile_static_library, compile_wrapper_binary --TODO EXEWRAPPER + local compile_object, compile_library, compile_static_library local build = rockspec.build local variables = rockspec.variables @@ -92,22 +67,6 @@ function builtin.run(rockspec) return ok end ]] - compile_wrapper_binary = function(fullname, name) - --TODO EXEWRAPPER - local fullbasename = fullname:gsub("%.lua$", ""):gsub("/", "\\") - local basename = name:gsub("%.lua$", ""):gsub("/", "\\") - local rcname = basename..".rc" - local resname = basename..".o" - local wrapname = basename..".exe" - make_rc(fullname, fullbasename..".rc") - local ok = execute(variables.RC, "-o", resname, rcname) - if not ok then return ok end - ok = execute(variables.CC.." "..variables.CFLAGS, "-I"..variables.LUA_INCDIR, - "-o", wrapname, resname, variables.WRAPPER, - dir.path(variables.LUA_LIBDIR, variables.LUALIB), - "-l" .. (variables.MSVCRT or "m"), "-luser32") - return ok, wrapname - end elseif cfg.is_platform("win32") then compile_object = function(object, source, defines, incdirs) local extras = {} @@ -146,28 +105,6 @@ function builtin.run(rockspec) return ok end ]] - compile_wrapper_binary = function(fullname, name) - --TODO EXEWRAPPER - local fullbasename = fullname:gsub("%.lua$", ""):gsub("/", "\\") - local basename = name:gsub("%.lua$", ""):gsub("/", "\\") - local object = basename..".obj" - local rcname = basename..".rc" - local resname = basename..".res" - local wrapname = basename..".exe" - make_rc(fullname, fullbasename..".rc") - local ok = execute(variables.RC, "-nologo", "-r", "-fo"..resname, rcname) - if not ok then return ok end - ok = execute(variables.CC.." "..variables.CFLAGS, "-c", "-Fo"..object, - "-I"..variables.LUA_INCDIR, variables.WRAPPER) - if not ok then return ok end - ok = execute(variables.LD, "-out:"..wrapname, resname, object, - dir.path(variables.LUA_LIBDIR, variables.LUALIB), "user32.lib") - local manifestfile = wrapname..".manifest" - if ok and fs.exists(manifestfile) then - ok = execute(variables.MT, "-manifest", manifestfile, "-outputresource:"..wrapname..";1") - end - return ok, wrapname - end else compile_object = function(object, source, defines, incdirs) local extras = {} @@ -194,8 +131,6 @@ function builtin.run(rockspec) end return ok end - compile_wrapper_binary = function(_, name) return true, name end - --TODO EXEWRAPPER end local ok, err @@ -203,23 +138,6 @@ function builtin.run(rockspec) local lib_modules = {} local luadir = path.lua_dir(rockspec.name, rockspec.version) local libdir = path.lib_dir(rockspec.name, rockspec.version) - --TODO EXEWRAPPER - -- On Windows, compiles an .exe for each Lua file in build.install.bin, and - -- replaces the filename with the .exe name. Strips the .lua extension if it exists, - -- otherwise just appends .exe to the name. Only if `cfg.exewrapper = true` - if build.install and build.install.bin then - for key, name in pairs(build.install.bin) do - local fullname = dir.path(fs.current_dir(), name) - if cfg.exewrapper and fs.is_lua(fullname) then - ok, name = compile_wrapper_binary(fullname, name) - if ok then - build.install.bin[key] = name - else - return nil, "Build error in wrapper binaries" - end - end - end - end if not build.modules then return nil, "Missing build.modules table" -- cgit v1.2.3-55-g6feb