diff options
Diffstat (limited to 'docs/creating_luarocks_with_gnu_autotools.md')
-rw-r--r-- | docs/creating_luarocks_with_gnu_autotools.md | 67 |
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 | |||
3 | Note that LuaRocks requires packages to be relocatable, and GNU autotools by | ||
4 | default builds non-relocatable packages. For many programs it's not necessary | ||
5 | to do anything particular to make them relocatable; applications which need to | ||
6 | find resources at run-time may be problematic. See GNU Smalltalk for one | ||
7 | approach (look at the RELOCATABILITY section in its configure.ac). | ||
8 | [Zee](http://github.com/rrthomas/zee) uses another approach, of patching in | ||
9 | paths for in-place running of the program during development, and relying on | ||
10 | Lua search paths at run-time, purely to find Lua modules. Search for | ||
11 | 'in_place_lua_path'. | ||
12 | |||
13 | Use a rockspec template like the following, and call it $PACKAGE.rockspec.in: | ||
14 | |||
15 | ``` | ||
16 | package="@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 | |||
41 | Add "$PACKAGE.rockspec.in" to AC_CONFIG_FILES in your configure.ac: | ||
42 | |||
43 | Add or amend the following rules in your Makefile.am: | ||
44 | |||
45 | ``` | ||
46 | ROCKSPEC = $(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 | ``` | ||
56 | EXTRA_DIST = $(PACKAGE).rockspec.in | ||
57 | ``` | ||
58 | |||
59 | ``` | ||
60 | DISTCLEANFILES = $(PACKAGE).rockspec | ||
61 | ``` | ||
62 | |||
63 | You can use [woger](http://github.com/rrthomas/woger/) to automate your | ||
64 | releases, uploading rockspecs to luarocks.org and announcements to the Lua | ||
65 | mailing list. The details are evolving, so see woger itself for details, and a | ||
66 | frequently-updated project such as | ||
67 | [luaposix](http://github.com/luaposix/luaposix/) for example Makefile.am code. | ||