lua-users home
lua-l archive

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


Hi

In the work I do I sometimes need to make a self contained set of lua libraries and executables.  That is, Lua does not go to /usr/local/mumble for its libraries.  While I can do this by, for example, setting the environment variables appropriately, or putting the right initialization code into the lua scripts, I’d really like to have it hard-coded into the lua object code.
 
I’d like to request a small change to the way luaconf.h generates the default paths for libraries and so on.
Right now, it does
  #define LUA_ROOT “/usr/local”
And I’d love to have it be:
   #ifndef LUA_ROOT
   #define LUA_ROOT “/usr/local”
   #endif
With appropriate modifications to the Lua Makefiles to look to see if LUA_ROOT has been set, to pass the setting down, and do a -DLUA_ROOT=… or not when actually building.

The real magic is in the makefiles. In my application, I generate and set two environment variables in the application’s top-level Makefile: LUA_ROOT and INSTALL_TOP.  Then the Lua Makefiles look to see if they are set or not. If not, the defaults are used. If they are set, the Lua Makefiles use those values instead.

I like this method because 
    cd …/lua-5.4.3
    make …
Works the same way as before I made the modifications and the modifications are not static in the lua source tree (that is, no editing of the source code or Makefiles is needed to set/change these).

I can provide a diff if desired.

Thanks
Frank Kastenholz