1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-11-16 01:57:09 +00:00
conky/3rdparty/toluapp/README-5.1
Brenden Matthews bb8723dd36
Add toluapp subtree (#712)
* First commit!

* Import to git

* Droping down CMake requirement

* Corrected installation of libraries

* Adding travis build

* Updated cmake macros

* Fixed find package

* Updated travis hook

* Updated travis hook

* Patch to support Lua 5.3.

* Fix Lua header include directives in tolua++.h

Use angle bracket rather than double quotes when including Lua headers in the tolua++ header. This fixes a problem on systems that default to a Lua version newer than 5.1 and install the tolua++ header to the same directory as newer Lua headers.

As there are (usually) no Lua headers in the same directory when building tolua++ itself, the preprocessor will look to the include directories passed to the compiler, one of which would be the Lua 5.1 include directory, and tolua++ will build with those (correct) headers. Then the tolua++ header is usually installed in the default include directory, alongside the newer Lua headers, which you wouldn't expect to cause any trouble.

But it does cause trouble when trying to build other programs that include the tolua++ header, because now the preprocessor does find Lua headers in the same directory as the tolua++ header, which are the newer (incorrect) headers. Now the program will either fail to compile, because it doesn't support the newer headers, or fail to link with the tolua++ shared object because they were compiled against different Lua headers.

Using angle brackets instead of double quotes in the include directives will fix the problem, because then the preprocessor will look to the include directories passed to the compiler first.

See http://www.cegui.org.uk/forum/viewtopic.php?f=10&t=7195

* Remove email notifications.

* Update travis build.

* Build shared and static libs.

* Patch toluapp to support Lua 5.3.

With this change, support for Lua 5.1 is dropped.

This resolve #116.

* Add some comments to clarify the toluapp handling.

* Add minor sonar fix.
2018-12-20 15:18:51 -05:00

51 lines
1.6 KiB
Groff
Executable File

Compiling for lua 5.1
---------------------
Starting from version 1.0.8pre1, tolua++ can be compiled with both lua 5.0 and
5.1. Both versions will output the same code, and the C API (tolua++.h) is the
same.
The build system is not yet ready to detect/decide when to compile for 5.1,
the easiest way right now is to add a file called 'custom.py' on the root of
the package, with the following:
## BEGIN custom.py
CCFLAGS = ['-I/usr/local/include/lua5.1', '-O2', '-ansi']
LIBPATH = ['/usr/local/lib']
LIBS = ['lua5.1', 'dl', 'm']
tolua_bin = 'tolua++5.1'
tolua_lib = 'tolua++5.1'
TOLUAPP = 'tolua++5.1'
## END custom.py
This will build the binary as 'tolua++5.1' and the library as 'libtolua++5.1.a'
(taken from tolua_bin and tolua_lib), and take the lua headers and libraries
from /usr/local/include/lua5.1 and /usr/local/lib. It will also link with
'-llua5.1'. Modify the parameters acording to your system.
Compatibility
-------------
There are a couple of things to keep in mind when running code inside tolua
using the -L option:
* `...' and arg: you can still use 'arg' on 5.1, this is done automatically by
adding the 'arg' declaration to functions on files loaded with dofile.
For example, the line:
function foo( ... )
becomes
function foo( ... ) local arg = {n=select('#', ...), ...};
This lets you use the same code on both versions without having to make any
modifications.
* keep in mind that there are slight differences on the way string.gsub works,
and the original version of the function is always kept, so it will behave
diffently depending on which version of lua you're using.