Saturday, March 02, 2013
Stupid GitHub tricks
All that work parsing
git
repositories was for naught—it seems you can
link to individual files on GitHub (go
figure!). So now I can create a rockspec
per module, like:
package = "org.conman.tcc" version = "1.0.0-0" source = { url = "https://raw.github.com/spc476/lua-conmanorg/1.0.0/src/tcc.c" } description = { homepage = "http://...", maintainer = "Sean Conner <sean@conman.org>", license = "LGPL", summary = "Lua wrapper for TCC", detailed = [[ Blah blah blah ]] } dependencies = { "lua ~> 5.1" } external_dependencies = { TCC = { header = "libtcc.h" } } build = { type = "builtin", copy_directories = {}, modules = { ['org.conman.tcc'] = { sources = { 'tcc.c' }, libraries = { "tcc" }, } }, variables = { CC = "$(CC) -std=c99", CFLAGS = "$(CFLAGS)", LFLAGS = "$(LIBFLAG)", LUALIB = "$(LIBDIR)" } }
(this particular module embeds a C compiler in Lua, which is something I do need to talk about).
But it isn't like I wasted time on this. No, I don't view it that way at
all. In fact, I learned a few things—how to parse git
repositories, how to parse a variable amount of data in LPeg and I have code to
extract a single file into its own git
repository if I ever
have that need again.