Skip to content

Commit

Permalink
Patch toluapp to support Lua 5.3.
Browse files Browse the repository at this point in the history
This resolve #116.
  • Loading branch information
brndnmtthws authored and Brenden Matthews committed Dec 19, 2018
1 parent 893275e commit 47aa0c4
Show file tree
Hide file tree
Showing 9 changed files with 76 additions and 115 deletions.
84 changes: 37 additions & 47 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ matrix:
- libxml2-dev
- libcurl4-gnutls-dev
- liblua5.1-0-dev
- libtolua++5.1-dev
- libcairo2-dev
- libimlib2-dev
- libxinerama-dev
Expand All @@ -37,7 +36,6 @@ matrix:
- audacious-dev
- libsystemd-dev
- libxml2-dev
- tolua++
- gawk
env:
- MATRIX_EVAL="CC=gcc-5 && CXX=g++-5"
Expand All @@ -58,7 +56,6 @@ matrix:
- libxml2-dev
- libcurl4-gnutls-dev
- liblua5.1-0-dev
- libtolua++5.1-dev
- libcairo2-dev
- libimlib2-dev
- libxinerama-dev
Expand All @@ -77,7 +74,6 @@ matrix:
- audacious-dev
- libsystemd-dev
- libxml2-dev
- tolua++
- gawk
env:
- MATRIX_EVAL="CC=gcc-6 && CXX=g++-6"
Expand All @@ -98,7 +94,6 @@ matrix:
- libxml2-dev
- libcurl4-gnutls-dev
- liblua5.1-0-dev
- libtolua++5.1-dev
- libcairo2-dev
- libimlib2-dev
- libxinerama-dev
Expand All @@ -117,7 +112,6 @@ matrix:
- audacious-dev
- libsystemd-dev
- libxml2-dev
- tolua++
- gawk
env:
- MATRIX_EVAL="CC=gcc-7 && CXX=g++-7"
Expand All @@ -138,7 +132,6 @@ matrix:
- libxml2-dev
- libcurl4-gnutls-dev
- liblua5.1-0-dev
- libtolua++5.1-dev
- libcairo2-dev
- libimlib2-dev
- libxinerama-dev
Expand All @@ -157,7 +150,6 @@ matrix:
- audacious-dev
- libsystemd-dev
- libxml2-dev
- tolua++
- gawk
env:
- MATRIX_EVAL="CC=gcc-8 && CXX=g++-8"
Expand All @@ -178,7 +170,6 @@ matrix:
- libxml2-dev
- libcurl4-gnutls-dev
- liblua5.1-0-dev
- libtolua++5.1-dev
- libcairo2-dev
- libimlib2-dev
- libxinerama-dev
Expand All @@ -197,7 +188,6 @@ matrix:
- audacious-dev
- libsystemd-dev
- libxml2-dev
- tolua++
- gawk
env:
- MATRIX_EVAL="CC=clang-6.0 && CXX=clang++-6.0"
Expand All @@ -219,7 +209,6 @@ matrix:
- libxml2-dev
- libcurl4-gnutls-dev
- liblua5.1-0-dev
- libtolua++5.1-dev
- libcairo2-dev
- libimlib2-dev
- libxinerama-dev
Expand All @@ -238,7 +227,6 @@ matrix:
- audacious-dev
- libsystemd-dev
- libxml2-dev
- tolua++
- gawk
sonarcloud:
organization: "brndnmtthws-github"
Expand All @@ -257,7 +245,7 @@ before_install:
- |
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
brew update;
brew install freetype gettext lua imlib2 ccache;
brew install freetype gettext lua imlib2 librsvg ccache;
export PATH="/usr/local/opt/ccache/libexec:$PATH";
fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew link gettext --force ; fi
Expand All @@ -266,58 +254,60 @@ before_script:
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
mkdir build && cd build
cmake \
cmake \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DBUILD_MYSQL=ON \
-DBUILD_LUA_CAIRO=ON \
-DBUILD_LUA_IMLIB2=ON \
-DBUILD_LUA_RSVG=ON \
-DBUILD_LUA_CAIRO=ON \
-DBUILD_AUDACIOUS=ON \
-DBUILD_XMMS2=ON \
-DBUILD_ICAL=ON \
-DBUILD_IRC=ON \
-DBUILD_HTTP=ON \
-DBUILD_ICONV=ON \
-DBUILD_PULSEAUDIO=ON \
-DBUILD_JOURNAL=ON \
-DBUILD_RSS=ON \
-DBUILD_MYSQL=ON \
-DBUILD_LUA_IMLIB2=ON \
-DBUILD_LUA_RSVG=ON \
-DBUILD_LUA_CAIRO=ON \
-DBUILD_AUDACIOUS=ON \
-DBUILD_XMMS2=ON \
-DBUILD_ICAL=ON \
-DBUILD_IRC=ON \
-DBUILD_HTTP=ON \
-DBUILD_ICONV=ON \
-DBUILD_PULSEAUDIO=ON \
-DBUILD_JOURNAL=ON \
-DBUILD_RSS=ON \
..
cd ..
mkdir build-no-x11
cd build-no-x11
cmake \
cmake \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DBUILD_X11=OFF \
-DBUILD_MYSQL=ON \
-DBUILD_LUA_CAIRO=ON \
-DBUILD_LUA_IMLIB2=ON \
-DBUILD_LUA_RSVG=ON \
-DBUILD_LUA_CAIRO=ON \
-DBUILD_AUDACIOUS=ON \
-DBUILD_XMMS2=ON \
-DBUILD_ICAL=ON \
-DBUILD_IRC=ON \
-DBUILD_HTTP=ON \
-DBUILD_ICONV=ON \
-DBUILD_PULSEAUDIO=ON \
-DBUILD_JOURNAL=ON \
-DBUILD_RSS=ON \
-DBUILD_X11=OFF \
-DBUILD_MYSQL=ON \
-DBUILD_LUA_CAIRO=ON \
-DBUILD_LUA_IMLIB2=ON \
-DBUILD_LUA_RSVG=ON \
-DBUILD_AUDACIOUS=ON \
-DBUILD_XMMS2=ON \
-DBUILD_ICAL=ON \
-DBUILD_IRC=ON \
-DBUILD_HTTP=ON \
-DBUILD_ICONV=ON \
-DBUILD_PULSEAUDIO=ON \
-DBUILD_JOURNAL=ON \
-DBUILD_RSS=ON \
..
cd ..
elif [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
mkdir build && cd build
cmake \
cmake \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DBUILD_LUA_RSVG=ON \
-DBUILD_LUA_IMLIB2=ON \
..
cd ..
mkdir build-no-x11
cd build-no-x11
cmake \
-DBUILD_X11=OFF \
cmake \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DBUILD_X11=OFF \
-DBUILD_LUA_RSVG=ON \
-DBUILD_LUA_IMLIB2=ON \
..
cd ..
fi
Expand Down
22 changes: 11 additions & 11 deletions 3rdparty/toluapp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

project ( toluapp C )
cmake_minimum_required ( VERSION 3.4 )
include ( cmake/dist.cmake )
# include ( cmake/dist.cmake )

include(FindPkgConfig)

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 luajit)
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 luajit)
include_directories ( include src/lib ${LUA_INCLUDE_DIRS} )

