You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mxe/plugins/luarocks
Viktor Szakats 0891088495
secure/fix/update URLs
5 years ago
..
README.md use HTTP URLs (without redirects) for Lua examples 6 years ago
llthreads2-1-link-with-kernel32-on-mxe.patch Copyright headers: point to LICENSE.md and shorten 8 years ago
llthreads2.mk plugins: use GH_CONF 6 years ago
lpeg-1-rockspec.patch Copyright headers: point to LICENSE.md and shorten 8 years ago
lpeg.mk secure/fix/update URLs 5 years ago
lua-rapidjson-1-fixes.patch various packages: run `make refresh-patches` with numbering 7 years ago
lua-rapidjson.mk plugins: use GH_CONF 6 years ago
lua.mk Copyright headers: point to LICENSE.md and shorten 8 years ago
luarocks-1-fixes.patch various packages: run `make refresh-patches` with numbering 7 years ago
luarocks.mk secure URLs 5 years ago
luasocket-1-build-on-mxe.patch Copyright headers: point to LICENSE.md and shorten 8 years ago
luasocket-2-lual-checkint.patch Copyright headers: point to LICENSE.md and shorten 8 years ago
luasocket.mk Secure URLs 6 years ago
luv-1-fixes.patch various packages: run `make refresh-patches` with numbering 7 years ago
luv.mk plugins: use GH_CONF 6 years ago
test.lua use HTTP URLs (without redirects) for Lua examples 6 years ago

README.md

LuaRocks plugin

Short description of LuaRocks

Hundreds of Lua packages are distributed via LuaRocks. LuaRocks is the package manager for Lua. It allows you to create and install Luamodules as self-contained packages called rocks. You can download and install LuaRocks on Unix and Windows.

Lua rocks are similar to Ruby gems, Python eggs or JavaScript NPM. Command luarocks install <rock> downloads a rock from luarocks.org (or other luarocks server), compiles C files (modules) to shared libraries and installs (copies) shared libraries and Lua files to the directory where luarocks is installed. Installed rocks can be loaded from Lua with function require.

Example:

$ luarocks install luasocket
$ lua -e 'http = require "socket.http"; print(http.request("http://example.org/"))'
<!DOCTYPE html>
....

LuaRocks can used with make, cmake, custom or builtin back-ends.

LuaRocks in MXE

LuaRocks and some popular rocks were ported to MXE as a plugin. LuaRocks can now be used in the same way as CMake or Make.

Package lua installs native executable usr/bin/lua and cross-compiled lua executable usr//bin/lua.exe. Native executable is needed since LuaRocks is written in Lua. Cross-compiled one is needed to run Lua scripts loading cross-compiled lua modules.

Package luarocks was added. Luarocks was patched to support new platform mxe, inherited from platform unix. It uses mix of system tools (e.g., openssl, ln, mkdir), MXE build chain (i686-w64-mingw32.shared-gcc, i686-w64-mingw32.shared-cmake) and some Windows variables (e.g., "dll" extension for shared libraries). The package is shared-only because Lua loads modules in runtime. It creates prefixed luarocks tool in usr/bin. It also creates prefixed wine+lua wrapper aware of locations of dll and lua files installed. This script can be used to test modules in Linux as if running them in Windows.

There was a difficult choice if mxe platform of luarocks is inherited from windows or unix platform. I tried both and it is less patching for unix. For windows even build tools differ, while for unix a typical rock builds without patching or with minor patching (as other MXE packages).

LuaRocks can be used to install rocks. With ideal rock it works as follows:

$ i686-w64-mingw32.shared-luarocks install <rock>

This command downloads rockspeck, downloads sources, verifies checksum (useless thing, because checksum is compared to the value from rockspec file, which itself is neither verified nor signed), builds and installs.

LuaRocks is not used to download source tarballs (as said above, it doesn't verify checksums properly) using MXE's downloading and verifying facilities instead. Luarocks is used as builder, installer and Lua library (it installs Lua files to usr/i686-w64-mingw32.shared/share/lua/5.3/luarocks/).

Build all rocks:

$ make all-luarocks MXE_PLUGIN_DIRS=plugins/luarocks MXE_TARGETS='i686-w64-mingw32.shared x86_64-w64-mingw32.shared'

Run tests (requires wine):

$ ./usr/bin/i686-w64-mingw32.shared-lua plugins/luarocks/test.lua

See also: