Skip to content

Creating LuaRocks with GNU autotools

Reuben Thomas edited this page Sep 10, 2015 · 1 revision

Note that LuaRocks requires packages to be relocatable, and GNU autotools by default builds non-relocatable packages. For many programs it's not necessary to do anything particular to make them relocatable; applications which need to find resources at run-time may be problematic. See GNU Smalltalk for one approach (look at the RELOCATABILITY section in its Zee uses another approach, of patching in paths for in-place running of the program during development, and relying on Lua search paths at run-time, purely to find Lua modules. Search for 'in_place_lua_path'.

Use a rockspec template like the following, and call it $

 source = {
   url = "<USER>/@PACKAGE@/@PACKAGE@-@VERSION@.tar.gz",
   md5 = "@MD5@",
   dir = "@PACKAGE@-@VERSION@"
 description = {
   summary = "<Short summary>",
   detailed = [[
       <Detailed information.>
   homepage = "<USER>/@PACKAGE@/",
   license = "<LICENSE>"
 dependencies = {
   "lua >= 5.1"
 build = {
   type = "command",
   build_command = "LUA=$(LUA) CPPFLAGS=-I$(LUA_INCDIR) ./configure --prefix=$(PREFIX) --libdir=$(LIBDIR) --datadir=$(LUADIR) && make clean && make",
   install_command = "make install"

Add "$" to AC_CONFIG_FILES in your

Add or amend the following rules in your

 ROCKSPEC = $(PACKAGE)-$(VERSION)-1.rockspec
 $(ROCKSPEC): $(PACKAGE).rockspec dist
 	sed -e 's/@MD5@/'`$(MD5SUM) $(distdir).tar.gz | \
 	cut -d " " -f 1`'/g' < $(PACKAGE).rockspec > $@

You can use woger to automate your releases, uploading rockspecs to and announcements to the Lua mailing list. The details are evolving, so see woger itself for details, and a frequently-updated project such as luaposix for example code.

You can’t perform that action at this time.