-
-
Notifications
You must be signed in to change notification settings - Fork 8
LuaRocks Support
LuaRocks presents this problem: it lacks the ability to use arg AND tuple for arguments (`arg or {...}`). LuaConsole gives you the option to use arg and tuple for arguments using the -T switch as a compatibility layer to existing Lua code and to avoid conforming to a standard if you don't want to. By default you do not need this -T switch, just beware if you use it.
LuaRocks requires an initial installation of Lua. The version doesn't matter, as they are all interchangeable. Acquire Lua from https://www.lua.org/ftp/(lua.org). This version of Lua will be replaced by LuaConsole and your wanted build of lua will still be used. You should use the generated .dll from LuaConsole bin folder from doing `build.bat driver lua-x.x.x` as that lua dll is then used to link with other dlls such as the common `core.dll`.
Replace the x's below name with your version.
- Download the latest LuaRocks `git clone https://github.com/luarocks/luarocks`
- `cd` into the git root directory
- Run `install /F /MW`, installs to `C:\Program Files (x86)\LuaRocks` for the pre-packaged version, add `/L`
- If `/L`, 'Delete all installed lua51 executables, MSVCRT stuff, manifest, and lua51.dll, and `\include\*`'
- Add in your own version of lua5x.dll liblua5x.dll.a to the root, add all needed lua headers into `\include\`
- Rename `config-5.x.lua` to match your version (config-5.1 (5.1 for jit), config-5.2, etc)
- Edit `config-5.x.lua`
- Edit `lua\luarocks\site_config.lua`
- Edit `luarocks.bat` to point to your `luaw.exe` executable, and pass the arguments correctly
- Ensure LuaRocks is in your %PATH%. Check out using.bat so you can use `using %luarocks%` to keep environment variables clean.
- Ensure LuaRocks packages are in %LUA_PATH% and %LUA_CPATH% or you won't be able to use downloaded rocks packages without setting `package.cpath` or `package.path` in-lua. Try the command `luarocks.bat path --bin` if you are wondering how I made the batch script below. This doesn't work with self-contained installations, edit it as necessary. This will have to be run every time you use LuaRocks unless you make it final by setting it in your environment variables. (Which is why I recommend `using.bat` above). Keeps everything clean and organized.
variables = {
CC = "gcc"; -- your gcc name, mingw32 uses mingw32-gcc and the like
LD = "gcc"; -- your gcc name
LUALIB = 'lua-x.x.x.dll'; -- name of added library
-- if a MSVCRT-like variable exists here, delete it
}
site_config.LUA_INTERPRETER=[[luaw]] -- name of lua interpreter exe
site_config.LUAROCKS_UNAME_S=[[MINGW]]
REM I keep my `luaw.exe` in my `%path%`, this should be on line 12 or something
"luaw" "C:\Program Files (x86)\LuaRocks\luarocks.lua" "-n" %*
@echo off
set lua_ver_str=5.3
set userdir=%HOMEDRIVE%%HOMEPATH%
set luarocksdir=C:\Program Files (x86)\LuaRocks
set LUA_PATH=%userdir%\AppData\Roaming/luarocks/share/lua/%lua_ver_str%/?.lua;%userdir%\AppData\Roaming/luarocks/share/lua/%lua_ver_str%/?/init.lua;%luarocksdir%\systree/share/lua/%lua_ver_str%/?.lua;%luarocksdir%\systree/share/lua/%lua_ver_str%/?/init.lua;%luarocksdir%/lua/?.lua;%luarocksdir%\lua\?.lua;%luarocksdir%\lua\?\init.lua;
SET LUA_CPATH=%userdir%\AppData\Roaming/luarocks/lib/lua/%lua_ver_str%/?.dll;%luarocksdir%\systree/lib/lua/%lua_ver_str%/?.dll;%windir%\system32\?.dll;%windir%\system32\..\lib\lua\%lua_ver_str%\?.dll;%windir%\system32\loadall.dll;.\?.dll
set PATH=%userdir%\AppData\Roaming/luarocks/bin;%luarocksdir%\systree/bin;%luarocksdir%;%path%
- Not tested yet, feel free - its just the new shebang**
- Download lua version of choice or collect the .so you used to build LuaConsole
- Download luarocks latest
- cd, in terminal, to luarocks
- Run `./configure`, installs to `/usr/local/bin` and `/usr/local/etc/luarocks` and `/usr/local/share/lua/5.x`
- Edit `/usr/local/share/lua/5.x/luarocks/core/site_config_5_x.lua`
- Edit `/usr/local/bin/luarocks` change shebang
local site_config = {}
site_config.LUA_INTERPRETER=[[luaw]] -- name of lua interpreter
...etc...
return site_config
#!/bin/sh
":" //# comment; exec /usr/bin/env "luaw" "-n" '$*'