summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatti Bickel <mabi@gentoo.org>2012-03-17 21:23:08 +0000
committerMatti Bickel <mabi@gentoo.org>2012-03-17 21:23:08 +0000
commit077cd2355896f37192411c87ee84315f8726dd26 (patch)
treecb479c5ad341302bc3151436872e8ef2747aa6de /dev-lang
parentalpha/ia64/sparc stable (bug #399987). (diff)
downloadgentoo-2-077cd2355896f37192411c87ee84315f8726dd26.tar.gz
gentoo-2-077cd2355896f37192411c87ee84315f8726dd26.tar.bz2
gentoo-2-077cd2355896f37192411c87ee84315f8726dd26.zip
new patches for lua-5.2, see http://www.lua.org/bugs.html#5.2.0 for details
(Portage version: 2.2.0_alpha90/cvs/Linux x86_64)
Diffstat (limited to 'dev-lang')
-rw-r--r--dev-lang/lua/ChangeLog9
-rw-r--r--dev-lang/lua/files/5.2.0/01_all_memory_hoarding.upstream.patch49
-rw-r--r--dev-lang/lua/files/5.2.0/02_all_hex_number_handling.upstream.patch26
-rw-r--r--dev-lang/lua/lua-5.2.0-r1.ebuild107
4 files changed, 190 insertions, 1 deletions
diff --git a/dev-lang/lua/ChangeLog b/dev-lang/lua/ChangeLog
index 0f4387373b28..1a6d8887e8be 100644
--- a/dev-lang/lua/ChangeLog
+++ b/dev-lang/lua/ChangeLog
@@ -1,6 +1,13 @@
# ChangeLog for dev-lang/lua
# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/dev-lang/lua/ChangeLog,v 1.158 2012/03/17 20:41:46 mabi Exp $
+# $Header: /var/cvsroot/gentoo-x86/dev-lang/lua/ChangeLog,v 1.159 2012/03/17 21:23:08 mabi Exp $
+
+*lua-5.2.0-r1 (17 Mar 2012)
+
+ 17 Mar 2012; Matti Bickel <mabi@gentoo.org>
+ +files/5.2.0/01_all_memory_hoarding.upstream.patch,
+ +files/5.2.0/02_all_hex_number_handling.upstream.patch, +lua-5.2.0-r1.ebuild:
+ new patches for lua-5.2, see http://www.lua.org/bugs.html#5.2.0 for details
*lua-5.1.5 (17 Mar 2012)
diff --git a/dev-lang/lua/files/5.2.0/01_all_memory_hoarding.upstream.patch b/dev-lang/lua/files/5.2.0/01_all_memory_hoarding.upstream.patch
new file mode 100644
index 000000000000..9fda24ad6609
--- /dev/null
+++ b/dev-lang/lua/files/5.2.0/01_all_memory_hoarding.upstream.patch
@@ -0,0 +1,49 @@
+--- lua-5.2.0.orig/src/ldblib.c 2007/12/28 15:32:23 2.25.1.3
++++ lua-5.2.0/src/ldblib.c 2009/06/15 14:07:34
+@@ -253,14 +253,15 @@
+ }
+
+
+-#define gethooktable(L) luaL_getsubtable(L, LUA_REGISTRYINDEX, HOOKKEY);
++#define gethooktable(L) luaL_getsubtable(L, LUA_REGISTRYINDEX, HOOKKEY)
+
+
+ static void hookf (lua_State *L, lua_Debug *ar) {
+ static const char *const hooknames[] =
+ {"call", "return", "line", "count", "tail call"};
+ gethooktable(L);
+- lua_rawgetp(L, -1, L);
++ lua_pushthread(L);
++ lua_rawget(L, -2);
+ if (lua_isfunction(L, -1)) {
+ lua_pushstring(L, hooknames[(int)ar->event]);
+ if (ar->currentline >= 0)
+@@ -306,10 +307,15 @@
+ count = luaL_optint(L, arg+3, 0);
+ func = hookf; mask = makemask(smask, count);
+ }
+- gethooktable(L);
++ if (gethooktable(L) == 0) { /* creating hook table? */
++ lua_pushstring(L, "k");
++ lua_setfield(L, -2, "__mode"); /** hooktable.__mode = "k" */
++ lua_pushvalue(L, -1);
++ lua_setmetatable(L, -2); /* setmetatable(hooktable) = hooktable */
++ }
++ lua_pushthread(L1); lua_xmove(L1, L, 1);
+ lua_pushvalue(L, arg+1);
+- lua_rawsetp(L, -2, L1); /* set new hook */
+- lua_pop(L, 1); /* remove hook table */
++ lua_rawset(L, -3); /* set new hook */
+ lua_sethook(L1, func, mask, count); /* set hooks */
+ return 0;
+ }
+@@ -325,7 +331,8 @@
+ lua_pushliteral(L, "external hook");
+ else {
+ gethooktable(L);
+- lua_rawgetp(L, -1, L1); /* get hook */
++ lua_pushthread(L1); lua_xmove(L1, L, 1);
++ lua_rawget(L, -2); /* get hook */
+ lua_remove(L, -2); /* remove hook table */
+ }
+ lua_pushstring(L, unmakemask(mask, buff));
diff --git a/dev-lang/lua/files/5.2.0/02_all_hex_number_handling.upstream.patch b/dev-lang/lua/files/5.2.0/02_all_hex_number_handling.upstream.patch
new file mode 100644
index 000000000000..26519e378e68
--- /dev/null
+++ b/dev-lang/lua/files/5.2.0/02_all_hex_number_handling.upstream.patch
@@ -0,0 +1,26 @@
+--- lua-5.2.0.orig/src/llex.c 2007/12/28 15:32:23 2.25.1.3
++++ lua-5.2.0/src/llex.c 2009/06/15 14:07:34
+@@ -223,12 +223,19 @@
+
+ /* LUA_NUMBER */
+ static void read_numeral (LexState *ls, SemInfo *seminfo) {
++ const char *expo = "Ee";
++ int first = ls->current;
+ lua_assert(lisdigit(ls->current));
+- do {
+- save_and_next(ls);
+- if (check_next(ls, "EePp")) /* exponent part? */
++ save_and_next(ls);
++ if (first == '0' && check_next(ls, "Xx")) /* hexadecimal? */
++ expo = "Pp";
++ for (;;) {
++ if (check_next(ls, expo)) /* exponent part? */
+ check_next(ls, "+-"); /* optional exponent sign */
+- } while (lislalnum(ls->current) || ls->current == '.');
++ if (lisxdigit(ls->current) || ls->current == '.')
++ save_and_next(ls);
++ else break;
++ }
+ save(ls, '\0');
+ buffreplace(ls, '.', ls->decpoint); /* follow locale for decimal point */
+ if (!buff2d(ls->buff, &seminfo->r)) /* format error? */
diff --git a/dev-lang/lua/lua-5.2.0-r1.ebuild b/dev-lang/lua/lua-5.2.0-r1.ebuild
new file mode 100644
index 000000000000..5ff9d82c927d
--- /dev/null
+++ b/dev-lang/lua/lua-5.2.0-r1.ebuild
@@ -0,0 +1,107 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-lang/lua/lua-5.2.0-r1.ebuild,v 1.1 2012/03/17 21:23:08 mabi Exp $
+
+EAPI=4
+
+inherit eutils autotools multilib portability toolchain-funcs versionator
+
+DESCRIPTION="A powerful light-weight programming language designed for extending applications"
+HOMEPAGE="http://www.lua.org/"
+SRC_URI="http://www.lua.org/ftp/${P}.tar.gz"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd"
+IUSE="+deprecated emacs readline static"
+
+RDEPEND="readline? ( sys-libs/readline )"
+DEPEND="${RDEPEND}
+ sys-devel/libtool"
+PDEPEND="emacs? ( app-emacs/lua-mode )"
+
+src_prepare() {
+ local PATCH_PV=$(get_version_component_range 1-2)
+
+ epatch "${FILESDIR}"/${PN}-${PATCH_PV}-make.patch
+
+ EPATCH_SOURCE="${FILESDIR}/${PV}" EPATCH_SUFFIX="upstream.patch" epatch
+
+ sed -i \
+ -e 's:\(LUA_ROOT\s*\).*:\1"/usr/":' \
+ -e "s:\(LUA_CDIR\s*LUA_ROOT \"\)lib:\1$(get_libdir):" \
+ src/luaconf.h \
+ || die "failed patching luaconf.h"
+
+ # correct lua versioning
+ sed -i -e 's/\(LIB_VERSION = \)6:1:1/\17:0:2/' src/Makefile
+
+ sed -i -e 's:\(/README\)\("\):\1.gz\2:g' doc/readme.html
+
+ if ! use readline ; then
+ sed -i -e '/#define LUA_USE_READLINE/d' src/luaconf.h
+ fi
+
+ # Using dynamic linked lua is not recommended for performance
+ # reasons. http://article.gmane.org/gmane.comp.lang.lua.general/18519
+ # Mainly, this is of concern if your arch is poor with GPRs, like x86
+ # Note that this only affects the interpreter binary (named lua), not the lua
+ # compiler (built statically) nor the lua libraries (both shared and static
+ # are installed)
+ if use static ; then
+ sed -i -e 's:\(-export-dynamic\):-static \1:' src/Makefile
+ fi
+
+ # upstream does not use libtool, but we do (see bug #336167)
+ cp "${FILESDIR}/configure.in" "${S}"
+ eautoreconf
+}
+
+src_compile() {
+ tc-export CC
+
+ # what to link to liblua
+ liblibs="-lm"
+ liblibs="${liblibs} $(dlopen_lib)"
+
+ # what to link to the executables
+ mylibs=
+ use readline && mylibs="-lreadline"
+
+ cd src
+
+ local legacy=""
+ use deprecated && legacy="-DLUA_COMPAT_ALL"
+
+ emake CC="${CC}" CFLAGS="-DLUA_USE_LINUX ${legacy} ${CFLAGS}" \
+ SYSLDFLAGS="${LDFLAGS}" \
+ RPATH="${EPREFIX}/usr/$(get_libdir)/" \
+ LUA_LIBS="${mylibs}" \
+ LIB_LIBS="${liblibs}" \
+ V=${PV} \
+ gentoo_all || die "emake failed"
+}
+
+src_install() {
+ local PATCH_PV=$(get_version_component_range 1-2)
+
+ emake INSTALL_TOP="${ED}/usr" INSTALL_LIB="${ED}/usr/$(get_libdir)" \
+ V=${PV} gentoo_install \
+ || die "emake install gentoo_install failed"
+
+ dodoc README
+ dohtml doc/*.html doc/*.png doc/*.css doc/*.gif
+
+ doman doc/lua.1 doc/luac.1
+
+ # We want packages to find our things...
+ cp "${FILESDIR}/lua.pc" "${WORKDIR}"
+ sed -i \
+ -e "s:^V=.*:V= ${PATCH_PV}:" \
+ -e "s:^R=.*:R= ${PV}:" \
+ -e "s:/,lib,:/$(get_libdir):g" \
+ "${WORKDIR}/lua.pc"
+
+ insinto "/usr/$(get_libdir)/pkgconfig"
+ doins "${WORKDIR}/lua.pc"
+}