lua-users home
lua-l archive

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

Am 14.09.2013 06:55 schröbte Jayanth Acharya:
However, I'd also be quite interested in the other method that you
suggested. Since I installed the "luars232" library using luarocks, I am
not quite sure if there is a place on this machine where the library
sources are there, and I can enable DBG and rebuild it. Or, should I clone
the "luars232" module from Git and then do this ? If the latter, do I first
uninstall the version installed via luarocks ?

If the rock uses the `builtin` build type (like luars232) you can download the rockspec[1] from the luarocks site[2], modify the rockspec to include the proper defines, and install the rock via the modified local rockspec:
    luarocks install luars232-1.0.3-1.rockspec

In your case the modified build section in the rockspec would look like this:

    build = {
       type = "builtin",
       platforms = {
          unix = {
             modules = {
                luars232 = {
sources = { "src/rs232.c", "src/rs232_posix.c", "bindings/lua/luars232.c" },
                   incdirs = { "include" },
defines = { "RS232_DEBUG=1", "LUAROCKS_HACK -std=gnu99" },
                -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^

If the rock in question does *not* use the `builtin` build type I would download and unpack the corresponding source rock (just a zip archive, see e.g. [3]), modify the build scripts and/or source files inside, move the included rockspec file to the top-level source directory and call from there:
    luarocks make

You could also try this with a clone of git head, but some projects require a non-trivial packaging step (like generating some source file), in which case this approach would fail unless you also perform those packaging steps yourself.


In both cases you don't need to uninstall anything, the old files in the local rocks tree just get replaced.