diff --git a/packages/luvi/build.sh b/packages/luvi/build.sh new file mode 100644 index 000000000000000..6b83d943b45896a --- /dev/null +++ b/packages/luvi/build.sh @@ -0,0 +1,52 @@ +TERMUX_PKG_HOMEPAGE=https://luvit.io +TERMUX_PKG_DESCRIPTION="A project in-between luv and luvit." +TERMUX_PKG_LICENSE="Apache-2.0" +TERMUX_PKG_MAINTAINER="Komo @cattokomo" +TERMUX_PKG_VERSION=20240216 +_commit=b85da58f2549a519486a7296f5b836a8f6a64880 +_version=2.14.0 +TERMUX_PKG_GIT_BRANCH=master +TERMUX_PKG_SRCURL=git+https://github.com/luvit/luvi.git +TERMUX_PKG_DEPENDS="pcre, openssl, luv, lua51-lpeg, libluajit" +TERMUX_PKG_BUILD_DEPENDS="luv, lua51-lpeg" +TERMUX_PKG_SUGGESTS="lit, luvit" +TERMUX_PKG_BUILD_IN_SRC=true +TERMUX_PKG_EXTRA_CONFIGURE_ARGS=" + -DWithSharedLibluv=On + -DWithOpenSSL=On + -DWithSharedOpenSSL=On + -DWithPCRE=On + -DWithSharedPCRE=On + -DWithLPEG=On + -DWithSharedLPEG=On +" + +termux_step_post_get_source() { + git checkout "${_commit}" +} + +termux_step_pre_configure() { + declare include=${TERMUX_PREFIX}/include lib=${TERMUX_PREFIX}/lib + TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" + -DLIBLUV_INCLUDE_DIR=${TERMUX_PKG_SRCDIR}/deps/luv/src + -DLIBLUV_LIBRARIES=$lib/libluv.so + -DLUAJIT_INCLUDE_DIR=$include/luajit-2.1 + -DLUAJIT_LIBRARIES=$lib/libluajit.so + -DLIBUV_INCLUDE_DIR=$include + -DLIBUV_LIBRARIES=$lib/libuv.so + -DOPENSSL_INCLUDE_DIR=$include + -DOPENSSL_LIBRARIES=$lib + -DPCRE_INCLUDE_DIR=$include + -DPCRE_LIBRARIES=$lib + " + + TARGET_ARCH=${TERMUX_ARCH} + case "${TARGET_ARCH}" in + x86_64) TARGET_ARCH=x64 ;; + i686) TARGET_ARCH=x86 ;; + aarch64) TARGET_ARCH=arm64 ;; + esac + export TARGET_ARCH + + echo "$_version" >"${TERMUX_PKG_SRCDIR}/VERSION" +} diff --git a/packages/luvi/fix-lua-openssl-src.patch b/packages/luvi/fix-lua-openssl-src.patch new file mode 100644 index 000000000000000..f4d441e65197784 --- /dev/null +++ b/packages/luvi/fix-lua-openssl-src.patch @@ -0,0 +1,58 @@ +diff --git a/deps/lua-openssl.cmake b/deps/lua-openssl.cmake +index a3aa4a0..5bbd61d 100644 +--- a/deps/lua-openssl.cmake ++++ b/deps/lua-openssl.cmake +@@ -24,47 +24,13 @@ else() + add_definitions(-DPTHREADS) + endif() + ++file(GLOB cfiles ${LUA_OPENSSL_DIR}/src/*.c) ++file(GLOB hfiles ${LUA_OPENSSL_DIR}/src/*.h) ++file(GLOB auxfiles ${LUA_OPENSSL_DIR}/deps/auxiliar/*.c) + add_library(lua_openssl +- ${LUA_OPENSSL_DIR}/deps/auxiliar/auxiliar.c +- ${LUA_OPENSSL_DIR}/deps/auxiliar/subsidiar.c +- ${LUA_OPENSSL_DIR}/src/asn1.c +- ${LUA_OPENSSL_DIR}/src/bio.c +- ${LUA_OPENSSL_DIR}/src/callback.c +- ${LUA_OPENSSL_DIR}/src/cipher.c +- ${LUA_OPENSSL_DIR}/src/cms.c +- ${LUA_OPENSSL_DIR}/src/compat.c +- ${LUA_OPENSSL_DIR}/src/crl.c +- ${LUA_OPENSSL_DIR}/src/csr.c +- ${LUA_OPENSSL_DIR}/src/dh.c +- ${LUA_OPENSSL_DIR}/src/digest.c +- ${LUA_OPENSSL_DIR}/src/dsa.c +- ${LUA_OPENSSL_DIR}/src/ec.c +- ${LUA_OPENSSL_DIR}/src/engine.c +- ${LUA_OPENSSL_DIR}/src/hmac.c +- ${LUA_OPENSSL_DIR}/src/kdf.c +- ${LUA_OPENSSL_DIR}/src/lbn.c +- ${LUA_OPENSSL_DIR}/src/lhash.c +- ${LUA_OPENSSL_DIR}/src/misc.c +- ${LUA_OPENSSL_DIR}/src/ocsp.c +- ${LUA_OPENSSL_DIR}/src/oids.txt +- ${LUA_OPENSSL_DIR}/src/openssl.c +- ${LUA_OPENSSL_DIR}/src/ots.c +- ${LUA_OPENSSL_DIR}/src/pkcs12.c +- ${LUA_OPENSSL_DIR}/src/pkcs7.c +- ${LUA_OPENSSL_DIR}/src/pkey.c +- ${LUA_OPENSSL_DIR}/src/private.h +- ${LUA_OPENSSL_DIR}/src/rsa.c +- ${LUA_OPENSSL_DIR}/src/sk.h +- ${LUA_OPENSSL_DIR}/src/srp.c +- ${LUA_OPENSSL_DIR}/src/ssl.c +- ${LUA_OPENSSL_DIR}/src/th-lock.c +- ${LUA_OPENSSL_DIR}/src/util.c +- ${LUA_OPENSSL_DIR}/src/x509.c +- ${LUA_OPENSSL_DIR}/src/xattrs.c +- ${LUA_OPENSSL_DIR}/src/xexts.c +- ${LUA_OPENSSL_DIR}/src/xname.c +- ${LUA_OPENSSL_DIR}/src/xalgor.c +- ${LUA_OPENSSL_DIR}/src/xstore.c ++ ${auxfiles} ++ ${cfiles} ++ ${hfiles} + ) + + set_target_properties(lua_openssl PROPERTIES COMPILE_FLAGS "-DLUA_LIB") diff --git a/packages/luvi/fix-re-not-found.patch b/packages/luvi/fix-re-not-found.patch new file mode 100644 index 000000000000000..7b9a59e21ea555a --- /dev/null +++ b/packages/luvi/fix-re-not-found.patch @@ -0,0 +1,23 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 7aa6eaa..0ce5058 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -157,9 +157,6 @@ if (WITH_LUA_ENGINE STREQUAL Lua) + add_definitions(-DWITH_PLAIN_LUA) + endif () + +-if(LPEGLIB_DIR) +- set(lpeg_re_lua ${LPEGLIB_DIR}/re.lua) +-endif() + lua_add_executable(luvi + ${winsvc} + src/main.c +@@ -167,7 +164,7 @@ lua_add_executable(luvi + src/lua/init.lua + src/lua/luvipath.lua + src/lua/luvibundle.lua +- ${lpeg_re_lua} ++ deps/lpeg/re.lua + ) + + if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") diff --git a/packages/luvi/luajit-c-bytecode.patch b/packages/luvi/luajit-c-bytecode.patch new file mode 100644 index 000000000000000..f1fee36d0ca2fae --- /dev/null +++ b/packages/luvi/luajit-c-bytecode.patch @@ -0,0 +1,20 @@ +diff --git a/cmake/Modules/LuaJITAddExecutable.cmake b/cmake/Modules/LuaJITAddExecutable.cmake +index e250d08..22d53ae 100644 +--- a/cmake/Modules/LuaJITAddExecutable.cmake ++++ b/cmake/Modules/LuaJITAddExecutable.cmake +@@ -24,7 +24,7 @@ MACRO(LUAJIT_add_custom_commands luajit_target) + math(EXPR _stripped_file_length "${_luajit_file_length} - ${_luajit_source_dir_length} - 1") + string(SUBSTRING ${file} ${_begin} ${_stripped_file_length} stripped_file) + +- set(generated_file "${CMAKE_BINARY_DIR}/jitted_tmp/${stripped_file}_${luajit_target}_generated${CMAKE_C_OUTPUT_EXTENSION}") ++ set(generated_file "${CMAKE_BINARY_DIR}/jitted_tmp/${stripped_file}_${luajit_target}_generated.c") + + # Only use LUA_PATH if it's set + IF(LUA_PATH) +@@ -67,5 +67,6 @@ ENDMACRO() + + MACRO(LUA_ADD_EXECUTABLE luajit_target) + LUAJIT_add_custom_commands(${luajit_target} ${ARGN}) ++ message("-- target: ${target_srcs}") + add_executable(${luajit_target} ${target_srcs}) + ENDMACRO(LUA_ADD_EXECUTABLE luajit_target)