1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-09-30 05:59:07 +00:00

Require Lua 5.1 when building the Lua bindings

The cairo/imlib2/rsvg bindings require tolua++ [1], which is currently only
compatible with Lua 5.1 or earlier. We need to force Conky to compile against
Lua 5.1 if the user chooses to build the bindings.

This commit adds a separate pkg_search_module command specifically for Lua 5.1,
along with a note in the documentation. The original pkg_search_module command
was updated to include (and prefer) Lua 5.3+. Also, I threw in two other minor
random fixes to the docs while I was at it.

[1] https://github.com/LuaDist/toluapp
This commit is contained in:
Marc Payne 2015-12-10 23:00:17 -07:00
parent 2fab2d3820
commit 0dbd27d2de
2 changed files with 29 additions and 15 deletions

View File

@ -250,12 +250,28 @@ if(BUILD_X11)
endif(X11_FOUND)
endif(BUILD_X11)
pkg_search_module(LUA REQUIRED lua5.2 lua-5.2 lua>=5.1 lua5.1 lua-5.1)
# Check whether we want Lua bindings
if(BUILD_LUA_CAIRO OR BUILD_LUA_IMLIB2 OR BUILD_LUA_RSVG)
set(WANT_TOLUA true)
endif(BUILD_LUA_CAIRO OR BUILD_LUA_IMLIB2 OR BUILD_LUA_RSVG)
# Check for Lua itself
if(WANT_TOLUA)
# If we need tolua++, we must compile against Lua 5.1
pkg_search_module(LUA REQUIRED lua5.1 lua-5.1 lua51 lua)
if(NOT LUA_VERSION VERSION_LESS 5.2.0)
message(FATAL_ERROR "Unable to find Lua 5.1.x")
endif(NOT LUA_VERSION VERSION_LESS 5.2.0)
else(WANT_TOLUA)
# Otherwise, use the most recent Lua version
pkg_search_module(LUA REQUIRED lua>=5.3 lua5.3 lua-5.3 lua53 lua5.2 lua-5.2 lua52 lua5.1 lua-5.1 lua51 lua>=5.1)
endif(WANT_TOLUA)
set(conky_libs ${conky_libs} ${LUA_LIBRARIES})
set(conky_includes ${conky_includes} ${LUA_INCLUDE_DIRS})
link_directories(${LUA_LIBRARY_DIRS})
# Check for libraries used by Lua bindings
if(BUILD_LUA_CAIRO)
set(WANT_TOLUA true)
pkg_check_modules(CAIRO REQUIRED cairo cairo-xlib)
set(luacairo_libs ${CAIRO_LIBRARIES} ${LUA_LIBRARIES})
set(luacairo_includes ${CAIRO_INCLUDE_DIRS} ${LUA_INCLUDE_DIRS})
@ -265,13 +281,11 @@ if(BUILD_LUA_CAIRO)
endif(NOT APP_PATCH)
endif(BUILD_LUA_CAIRO)
if(BUILD_LUA_IMLIB2)
set(WANT_TOLUA true)
pkg_check_modules(IMLIB2 imlib2)
pkg_search_module(IMLIB2 REQUIRED imlib2 Imlib2)
set(luaimlib2_libs ${IMLIB2_LIB} ${LUA_LIBRARIES})
set(luaimlib2_includes ${IMLIB2_INCLUDE_PATH} ${LUA_INCLUDE_DIRS})
endif(BUILD_LUA_IMLIB2)
if(BUILD_LUA_RSVG)
set(WANT_TOLUA true)
pkg_check_modules(RSVG REQUIRED librsvg-2.0)
set(luarsvg_libs ${RSVG_LIBRARIES} ${LUA_LIBRARIES})
set(luarsvg_includes ${RSVG_INCLUDE_DIRS} ${LUA_INCLUDE_DIRS})

View File

@ -192,15 +192,15 @@
<refsect1>
<title>Lua API</title>
<para>Conky features a Lua Programming API, and also ships with Lua
bindings for some useful libraries. Conky defines certain global
functions and variables which can be accessed from Lua code running
in Conky.
bindings for some useful libraries. Note that the bindings require
tolua++, which currently only compiles against Lua 5.1.
</para>
<para>To use Lua Conky, you first need to make sure you have a version of Conky
with Lua support enabled (``conky -v'' will report this). Scripts
must first be loaded using the lua_load configuration option. You
then call functions in Lua via Conky's $lua, $lua_read, and Lua
hooks.
with Lua support enabled (``conky -v'' will report this). Conky defines
certain global functions and variables which can be accessed from Lua
code running in Conky. Scripts must first be loaded using the lua_load
configuration option. You then call functions in Lua via Conky's $lua,
$lua_read, and Lua hooks.
</para>
<para>
Be careful when creating threaded objects through the Lua API. You
@ -263,7 +263,7 @@
</varlistentry>
<varlistentry>
<term>
<filename>~/.config/conky/rc</filename>
<filename>~/.config/conky/conky.conf</filename>
</term>
<listitem>Default personal configuration
file.</listitem>