Lua: Install a rock using luarocks from a locally installed rock (or from a .zip/.tar.gz)

夙愿已清 提交于 2019-12-04 03:12:39

LuaRocks has a pack subcommand that will create a binary rock (a zip file containing all files for an installed module). You can use that binary rock to install the same module on another computer, given that the architecture matches.

E.g.

luarocks pack luafilesystem

produces luafilesystem-1.6.2-2.linux-x86_64.rock on my machine, and

luarocks install luafilesystem-1.6.2-2.linux-x86_64.rock

will reinstall luafilesystem with no internet connection necessary.

If you have the source zip, you can unpack it and point luarocks to the the rockspec file. Here is how I installed 'busted' from source.

git clone https://github.com/Olivine-Labs/busted.git
luarocks install busted/busted-1.3-1.rockspec

Or install it directly from source

cd busted
luarocks make

If Someone want an installation from the local source rock.

Just do this:

cd /path/to/source-rock
luarocks make source-rock.rockspec

NOTE:

Use make instead of install. The reason is here (quoted below).

LuaRocks offers this:

make Compile package in current directory using a rockspec.

install Install a rock.

However, install does not utilize the present make. It tries to download and recompile the same package from the server instead of the one I customized locally.

Any way round this?

The make command will actually build and install your customized rockspec. The poor naming choice causes confusion every now and then, I know.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!