From b945d8c7e2e7cb34fd5cd82ec67ef9402dec5e7f Mon Sep 17 00:00:00 2001 From: Ricky Wu Date: Tue, 11 Oct 2016 17:03:50 +0800 Subject: [PATCH] luacom for lua5.1 (#1804) * luacom for lua5.1 * add pkgbase for luacom --- .../001-Fix-Lua51-prefix.patch | 13 ++++ mingw-w64-lua-luacom-git/002-CMake-AR.patch | 14 ++++ .../003-Lua_51_PATH.patch | 16 +++++ mingw-w64-lua-luacom-git/004-Lua_51_INC.patch | 32 +++++++++ mingw-w64-lua-luacom-git/PKGBUILD | 69 +++++++++++++++++++ mingw-w64-lua-luacom-git/luacom.def | 6 ++ mingw-w64-lua-luacom-git/luacom.pc | 11 +++ 7 files changed, 161 insertions(+) create mode 100644 mingw-w64-lua-luacom-git/001-Fix-Lua51-prefix.patch create mode 100644 mingw-w64-lua-luacom-git/002-CMake-AR.patch create mode 100644 mingw-w64-lua-luacom-git/003-Lua_51_PATH.patch create mode 100644 mingw-w64-lua-luacom-git/004-Lua_51_INC.patch create mode 100644 mingw-w64-lua-luacom-git/PKGBUILD create mode 100644 mingw-w64-lua-luacom-git/luacom.def create mode 100644 mingw-w64-lua-luacom-git/luacom.pc diff --git a/mingw-w64-lua-luacom-git/001-Fix-Lua51-prefix.patch b/mingw-w64-lua-luacom-git/001-Fix-Lua51-prefix.patch new file mode 100644 index 0000000000..024bbfdc6e --- /dev/null +++ b/mingw-w64-lua-luacom-git/001-Fix-Lua51-prefix.patch @@ -0,0 +1,13 @@ +Binary files luacom-org/.git/index and luacom/.git/index differ +diff -rup luacom-org/cmake/lua.cmake luacom/cmake/lua.cmake +--- luacom-org/cmake/lua.cmake 2016-01-07 13:09:07.004304800 +0800 ++++ luacom/cmake/lua.cmake 2016-01-07 12:30:43.228024000 +0800 +@@ -251,7 +251,7 @@ endmacro () + # [1] http://lua-users.org/wiki/BinToCee + # [2] http://lua-users.org/wiki/LuaCompilerInLua + function ( add_lua_bin2c _target _source ) +- find_program ( LUA NAMES lua lua.bat ) ++ find_program ( LUA NAMES lua lua.bat lua5.1) + execute_process ( COMMAND ${LUA} -e "string.dump(function()end)" + RESULT_VARIABLE _LUA_DUMP_RESULT ERROR_QUIET ) + if ( NOT ${_LUA_DUMP_RESULT} ) diff --git a/mingw-w64-lua-luacom-git/002-CMake-AR.patch b/mingw-w64-lua-luacom-git/002-CMake-AR.patch new file mode 100644 index 0000000000..cc18352929 --- /dev/null +++ b/mingw-w64-lua-luacom-git/002-CMake-AR.patch @@ -0,0 +1,14 @@ +Binary files luacom-org/.git/index and luacom/.git/index differ +diff -rup luacom-org/CMakeLists.txt luacom/CMakeLists.txt +--- luacom-org/CMakeLists.txt 2016-01-07 13:09:06.994305000 +0800 ++++ luacom/CMakeLists.txt 2016-01-08 08:07:54.227239700 +0800 +@@ -63,6 +63,9 @@ if ( HAVE_HTMLHELP ) + set ( LIBS ${LIBS} htmlhelp ) + endif ( ) + ++SET(CMAKE_CXX_ARCHIVE_APPEND "") ++SET(CMAKE_C_ARCHIVE_APPEND "") ++ + add_lua_bin2c ( ${CMAKE_CURRENT_BINARY_DIR}/luacom5.loh src/library/luacom5.lua ${CMAKE_CURRENT_SOURCE_DIR}/mak/bin2c.lua + ${CMAKE_CURRENT_SOURCE_DIR}/mak/luac.lua ) + set_source_files_properties ( src/library/luacom.cpp PROPERTIES OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/luacom5.loh ) diff --git a/mingw-w64-lua-luacom-git/003-Lua_51_PATH.patch b/mingw-w64-lua-luacom-git/003-Lua_51_PATH.patch new file mode 100644 index 0000000000..4a34fc0045 --- /dev/null +++ b/mingw-w64-lua-luacom-git/003-Lua_51_PATH.patch @@ -0,0 +1,16 @@ +Binary files luacom-org/.git/index and luacom/.git/index differ +diff -rup luacom-org/cmake/lua.cmake luacom/cmake/lua.cmake +--- luacom-org/cmake/lua.cmake 2016-01-07 13:09:07.004304800 +0800 ++++ luacom/cmake/lua.cmake 2016-01-08 08:37:51.345072900 +0800 +@@ -6,9 +6,9 @@ + # For details see the COPYRIGHT file distributed with LuaDist. + # Please note that the package source code is licensed under its own license. + +-set ( INSTALL_LMOD ${INSTALL_LIB}/lua ++set ( INSTALL_LMOD ${INSTALL_LIB}/lua/5.1 + CACHE PATH "Directory to install Lua modules." ) +-set ( INSTALL_CMOD ${INSTALL_LIB}/lua ++set ( INSTALL_CMOD ${INSTALL_LIB}/lua/5.1 + CACHE PATH "Directory to install Lua binary modules." ) + + option ( SKIP_LUA_WRAPPER diff --git a/mingw-w64-lua-luacom-git/004-Lua_51_INC.patch b/mingw-w64-lua-luacom-git/004-Lua_51_INC.patch new file mode 100644 index 0000000000..6df56850f4 --- /dev/null +++ b/mingw-w64-lua-luacom-git/004-Lua_51_INC.patch @@ -0,0 +1,32 @@ +diff --git a/src/dll/luacom_dll.cpp b/src/dll/luacom_dll.cpp +index d56b477..e5b5158 100644 +--- a/src/dll/luacom_dll.cpp ++++ b/src/dll/luacom_dll.cpp +@@ -1,9 +1,9 @@ + + #include + extern "C" { +- #include "lua.h" +- #include "lualib.h" +- #include "lauxlib.h" ++ #include "lua5.1/lua.h" ++ #include "lua5.1/lualib.h" ++ #include "lua5.1/lauxlib.h" + #ifdef IUP + #include "iup.h" + #ifndef NO_CPICONTROLS +diff --git a/src/library/luacom.cpp b/src/library/luacom.cpp +index e8ea9d9..7349fa8 100644 +--- a/src/library/luacom.cpp ++++ b/src/library/luacom.cpp +@@ -23,8 +23,8 @@ static char const * const rcsid = "$Id: luacom$"; + + extern "C" + { +-#include "lua.h" +-#include "lauxlib.h" ++#include "lua5.1/lua.h" ++#include "lua5.1/lauxlib.h" + } + #include "LuaCompat.h" + diff --git a/mingw-w64-lua-luacom-git/PKGBUILD b/mingw-w64-lua-luacom-git/PKGBUILD new file mode 100644 index 0000000000..f9c59e0eec --- /dev/null +++ b/mingw-w64-lua-luacom-git/PKGBUILD @@ -0,0 +1,69 @@ +# Maintainer: Ricky Wu + +_realname=luacom +pkgbase=mingw-w64-${_realname}-git +pkgname="${MINGW_PACKAGE_PREFIX}-lua51-${_realname}-git" +pkgver=v1.4.1.4.g8f818f5 +pkgrel=1 +pkgdesc="Microsoft's Component Object Model (COM) Lua interface" +arch=('any') +url="http://luaforge.net/projects/luacom/" +license=("LGPL") +makedepends=("${MINGW_PACKAGE_PREFIX}-gcc" "${MINGW_PACKAGE_PREFIX}-cmake") +depends=("${MINGW_PACKAGE_PREFIX}-lua51") +options=('staticlibs' 'strip') +source=("${_realname}"::"git+https://github.com/davidm/${_realname}.git" + "luacom.def" + "luacom.pc" + "001-Fix-Lua51-prefix.patch" + "002-CMake-AR.patch" + "003-Lua_51_PATH.patch" + "004-Lua_51_INC.patch") + +sha256sums=('SKIP' + '59d441b5cd0220d1048ca9e35bde2ba14dae0e5e3b671d53ac6f6d919ca94e60' + '658379536b0481dba9848f436abc88b7f2beea68259e5ef8184c95aa55411a14' + '7da5b2ad84bd06777a1d89e2ee4579adac7cfe41dbccc4ae9aeda5a303486a36' + '70159ab03aa9f52175572339648d31db519beb5f2b89827d668268f7462a732d' + '1512f081025ee54d5d3144c530de89c1ce90ff6e7d1e5e861833fc044fe605ff' + 'a2944c3cdc37053f7c0d58913a3f7db64387f8f24718b71d3b417a863dfef58e') + +pkgver() { + cd "${srcdir}/${_realname}" + git describe --tags | sed 's|-|.|g' +} + +prepare() { + cd "${srcdir}"/${_realname} + patch -p1 -i ${srcdir}/001-Fix-Lua51-prefix.patch + patch -p1 -i ${srcdir}/002-CMake-AR.patch + patch -p1 -i ${srcdir}/003-Lua_51_PATH.patch + patch -p1 -i ${srcdir}/004-Lua_51_INC.patch +} + +build() { + mkdir -p "${srcdir}/${_realname}/build-${MINGW_CHOST}" + cd "${srcdir}/${_realname}/build-${MINGW_CHOST}" + + MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \ + ${MINGW_PREFIX}/bin/cmake \ + -G"MSYS Makefiles" \ + -DCMAKE_INSTALL_PREFIX="${MINGW_PREFIX}" \ + .. + + make + + dlltool -d ../../luacom.def -l libluacom.dll.a +} + +package() { + cd "${srcdir}/${_realname}/build-${MINGW_CHOST}" + make destdir=${pkgdir} install + install -Dm644 libluacom.dll.a "${pkgdir}${MINGW_PREFIX}"/lib/libluacom.dll.a + install -d "${pkgdir}${MINGW_PREFIX}"/bin + install -Dm644 luacom.dll "${pkgdir}${MINGW_PREFIX}"/bin/luacom.dll + install -d "${pkgdir}${MINGW_PREFIX}"/include + install -Dm644 "${srcdir}/${_realname}"/include/luacom.h "${pkgdir}${MINGW_PREFIX}"/include/lua5.1/luacom.h + install -d "${pkgdir}${MINGW_PREFIX}"/lib/pkgconfig + install -Dm644 "${srcdir}"/luacom.pc "${pkgdir}${MINGW_PREFIX}"/lib/pkgconfig/luacom.pc +} diff --git a/mingw-w64-lua-luacom-git/luacom.def b/mingw-w64-lua-luacom-git/luacom.def new file mode 100644 index 0000000000..dd999cd458 --- /dev/null +++ b/mingw-w64-lua-luacom-git/luacom.def @@ -0,0 +1,6 @@ +LIBRARY luacom.dll +EXPORTS + luacom_open + luacom_close + luacom_IDispatch2LuaCOM + luacom_detectAutomation diff --git a/mingw-w64-lua-luacom-git/luacom.pc b/mingw-w64-lua-luacom-git/luacom.pc new file mode 100644 index 0000000000..01b7568442 --- /dev/null +++ b/mingw-w64-lua-luacom-git/luacom.pc @@ -0,0 +1,11 @@ +prefix=/mingw64 +exec_prefix=${prefix} +libdir=${exec_prefix}/lib +includedir=${prefix}/include + +Name: LuaCom +Description: Lua COM +Version: 1.4 + +Libs: -L${libdir} -lluacom +Cflags: -I${includedir}