aboutsummaryrefslogtreecommitdiff
path: root/docs/creating_luarocks_with_gnu_autotools.md
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2025-01-05 21:40:39 -0300
committerHisham Muhammad <hisham@gobolinux.org>2025-01-05 21:40:39 -0300
commitf5c5db5a7378d97a6f261ffaa10c84e2005bfc4e (patch)
treec2f0cb86890fb90a85a7f091746543c7ff14ac5e /docs/creating_luarocks_with_gnu_autotools.md
parent7fe5532c695711d23fd9d7e13a9e6235478171b6 (diff)
downloadluarocks-f5c5db5a7378d97a6f261ffaa10c84e2005bfc4e.tar.gz
luarocks-f5c5db5a7378d97a6f261ffaa10c84e2005bfc4e.tar.bz2
luarocks-f5c5db5a7378d97a6f261ffaa10c84e2005bfc4e.zip
docs: import Wiki docs into the main repo
Diffstat (limited to 'docs/creating_luarocks_with_gnu_autotools.md')
-rw-r--r--docs/creating_luarocks_with_gnu_autotools.md67
1 files changed, 67 insertions, 0 deletions
diff --git a/docs/creating_luarocks_with_gnu_autotools.md b/docs/creating_luarocks_with_gnu_autotools.md
new file mode 100644
index 00000000..3e684691
--- /dev/null
+++ b/docs/creating_luarocks_with_gnu_autotools.md
@@ -0,0 +1,67 @@
1# Creating LuaRocks with GNU autotools
2
3Note that LuaRocks requires packages to be relocatable, and GNU autotools by
4default builds non-relocatable packages. For many programs it's not necessary
5to do anything particular to make them relocatable; applications which need to
6find resources at run-time may be problematic. See GNU Smalltalk for one
7approach (look at the RELOCATABILITY section in its configure.ac).
8[Zee](http://github.com/rrthomas/zee) uses another approach, of patching in
9paths for in-place running of the program during development, and relying on
10Lua search paths at run-time, purely to find Lua modules. Search for
11'in_place_lua_path'.
12
13Use a rockspec template like the following, and call it $PACKAGE.rockspec.in:
14
15```
16package="@PACKAGE@"
17 version="@VERSION@-1"
18 source = {
19 url = "https://github.com/downloads/<USER>/@PACKAGE@/@PACKAGE@-@VERSION@.tar.gz",
20 md5 = "@MD5@",
21 dir = "@PACKAGE@-@VERSION@"
22 }
23 description = {
24 summary = "<Short summary>",
25 detailed = [[
26 <Detailed information.>
27 ]],
28 homepage = "http://github.com/<USER>/@PACKAGE@/",
29 license = "<LICENSE>"
30 }
31 dependencies = {
32 "lua >= 5.1"
33 }
34 build = {
35 type = "command",
36 build_command = "LUA=$(LUA) CPPFLAGS=-I$(LUA_INCDIR) ./configure --prefix=$(PREFIX) --libdir=$(LIBDIR) --datadir=$(LUADIR) && make clean && make",
37 install_command = "make install"
38 }
39```
40
41Add "$PACKAGE.rockspec.in" to AC_CONFIG_FILES in your configure.ac:
42
43Add or amend the following rules in your Makefile.am:
44
45```
46ROCKSPEC = $(PACKAGE)-$(VERSION)-1.rockspec
47```
48
49```
50$(ROCKSPEC): $(PACKAGE).rockspec dist
51 sed -e 's/@MD5@/'`$(MD5SUM) $(distdir).tar.gz | \
52 cut -d " " -f 1`'/g' < $(PACKAGE).rockspec > $@
53```
54
55```
56EXTRA_DIST = $(PACKAGE).rockspec.in
57```
58
59```
60DISTCLEANFILES = $(PACKAGE).rockspec
61```
62
63You can use [woger](http://github.com/rrthomas/woger/) to automate your
64releases, uploading rockspecs to luarocks.org and announcements to the Lua
65mailing list. The details are evolving, so see woger itself for details, and a
66frequently-updated project such as
67[luaposix](http://github.com/luaposix/luaposix/) for example Makefile.am code.