[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Standard Lua modules in 5.2.1
- From: "John D. Ramsdell" <ramsdell0@...>
- Date: Fri, 6 Jul 2012 17:56:59 -0400
On Thu, Jul 5, 2012 at 8:21 PM, Luiz Henrique de Figueiredo
>> The following works for me in both 5.1 and 5.2.
> Why not just follow the recommendation to copy linit.c to your project,
> edit the list of libraries there at will and just call luaL_openlibs in
> your app?
The code snippet I shared came from the datalog package at
datalog.sf.net. A source release contains a copy of the Lua sources
for those who do not want to depend on the one that is installed.
The people that produce distributions do not like this approach. If
the installed Lua library version contains a bug, they want to make
one update to the library, and automatically fix the problem in all
packages that are built on top of the Lua library. In other words,
they want Lua dependent packages to make use of shared libraries.
Consider the Red Hat line of distributions. They use RPM SPEC files
to specify how to generate packages from source distributions. Red
Hat currently packages Lua 5.1, but sometime in the not to distant
future, they will move to 5.2. I wrote an RPM SPEC file that will
work unchanged with both versions of Lua. Here is what I did. I
stated that a source build requires either 5.1 or 5.2 with this:
BuildRequires: texinfo, lua-devel < 5.3
The rest is all automatic. The C preprocessor gets the appropriate
version number from including "lua.h", and the correct way to load the
Lua libraries is compiled. The datalog package has no other version
The SPEC file has some other magic to deal with installing a Lua
module into the correct directory for access by the Lua stand-alone
interpreter, that's another story.