From 8dd1e1460282f5fc992d838ec2411f4d1bc7b2b7 Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Mon, 2 Jul 2018 19:27:48 -0300 Subject: Experimental Windows cross-compiled binary build This commit consolidates the work that has been ongoing over the last few weeks in producing the single-binary builds of LuaRocks based on the new distribution model described in https://github.com/luarocks/luarocks/wiki/Project:-LuaRocks-new-distribution-model The single-binary build is in a good shape for Linux, it's a work-in-progress for Windows (binaries do build, but some work on the dependencies is still necessary), and is untested in macOS. --- src/luarocks/cmd.lua | 13 +++++++++++++ src/luarocks/core/cfg.lua | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/luarocks/cmd.lua b/src/luarocks/cmd.lua index 53e0c60a..4200959c 100644 --- a/src/luarocks/cmd.lua +++ b/src/luarocks/cmd.lua @@ -348,6 +348,19 @@ function cmd.run_command(description, commands, ...) project_dir = flags["project-tree"]:gsub("[/\\][^/\\]+$", "") end + -- FIXME A quick hack for the experimental Windows build + if os.getenv("LUAROCKS_CROSS_COMPILING") then + cfg.each_platform = function() + local i = 0 + local plats = { "unix", "linux" } + return function() + i = i + 1 + return plats[i] + end + end + fs.init() + end + ----------------------------------------------------------------------------- local ok, err = cfg.init(lua_data, project_dir, util.warning) if not ok then diff --git a/src/luarocks/core/cfg.lua b/src/luarocks/core/cfg.lua index e160d69b..af57e7ca 100644 --- a/src/luarocks/core/cfg.lua +++ b/src/luarocks/core/cfg.lua @@ -276,7 +276,7 @@ local function make_defaults(lua_version, target_cpu, platforms, home) local localappdata = os.getenv("LOCALAPPDATA") if not localappdata then -- for Windows versions below Vista - localappdata = os.getenv("USERPROFILE").."/Local Settings/Application Data" + localappdata = (os.getenv("USERPROFILE") or "c:/Users/All Users").."/Local Settings/Application Data" end defaults.local_cache = localappdata.."/LuaRocks/Cache" defaults.web_browser = "start" -- cgit v1.2.3-55-g6feb