# Build lib
Expand All @@ -19,21 +19,21 @@ if ( MSVC )
set ( DEF_FILE libtoluapp.def )
endif ( )

add_library ( toluapp_lib SHARED ${SRC_LIBTOLUAPP} ${DEF_FILE} )
# add_library ( toluapp_lib SHARED ${SRC_LIBTOLUAPP} ${DEF_FILE} )
add_library ( toluapp_lib_static STATIC ${SRC_LIBTOLUAPP} ${DEF_FILE} )
target_link_libraries ( toluapp_lib ${LUA_LIBRARIES} )
set_target_properties ( toluapp_lib PROPERTIES OUTPUT_NAME toluapp CLEAN_DIRECT_OUTPUT
target_link_libraries ( toluapp_lib_static ${LUA_LIBRARIES} )
set_target_properties ( toluapp_lib_static PROPERTIES OUTPUT_NAME toluapp CLEAN_DIRECT_OUTPUT
1 )

# Build app
include_directories ( src/bin )
set ( SRC_TOLUA src/bin/tolua.c src/bin/toluabind.c )
add_executable ( toluapp ${SRC_TOLUA} )
target_link_libraries ( toluapp toluapp_lib ${LUA_LIBRARIES} )
target_link_libraries ( toluapp toluapp_lib_static ${LUA_LIBRARIES} )

# Install
install_library ( toluapp_lib )
install_executable ( toluapp )
install_header ( include/ )
install_data ( README INSTALL )
install_doc ( doc/ )
#install_library ( toluapp_lib )
#install_executable ( toluapp )
#install_header ( include/ )
#install_data ( README INSTALL )
#install_doc ( doc/ )
8 changes: 6 additions & 2 deletions 3rdparty/toluapp/src/bin/tolua.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,12 @@ int main (int argc, char* argv[])
}
#else
{
lua_pushstring(L, "/usr/share/toluapp/luapp/"); lua_setglobal(L,"path");
if (luaL_loadfile(L, "/usr/share/toluapp/luapp/all.lua") != 0) {
char *pkg_path = getenv("TOLUAPP_PACKAGE_PATH");
char full_path[1024];
strcpy(full_path, pkg_path);
strcat(full_path, "all.lua");
lua_pushstring(L, pkg_path); lua_setglobal(L,"path");
if (luaL_loadfile(L, full_path) != 0) {
fprintf(stderr, "luaL_loadfile failed\n");
return 1;
}
Expand Down
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ set(conky_sources
add_subdirectory(lua)
add_subdirectory(data)
add_subdirectory(doc)

# Include 3rdparty toluapp
add_subdirectory(3rdparty/toluapp)
set(conky_libs ${conky_libs} toluapp_lib_static)

add_subdirectory(src)

IF(NOT DEFINED DOC_PATH)
Expand Down
47 changes: 8 additions & 39 deletions cmake/ConkyPlatformChecks.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -320,25 +320,12 @@ if(BUILD_X11)
endif(X11_FOUND)
endif(BUILD_X11)

# 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 luajit)
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 luajit)
endif(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 luajit)
set(conky_libs ${conky_libs} ${LUA_LIBRARIES})
set(conky_includes ${conky_includes} ${LUA_INCLUDE_DIRS})
link_directories(${LUA_LIBRARY_DIRS})
include_directories(3rdparty/toluapp/include)

# Check for libraries used by Lua bindings
if(BUILD_LUA_CAIRO)
Expand All @@ -352,8 +339,8 @@ if(BUILD_LUA_CAIRO)
endif(BUILD_LUA_CAIRO)
if(BUILD_LUA_IMLIB2)
pkg_search_module(IMLIB2 REQUIRED imlib2 Imlib2)
set(luaimlib2_libs ${IMLIB2_LIB} ${LUA_LIBRARIES})
set(luaimlib2_includes ${IMLIB2_INCLUDE_PATH} ${LUA_INCLUDE_DIRS})
set(luaimlib2_libs ${IMLIB2_LIBS} ${IMLIB2_LDFLAGS} ${LUA_LIBRARIES})
set(luaimlib2_includes ${IMLIB2_INCLUDE_DIRS} ${LUA_INCLUDE_DIRS} ${X11_INCLUDE_DIR})
endif(BUILD_LUA_IMLIB2)
if(BUILD_LUA_RSVG)
pkg_check_modules(RSVG REQUIRED librsvg-2.0)
Expand Down Expand Up @@ -419,14 +406,14 @@ endif(BUILD_NVIDIA)

if(BUILD_IMLIB2)
pkg_search_module(IMLIB2 REQUIRED imlib2 Imlib2)
set(conky_libs ${conky_libs} ${IMLIB2_LIB} ${IMLIB2_LDFLAGS})
set(conky_includes ${conky_includes} ${IMLIB2_INCLUDE_PATH})
set(conky_libs ${conky_libs} ${IMLIB2_LIBS} ${IMLIB2_LDFLAGS})
set(conky_includes ${conky_includes} ${IMLIB2_INCLUDE_DIRS})
endif(BUILD_IMLIB2)

if(BUILD_JOURNAL)
pkg_search_module(SYSTEMD REQUIRED libsystemd libsystemd-journal)
set(conky_libs ${conky_libs} ${SYSTEMD_LIB} ${SYSTEMD_LDFLAGS})
set(conky_includes ${conky_includes} ${SYSTEMD_INCLUDE_PATH})
set(conky_includes ${conky_includes} ${SYSTEMD_INCLUDE_DIRS})
endif(BUILD_JOURNAL)

if(BUILD_PULSEAUDIO)
Expand Down Expand Up @@ -457,24 +444,6 @@ if(WANT_LIBXML2)
set(conky_includes ${conky_includes} ${LIBXML2_INCLUDE_DIR})
endif(WANT_LIBXML2)

if(WANT_TOLUA)
find_program(APP_TOLUA NAMES toluapp tolua++ tolua++5.1 tolua++-5.1)
if(NOT APP_TOLUA)
message(FATAL_ERROR "Unable to find program 'tolua++'")
endif(NOT APP_TOLUA)
find_library(TOLUA_LIBS NAMES toluapp tolua++ tolua++5.1 tolua++-5.1)
find_path(TOLUA_INCLUDE_PATH tolua++.h ${INCLUDE_SEARCH_PATH})
if(TOLUA_INCLUDE_PATH AND TOLUA_LIBS)
set(TOLUA_FOUND true)
else(TOLUA_INCLUDE_PATH AND TOLUA_LIBS)
message(FATAL_ERROR "Unable to find tolua++ library")
endif(TOLUA_INCLUDE_PATH AND TOLUA_LIBS)
mark_as_advanced(APP_TOLUA TOLUA_INCLUDE_PATH TOLUA_LIBS)
set(conky_includes ${conky_includes} ${TOLUA_INCLUDE_PATH})
set(conky_libs ${conky_libs} ${TOLUA_LIBS})
set(LUA_EXTRAS true)
endif(WANT_TOLUA)

# Look for doc generation programs
if(MAINTAINER_MODE)
# Used for doc generation
Expand Down
5 changes: 4 additions & 1 deletion cmake/ToLua.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ else()
SET(TOLUA_OUT ${CMAKE_CURRENT_BINARY_DIR}/lib${FIL_WE}.c)
endif(DEFINED ARGV2)

ADD_CUSTOM_COMMAND( OUTPUT ${TOLUA_OUT} ${INCL} COMMAND ${APP_TOLUA} -n
set(ENV{TOLUAPP_PACKAGE_PATH} ${CMAKE_SOURCE_DIR}/3rdparty/toluapp/src/bin/lua/)

ADD_CUSTOM_COMMAND( OUTPUT ${TOLUA_OUT} ${INCL} COMMAND
toluapp -n
${FIL_WE} -o ${TOLUA_OUT} ${ABS_FIL} DEPENDS
${ABS_FIL} COMMENT "Running tolua++ on ${FIL}"
VERBATIM )
Expand Down
4 changes: 0 additions & 4 deletions cmake/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,6 @@

#cmakedefine BUILD_LUA_RSVG 1

#if defined(BUILD_LUA_CAIRO) || defined(BUILD_LUA_IMLIB2) || defined(BUILD_LUA_RSVG)
#define BUILD_LUA_EXTRAS
#endif

#cmakedefine BUILD_IBM 1

#cmakedefine BUILD_RSS 1
Expand Down
Loading

0 comments on commit 47aa0c4

Please sign in to comment.