lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Thu, May 8, 2008 at 4:14 AM, gary ng <garyng2000@yahoo.com> wrote:
>  > I'm with the other poster who wished it be possible
>  > to create at least
>  > a simple rock without any makefile at all.
>
>  I think the luarocks' build_module option already does
>  that. Unfortunately, I don't know how to make use of
>  it effectively.

Indeed, it does that already!

>  If it is a lua only module, I believe no make file is
>  needed.
>
>  If it is a self-contained C module with simple
>  dependency, it should work too(or does it?)

I linked here in another post a page that should have been an
introductory guide to write makefile-less rocks, but maybe it is not
clear or detailed enough (or maybe it tries to cover too much ground
at once, I don't know -- I'm probably in too deep into the thing to
discern between what's basic and what isn't). Anyway, here it is:
http://www.luarocks.org/en/Creating_a_rock

But I think some real examples would serve as a better demonstration
than that page, actually. Here are the rockspecs for:

* stdlib, a pure Lua rock:
http://luarocks.luaforge.net/rocks/stdlib-4-2.rockspec

* lpeg, uses C code (notice that lpeg ships a makefile, but we just
don't use it!)
http://luarocks.luaforge.net/rocks/lpeg-0.8.1-1.rockspec

* luagl, uses C code, links to external libraries, and still no makefiles used!
http://luarocks.luaforge.net/rocks/luagl-1.01-1.rockspec

* for contrast, here's the one for luafilesystem, which does uses
makefiles and handles unix/windows portability issues:
http://luarocks.luaforge.net/rocks/luafilesystem-1.4.1-1.rockspec

Rocks tries to follow the "keep simple things simple, make complex
things possible" approach.

>  Unfortunately, almost all my modules are bindings that
>  relies on external modules/libraries. This is fine
>  under linux(just make sure the proper libraries are
>  installed, simple task under debian).
>
>  But a nightmare situation under Windows, forcing me to
>  write Makefile.win (and thus Makefile as I don't think
>  I can have it built as module under linux and built as
>  makefile under Windows).

Actually, you can. Looking at the luafilesystem example linked above.
You can specify different types on each platform section. But the
"module" type should work on Windows as well. (You may need to specify
different library names, though, but it should be possible -- if you
bump into any LuaRocks shortcomings in this regard we'd certainly like
to hear about it at the LuaRocks mailing list.)

-- Hisham