dev-lang/lua: Add from Gentoo

It's from Gentoo commit 6bdbc578b28bc576068247ac6a76931055532146.
This commit is contained in:
Krzesimir Nowak 2023-04-25 12:57:23 +02:00
parent 986af6e691
commit 264a941f76
9 changed files with 256 additions and 0 deletions

View File

@ -0,0 +1,3 @@
DIST lua-5.1.5.tar.xz 397416 BLAKE2B ef3880d78be1def383a9db6753b7aec4160f6fa8719529c2ea6266015771a23a1be81424520de10bb087a86081f1ec48c58c36eb8b24bff53adb6bd8d791e31b SHA512 bd827cb2e63cd71d15d846eb29c8745bf869e7b70e12c565ce173623d1fcd29dabf4d33a99c48f294151bb580d830c112cf178e2d80a5a5c36acc7b3bfcd7d24
DIST lua-5.3.6.tar.xz 541220 BLAKE2B c356cec06b14cdcbb29e382c951491432a3189618f9fd8c8832bdc8c831640fbcb9e212db05b61a577633c5fe9831e75a158cb97720c1e51cab27544526c9e24 SHA512 9a632a90806fa71398d70be7d38769065c1258fd94709cef72236753b42131b8d30da2a5dd28c74211ef8d04b0c30f52d0c593d49c2e8686568c8896b69577d7
DIST lua-5.4.4.tar.xz 606456 BLAKE2B ba6cad647c0171e5e737151b189b5b404948c08182e9f17d7974a6c6c3b7d99b03cf930add863188db22674b8613fc600d771f62f9dfc99232aab9caea9b073c SHA512 8f3950ed5972a29d7c79e72af617526f6b9f6be7ab268e66206d7e453acc2564541c9d01e2de08a7e9046ab24c66b02167e48a0d5764753befd95dc922b61219

View File

@ -0,0 +1,20 @@
https://salsa.debian.org/lua-team/lua5.1/-/blob/master/debian/patches/0003-extern_C.patch
From: "John V. Belmonte" <jbelmonte@debian.org>
Date: Tue, 26 Aug 2014 16:20:49 +0200
Subject: extern_C
--- a/src/luaconf.h.in
+++ b/src/luaconf.h.in
@@ -168,7 +168,11 @@
#else
+#ifdef __cplusplus
+#define LUA_API extern "C"
+#else
#define LUA_API extern
+#endif
#endif

View File

@ -0,0 +1,17 @@
https://salsa.debian.org/lua-team/lua5.1/-/blob/master/debian/patches/0004-Fix-stack-overflow-in-vararg-functions.patch
From: Enrico Tassi <gareuselesinge@debian.org>
Date: Tue, 26 Aug 2014 16:20:55 +0200
Subject: Fix stack overflow in vararg functions (CVE-2014-5461)
--- a/src/ldo.c
+++ b/src/ldo.c
@@ -274,7 +274,7 @@ int luaD_precall (lua_State *L, StkId func, int nresults) {
CallInfo *ci;
StkId st, base;
Proto *p = cl->p;
- luaD_checkstack(L, p->maxstacksize);
+ luaD_checkstack(L, p->maxstacksize + p->numparams);
func = restorestack(L, funcr);
if (!p->is_vararg) { /* no varargs? */
base = func + 1;

View File

@ -0,0 +1,11 @@
--- a/test/sieve.lua
+++ b/test/sieve.lua
@@ -14,7 +14,7 @@
while 1 do
local n = g()
if n == nil then return end
- if math.mod(n, p) ~= 0 then coroutine.yield(n) end
+ if math.fmod(n, p) ~= 0 then coroutine.yield(n) end
end
end)
end

View File

@ -0,0 +1,34 @@
From https://github.com/lua/lua/commit/1f3c6f4534c6411313361697d98d1145a1f030fa Mon Sep 17 00:00:00 2001
From: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date: Tue, 15 Feb 2022 12:28:46 -0300
Subject: [PATCH] Bug: Lua can generate wrong code when _ENV is <const>
--- a/src/lparser.c
+++ b/src/lparser.c
@@ -468,6 +468,7 @@ static void singlevar (LexState *ls, expdesc *var) {
expdesc key;
singlevaraux(fs, ls->envn, var, 1); /* get environment variable */
lua_assert(var->k != VVOID); /* this one must exist */
+ luaK_exp2anyregup(fs, var); /* but could be a constant */
codestring(&key, varname); /* key is variable name */
luaK_indexed(fs, var, &key); /* env[varname] */
}
--- a/tests/attrib.lua
+++ b/tests/attrib.lua
@@ -434,6 +434,16 @@ a.aVeryLongName012345678901234567890123456789012345678901234567890123456789 ==
10)
+do
+ -- _ENV constant
+ local function foo ()
+ local _ENV <const> = 11
+ X = "hi"
+ end
+ local st, msg = pcall(foo)
+ assert(not st and string.find(msg, "number"))
+end
+
-- test of large float/integer indices

