I was upgrading my local install of Lua 5.3 and had to deal with modifying
luaconf.h yet again. Usually I just apply a patch, but today I wrote a shell
script that can translate the LUA_ROOT, LUA_LDIR, and LUA_CDIR definitions
in upstream luaconf.h.
The script can import INSTALL_TOP, INSTALL_LMOD, INSTALL_CMOD, etc from the
Makefile by parsing MAKEFLAGS, which make exports to subshell environments.
Variables can also be passed via the environment directly or by command-line
options. It should be relatively easy to drop into custom builds, assuming
it supports a unix shell environment.
The following branch modifies the Lua makefiles to generate luaconf.h at
On Wed, Jul 06, 2016 at 06:19:37PM -0300, Luiz Henrique de Figueiredo wrote:
> > I was upgrading my local install of Lua 5.3 and had to deal with modifying
> > luaconf.h yet again. Usually I just apply a patch, but today I wrote a shell
> > script
> If you don't want to edit luaconf.h to reapply your customizations, just
> add them at the end. You may have to do something like
> #undef LUA_ROOT
> #undef LUA_LDIR
> #undef LUA_CDIR
> #define LUA_ROOT ...
> #define LUA_LDIR ...
> #define LUA_CDIR ...
For my purposes, defining those is an indirect way to modify
LUA_PATH_DEFAULT and LUA_CPATH_DEFAULT. I didn't want to define them
directly because the default definitions also include implicit semantics of
module loading (priority, etc).
But reading through the 5.1, 5.2, and 5.3 sources they do seem rather
stable, though 5.1 differs from 5.2. Appending definitions for
LUA_PATH_DEFAULT and LUA_CPATH_DEFAULT sure would be much cleaner.
I probably shouldn't have posted to the list to advertise the script.
Requirements and preferences vary widely. Sorry for the noise.