media-libs/libquvi: support luajit and lua5.4

libquvi used to build only with lua version 5.1
- the configure.ac file is to be patched in order to be able to build with luajit
- the second patch allow build with lua version 5.4

Closes: https://bugs.gentoo.org/504876
Signed-off-by: Jocelyn-MAYER <l_indien@mailmagic.fr>
Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
Jocelyn-MAYER
2022-12-29 18:21:30 +00:00
committed by Sam James
parent 81ef4172f6
commit 2b5021931a
3 changed files with 154 additions and 0 deletions
@@ -0,0 +1,70 @@
--- libquvi-0.9.4/src/lua/init.c 2013-11-04 13:55:26.000000000 +0100
+++ libquvi-0.9.4/src/lua/init.c 2022-12-29 09:25:41.579621070 +0100
@@ -43,11 +43,19 @@ static const luaL_Reg quvi_reg_meth[] =
static const luaL_Reg quvi_http_reg_meth[] =
{
+#if (LUA_VERSION_NUM == 501)
{"metainfo", l_quvi_http_metainfo},
{"resolve", l_quvi_http_resolve},
{"cookie", l_quvi_http_cookie},
{"header", l_quvi_http_header},
{"fetch", l_quvi_http_fetch},
+#elif (LUA_VERSION_NUM >= 504)
+ {"quvi.http.metainfo", l_quvi_http_metainfo},
+ {"quvi.http.resolve", l_quvi_http_resolve},
+ {"quvi.http.cookie", l_quvi_http_cookie},
+ {"quvi.http.header", l_quvi_http_header},
+ {"quvi.http.fetch", l_quvi_http_fetch},
+#endif
{NULL, NULL}
};
@@ -57,9 +65,15 @@ extern gint l_quvi_crypto_hash(lua_State
static const luaL_Reg quvi_crypto_reg_meth[] =
{
+#if (LUA_VERSION_NUM == 501)
{"encrypt", l_quvi_crypto_encrypt},
{"decrypt", l_quvi_crypto_decrypt},
{"hash", l_quvi_crypto_hash},
+#elif (LUA_VERSION_NUM >= 504)
+ {"quvi.crypto.encrypt", l_quvi_crypto_encrypt},
+ {"quvi.crypto.decrypt", l_quvi_crypto_decrypt},
+ {"quvi.crypto.hash", l_quvi_crypto_hash},
+#endif
{NULL, NULL}
};
@@ -68,8 +82,13 @@ extern gint l_quvi_base64_decode(lua_Sta
static const luaL_Reg quvi_base64_reg_meth[] =
{
+#if (LUA_VERSION_NUM == 501)
{"encode", l_quvi_base64_encode},
{"decode", l_quvi_base64_decode},
+#elif (LUA_VERSION_NUM >= 504)
+ {"quvi.base64.encode", l_quvi_base64_encode},
+ {"quvi.base64.decode", l_quvi_base64_decode},
+#endif
{NULL, NULL}
};
@@ -80,10 +99,17 @@ QuviError l_init(_quvi_t q)
return (QUVI_ERROR_LUA_INIT);
luaL_openlibs(q->handle.lua);
+#if (LUA_VERSION_NUM == 501)
luaL_register(q->handle.lua, "quvi", quvi_reg_meth);
luaL_register(q->handle.lua, "quvi.http", quvi_http_reg_meth);
luaL_register(q->handle.lua, "quvi.crypto", quvi_crypto_reg_meth);
luaL_register(q->handle.lua, "quvi.base64", quvi_base64_reg_meth);
+#elif (LUA_VERSION_NUM >= 504)
+ luaL_newlib(q->handle.lua, quvi_reg_meth);
+ luaL_newlib(q->handle.lua, quvi_http_reg_meth);
+ luaL_newlib(q->handle.lua, quvi_crypto_reg_meth);
+ luaL_newlib(q->handle.lua, quvi_base64_reg_meth);
+#endif
return (QUVI_OK);
}
@@ -0,0 +1,15 @@
--- libquvi-0.9.4/configure.ac 2021-10-20 13:44:09.834182117 +0200
+++ libquvi-0.9.4/configure.ac 2021-10-20 13:46:23.611188250 +0200
@@ -85,7 +85,9 @@ AC_SUBST([VALGRIND])
PKG_CHECK_MODULES([liblua], [lua >= 5.1], [], [
PKG_CHECK_MODULES([liblua], [lua51 >= 5.1], [], [
PKG_CHECK_MODULES([liblua], [lua5.1 >= 5.1], [], [
- PKG_CHECK_MODULES(liblua, [lua-5.1 >= 5.1])])
+ PKG_CHECK_MODULES([liblua], [lua-5.1 >= 5.1], [], [
+ PKG_CHECK_MODULES(liblua, [luajit])])
+ ])
])
])
PKG_CHECK_MODULES([libproxy], [libproxy-1.0 >= 0.3.1])
@@ -0,0 +1,69 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
LUA_COMPAT=( lua5-1 )
LUA_REQ_USE="deprecated"
inherit autotools lua-single
DESCRIPTION="Library for parsing video download links"
HOMEPAGE="http://quvi.sourceforge.net/"
SRC_URI="mirror://sourceforge/quvi/${PV:0:3}/${P}.tar.xz"
LICENSE="AGPL-3"
SLOT="0/8" # subslot = libquvi soname version
KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~ppc ~ppc64 ~sparc ~x86"
IUSE="examples nls static-libs"
REQUIRED_USE="${LUA_REQUIRED_USE}"
RDEPEND="
${LUA_DEPS}
>=dev-libs/glib-2.34.3:2
>=dev-libs/libgcrypt-1.5.3:0=
>=media-libs/libquvi-scripts-0.9.20130903[${LUA_SINGLE_USEDEP}]
!<media-libs/quvi-0.4.0
>=net-libs/libproxy-0.4.11-r1
>=net-misc/curl-7.36.0
nls? ( >=virtual/libintl-0-r1 )
"
DEPEND="${RDEPEND}"
BDEPEND="
app-arch/xz-utils
virtual/pkgconfig
nls? ( sys-devel/gettext )
"
PATCHES=(
"${FILESDIR}"/${PN}-0.9.1-headers-reinstall.patch
"${FILESDIR}"/${PN}-0.9.4-autoconf-2.70.patch #749816
"${FILESDIR}"/${PN}-0.9.4-luajit.patch # 504876
"${FILESDIR}"/${PN}-0.9.4-luaL_setfuncs_ver.patch # 504876
)
src_prepare() {
default
eautoreconf
}
src_configure() {
local myeconfargs=(
$(use_enable nls)
--with-manual
)
econf "${myeconfargs[@]}"
}
src_install() {
default
einstalldocs
use examples && dodoc -r examples
find "${ED}" -name '*.la' -delete || die
}