View File

@ -0,0 +1,49 @@
# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit optfeature
DESCRIPTION="A powerful light-weight programming language designed for extending applications"
HOMEPAGE="https://www.lua.org/"
# tarballs produced from ${PV} branches in https://gitweb.gentoo.org/proj/lua-patches.git
SRC_URI="https://dev.gentoo.org/~soap/distfiles/${P}.tar.xz"
LICENSE="MIT"
SLOT="5.1"
KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
IUSE="+deprecated readline"
DEPEND="
>=app-eselect/eselect-lua-3
readline? ( sys-libs/readline:= )
!dev-lang/lua:0"
RDEPEND="${DEPEND}"
BDEPEND="virtual/pkgconfig"
PATCHES=( "${FILESDIR}"/${SLOT} )
src_prepare() {
! use deprecated && PATCHES+=(
"${FILESDIR}"/${PN}-5.1.4-test.patch
)
default
}
src_configure() {
econf \
$(use_enable deprecated) \
$(use_with readline)
}
src_install() {
default
find "${ED}" -name '*.la' -delete || die
}
pkg_postinst() {
eselect lua set --if-unset "${PN}${SLOT}"
optfeature "Lua support for Emacs" app-emacs/lua-mode
}

View File

@ -0,0 +1,50 @@
# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit flag-o-matic optfeature
DESCRIPTION="A powerful light-weight programming language designed for extending applications"
HOMEPAGE="https://www.lua.org/"
# tarballs produced from ${PV} branches in https://gitweb.gentoo.org/proj/lua-patches.git
SRC_URI="https://dev.gentoo.org/~soap/distfiles/${P}.tar.xz"
LICENSE="MIT"
SLOT="5.3"
KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
IUSE="+deprecated readline"
DEPEND="
>=app-eselect/eselect-lua-3
readline? ( sys-libs/readline:= )
!dev-lang/lua:0"
RDEPEND="${DEPEND}"
BDEPEND="virtual/pkgconfig"
src_prepare() {
default
if use elibc_musl; then
# locales on musl are non-functional (#834153)
# https://wiki.musl-libc.org/open-issues.html#Locale-limitations
sed -e 's|os.setlocale("pt_BR") or os.setlocale("ptb")|false|g' \
-i tests/literals.lua || die
fi
}
src_configure() {
use deprecated && append-cppflags -DLUA_COMPAT_5_1 -DLUA_COMPAT_5_2
econf $(use_with readline)
}
src_install() {
default
find "${ED}" -name '*.la' -delete || die
}
pkg_postinst() {
eselect lua set --if-unset "${PN}${SLOT}"
optfeature "Lua support for Emacs" app-emacs/lua-mode
}

View File

@ -0,0 +1,54 @@
# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit flag-o-matic optfeature
DESCRIPTION="A powerful light-weight programming language designed for extending applications"
HOMEPAGE="https://www.lua.org/"
# tarballs produced from ${PV} branches in https://gitweb.gentoo.org/proj/lua-patches.git
SRC_URI="https://dev.gentoo.org/~soap/distfiles/${P}.tar.xz"
LICENSE="MIT"
SLOT="5.4"
KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
IUSE="+deprecated readline"
DEPEND="
>=app-eselect/eselect-lua-3
readline? ( sys-libs/readline:= )
!dev-lang/lua:0"
RDEPEND="${DEPEND}"
BDEPEND="virtual/pkgconfig"
PATCHES=(
"${FILESDIR}/${P}-lparser-overread.patch"
)
src_prepare() {
default
if use elibc_musl; then
# locales on musl are non-functional (#834153)
# https://wiki.musl-libc.org/open-issues.html#Locale-limitations
sed -e 's|os.setlocale("pt_BR") or os.setlocale("ptb")|false|g' \
-i tests/literals.lua || die
fi
}
src_configure() {
use deprecated && append-cppflags -DLUA_COMPAT_5_3
econf $(use_with readline)
}
src_install() {
default
find "${ED}" -name '*.la' -delete || die
}
pkg_postinst() {
eselect lua set --if-unset "${PN}${SLOT}"
optfeature "Lua support for Emacs" app-emacs/lua-mode
}

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<email>williamh@gentoo.org</email>
<name>William Hubbs</name>
</maintainer>
<maintainer type="person">
<email>robbat2@gentoo.org</email>
<name>Robin H. Johnson</name>
</maintainer>
<use>
<flag name="deprecated">make deprecated data structures/routines available</flag>
</use>
<upstream>
<remote-id type="github">lua/lua</remote-id>
</upstream>
</pkgmetadata>