fix bugs 210461, 209883
authorMatti Bickel <mabi@gentoo.org>
Sun, 17 Feb 2008 16:48:41 +0000 (16:48 +0000)
committerMatti Bickel <mabi@gentoo.org>
Sun, 17 Feb 2008 16:48:41 +0000 (16:48 +0000)
Package-Manager: portage-2.1.4.1

dev-lang/lua/ChangeLog
dev-lang/lua/Manifest
dev-lang/lua/files/5.1.3/01_all_LUAI_MAXCSTACK.upstream.patch [new file with mode: 0644]
dev-lang/lua/files/5.1.3/02_all_coroutine.resume.upstream.patch [new file with mode: 0644]
dev-lang/lua/files/5.1.3/03_all_lua_checkstack.upstream.patch [new file with mode: 0644]
dev-lang/lua/files/5.1.3/04_all_unpack.upstream.patch [new file with mode: 0644]
dev-lang/lua/files/lua-5.1.3-deprecated.patch [new file with mode: 0644]
dev-lang/lua/lua-5.1.3-r1.ebuild [new file with mode: 0644]

index 6aff0c578a451e51ea4a579b7870d7990a5e076e..35dbb9a50acb128f20f99200097ed6ddae92c68d 100644 (file)
@@ -1,6 +1,17 @@
 # ChangeLog for dev-lang/lua
 # Copyright 2002-2008 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/dev-lang/lua/ChangeLog,v 1.87 2008/02/13 22:15:05 grobian Exp $
+# $Header: /var/cvsroot/gentoo-x86/dev-lang/lua/ChangeLog,v 1.88 2008/02/17 16:48:40 mabi Exp $
+
+*lua-5.1.3-r1 (17 Feb 2008)
+
+  17 Feb 2008; Matti Bickel <mabi@gentoo.org>
+  +files/5.1.3/01_all_LUAI_MAXCSTACK.upstream.patch,
+  +files/5.1.3/03_all_lua_checkstack.upstream.patch,
+  +files/lua-5.1.3-deprecated.patch,
+  +files/5.1.3/02_all_coroutine.resume.upstream.patch,
+  +files/5.1.3/04_all_unpack.upstream.patch, +lua-5.1.3-r1.ebuild:
+  fixed bug #210461 (thanks for spotting this), added upstream patches, added
+  patch to remove deprecated code (thanks to polarina on bug #209883)
 
   13 Feb 2008; Fabian Groffen <grobian@gentoo.org> lua-5.1.3.ebuild:
   Stop adding back ppc-macos, it's gone -- accept it
index 08b2ac2da16aa7c1805ffcbdb95c4f5455473f86..4d18c19265ad0026e00e7086831b10f6ac72c54b 100644 (file)
@@ -1,3 +1,10 @@
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA1
+
+AUX 5.1.3/01_all_LUAI_MAXCSTACK.upstream.patch 685 RMD160 5e82432ff598210a1c3bbda5d60c46622fe4254c SHA1 7c40bb5f0aa73f93d4e58ec061fd9b41df63b6f9 SHA256 e99f4e7c481d4ab3b6773f7255e55da3fb6e37f0da51f00db93dd0cd8d10e47a
+AUX 5.1.3/02_all_coroutine.resume.upstream.patch 531 RMD160 1acef8e4257bf1cb96844fc210d3cd9ffab03fd6 SHA1 f70429a1b517c3f9b132b428abacf51a2a02d9e4 SHA256 ede1d6684c29b5710881def9c4edb429434321085c0478db7a1e5faaf4054c5c
+AUX 5.1.3/03_all_lua_checkstack.upstream.patch 667 RMD160 df5365eb104b2f7e17ecee141e0d8c5a6fe8820e SHA1 915eaa8297d46ee7f742961c5c2f438240b989fd SHA256 ac3cf87d3ce83518387552f0a8a939e3686290d90e5df3c91d25a4351c20a895
+AUX 5.1.3/04_all_unpack.upstream.patch 878 RMD160 20241153fa5da7aa8b2fc598d292bdbaa5ad4a85 SHA1 24fa9d049f24600969f0f289c4c6f9cbeab8befc SHA256 cfbb531a9478d2091466d4fc18b5b0ab4b10c4460d225c6ffcdd3caa3f4b95bd
 AUX lua-5.0.2-LDFLAGS_and_as-needed.patch 1837 RMD160 2dd54660c8646e9eaf206c96bad9adee326fb567 SHA1 f9f50ab6df8cd946daa8c108a3a48168b2c75f65 SHA256 3bf1a4ef14e02ca8203b3d4eaeab44e2455ec8f186f58f1e5674ab5d9a28689c
 AUX lua-5.0.2-pic.patch 1243 RMD160 f1629c59e406eab1552dbd0de40cc31da0e0ee11 SHA1 a06f73ef06b214eee46326dd7144040d3401c682 SHA256 fd4a528d3fd03a22b7c4108bb3fc7fa916810cad381c2e30e67e14348fe6ee55
 AUX lua-5.0.3-asneeded.patch 594 RMD160 4cfd0913ed09ebde7356433cf306eac22a577c54 SHA1 610772adc425aeb7d2dbc87dcce5dab2c577118d SHA256 afcbdca2d5f21388a1749c6d516dcd2c3143ddc653e63d7942246ed33d115e1d
@@ -9,6 +16,7 @@ AUX lua-5.1-make.patch 2169 RMD160 9a374e7640e100ce9270d33e9a73a9af3cfb354a SHA1
 AUX lua-5.1-make_static.patch 552 RMD160 1ca1c74daee2845369f13a80773755301b1d5184 SHA1 2d49989dbfd730edafac1444fd09a824a8f649b5 SHA256 dac0400c15e5ad9b77ade7e981acde3c111b51e834427280e9fdcdbbcef05812
 AUX lua-5.1-module_paths.patch 1078 RMD160 31a3f13af427bdcae784e21a9456f9197c59379e SHA1 50cb1438b7c50536ebf712d16d153eac40599562 SHA256 1115b6aa00eb4e918156ae70c763534bd2f603ba888da75e4908c19c2ac3e5f7
 AUX lua-5.1-readline.patch 360 RMD160 29e6f8193592ec6e551e46f953563113a72d2de2 SHA1 25baabcb1d3449c3c38726fc7de6c4abb34667a6 SHA256 1f0f90eb8103e338f1188cc884c0c59cc6afd023828c11d86b8145b2a8d1efc2
+AUX lua-5.1.3-deprecated.patch 1417 RMD160 c2f51932850ca7deb6a0df41e4fe67764e48608c SHA1 f003694a532f6cb4bb629918d8c2db8c52696723 SHA256 8d4d3c35d9cfb65f6caa360c09d1fa0c5dc1ee0de3389c1e73602fef86cd0e9f
 AUX lua-ppc-macos-Makefile.patch 2681 RMD160 96be558e865831b2298eddadd3b251f46846a37b SHA1 8fd652137350c6112dbfa553768e56080eeadb15 SHA256 ee61106a273935047fe1557c5af86f7b743427e38c4f552fab3841a199f48f8b
 DIST lua-5.0.2.tar.gz 190442 RMD160 5f1a1cf5802e38b3c4dcfc9f3cd0dc33bfdc0a30 SHA1 a200cfd20a9a4c7da1206ae45dddf26186a9e0e7 SHA256 a6c85d85f912e1c321723084389d63dee7660b81b8292452b190ea7190dd73bc
 DIST lua-5.0.3.tar.gz 191384 RMD160 cb3ed4320b438d73c8ff6c93a02275c9fb461883 SHA1 e7e91f78b8a8deb09b13436829bed557a46af8ae SHA256 1193a61b0e08acaa6eee0eecf29709179ee49c71baebc59b682a25c3b5a45671
@@ -19,6 +27,14 @@ EBUILD lua-5.0.2.ebuild 2151 RMD160 e3bd69434ca49168d0fd965aac2437d183a9296e SHA
 EBUILD lua-5.0.3.ebuild 2816 RMD160 2cd7daac5e5d380cff959aeec45b72cea7f3026a SHA1 9a5a7f9365ee917ac8138f9625405537219f816b SHA256 c6fe66bf83134c5ac1b135f400ab473f6194d79cfa52b64a3bcdec1d3b598f3a
 EBUILD lua-5.1.1-r2.ebuild 2710 RMD160 7bbb61441726d96daef4137a756c9b03464a16ae SHA1 47c1f20bad74033c278e1e7573354fe0940526e4 SHA256 9aa83b2dc6c1c7e881868820496deeef4e130190c23a61479d26e38e85ffdb39
 EBUILD lua-5.1.2-r2.ebuild 2845 RMD160 5e1a7c38b5b6670a07599294f100663c5dd21f95 SHA1 2807efa26d9e9b00e8b7ae142609d9fd4b16d804 SHA256 3e064c58dfe2b6f64d9e0f0d8ba1df7c06e41a39a8161db60fbe0e801f26c25a
+EBUILD lua-5.1.3-r1.ebuild 3077 RMD160 2c9d83b69b78a49adf5f97d6e813b4229cdc5162 SHA1 a0756ac6e3325417a9c8680d0d5b9cae8e13efd9 SHA256 523efa8811cfc4a4078fba0a9fbef3d69c25240dbb021595c2de43beb9d6a91a
 EBUILD lua-5.1.3.ebuild 2687 RMD160 64d582b7bdce73475522a2b3f89e6cd5cd143928 SHA1 3118f33c2b02ab8f793fd49cf871e1a0150a4cff SHA256 064fcb32f083e9563f62b3f351c2e78356e6db93f69122b0cd26697c1f435e0f
-MISC ChangeLog 12253 RMD160 5080fb83f08b4c3b53a96c73c3f9f9c35969d9bf SHA1 f98b11ac17baf0e94d60845917843b2a23b0b523 SHA256 d7dae84c3bdbd9ae5366e6fc3034bed77c18e22db7e7307935ecb0f5aaa670b7
+MISC ChangeLog 12739 RMD160 f14ef2bd1e695c56fddfb6c371994f635932d453 SHA1 66b0d4d14c37d938906c57f702703f021d7228f0 SHA256 75b90a4855d09c815de5b1aadcbb962b5b777543d44e7bd2ee9e9e8c33be6540
 MISC metadata.xml 246 RMD160 d8be15833db0ddabf74171f9e87a2a930ad6bcd2 SHA1 76fdc0af8e2d1dbb1214b95c49f8cd2da3d3832a SHA256 6a089a75a70b3b69d4cae78762fdc69afa25678c5b8692c61245f50bc49ab531
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v2.0.7 (GNU/Linux)
+
+iD8DBQFHuGVifNMcoUhJ7GwRArQgAJ0f23sFuDdpu4D8tSeGod/B7qvvsQCfSgO4
+BCnAa+vWwdp0Iar/3NE1R7M=
+=F+MV
+-----END PGP SIGNATURE-----
diff --git a/dev-lang/lua/files/5.1.3/01_all_LUAI_MAXCSTACK.upstream.patch b/dev-lang/lua/files/5.1.3/01_all_LUAI_MAXCSTACK.upstream.patch
new file mode 100644 (file)
index 0000000..a51e467
--- /dev/null
@@ -0,0 +1,17 @@
+diff -rdu lua-5.1.3.orig/src/luaconf.h lua-5.1.3/src/luaconf.h
+--- lua-5.1.3.orig/src/luaconf.h       2008-02-12 16:17:59.000000000 +0000
++++ lua-5.1.3/src/luaconf.h    2008-02-12 16:26:32.000000000 +0000
+@@ -447,10 +447,10 @@
+ @* can use.
+ ** CHANGE it if you need lots of (Lua) stack space for your C
+ ** functions. This limit is arbitrary; its only purpose is to stop C
+-** functions to consume unlimited stack space.
++** functions to consume unlimited stack space. (must be smaller than
++** -LUA_REGISTRYINDEX)
+ */
+-#define LUAI_MCS_AUX  ((int)(INT_MAX / (4*sizeof(LUA_NUMBER))))
+-#define LUAI_MAXCSTACK        (LUAI_MCS_AUX > SHRT_MAX ? SHRT_MAX : LUAI_MCS_AUX)
++#define LUAI_MAXCSTACK        8000
+ 
+ 
+ 
diff --git a/dev-lang/lua/files/5.1.3/02_all_coroutine.resume.upstream.patch b/dev-lang/lua/files/5.1.3/02_all_coroutine.resume.upstream.patch
new file mode 100644 (file)
index 0000000..8d2b0d7
--- /dev/null
@@ -0,0 +1,12 @@
+diff -rdu lua-5.1.3.orig/src/lbaselib.c lua-5.1.3/src/lbaselib.c
+--- lua-5.1.3.orig/src/lbaselib.c      2008-02-12 16:43:49.000000000 +0000
++++ lua-5.1.3/src/lbaselib.c   2008-02-12 16:47:32.000000000 +0000
+@@ -526,7 +526,7 @@
+   status = lua_resume(co, narg);
+   if (status == 0 || status == LUA_YIELD) {
+     int nres = lua_gettop(co);
+-    if (!lua_checkstack(L, nres))
++    if (!lua_checkstack(L, nres + 1))
+       luaL_error(L, "too many results to resume");
+     lua_xmove(co, L, nres);  /* move yielded values */
+     return nres;
diff --git a/dev-lang/lua/files/5.1.3/03_all_lua_checkstack.upstream.patch b/dev-lang/lua/files/5.1.3/03_all_lua_checkstack.upstream.patch
new file mode 100644 (file)
index 0000000..63bc56e
--- /dev/null
@@ -0,0 +1,22 @@
+diff -rdu lua-5.1.3.orig/src/lapi.c lua-5.1.3/src/lapi.c
+--- lua-5.1.3.orig/src/lapi.c        2008-02-12 16:17:59.000000000 +0000
++++ lua-5.1.3/src/lapi.c     2008-02-12 16:26:32.000000000 +0000
+@@ -93,15 +93,14 @@
+
+
+LUA_API int lua_checkstack (lua_State *L, int size) {
+-  int res;
++  int res = 1;
+   lua_lock(L);
+-  if ((L->top - L->base + size) > LUAI_MAXCSTACK)
++  if (size > LUAI_MAXCSTACK || (L->top - L->base + size) > LUAI_MAXCSTACK)
+     res = 0;  /* stack overflow */
+-  else {
++  else if (size > 0) {
+     luaD_checkstack(L, size);
+     if (L->ci->top < L->top + size)
+       L->ci->top = L->top + size;
+-    res = 1;
+   }
+   lua_unlock(L);
+   return res;
diff --git a/dev-lang/lua/files/5.1.3/04_all_unpack.upstream.patch b/dev-lang/lua/files/5.1.3/04_all_unpack.upstream.patch
new file mode 100644 (file)
index 0000000..47390e4
--- /dev/null
@@ -0,0 +1,20 @@
+diff -rdu lua-5.1.3.orig/src/lbaselib.c lua-5.1.3/src/lbaselib.c
+--- lua-5.1.3.orig/src/lbaselib.c        2008-02-12 16:17:59.000000000 +0000
++++ lua-5.1.3/src/lbaselib.c     2008-02-12 16:26:32.000000000 +0000
+@@ -344,10 +344,12 @@
+   luaL_checktype(L, 1, LUA_TTABLE);
+   i = luaL_optint(L, 2, 1);
+   e = luaL_opt(L, luaL_checkint, 3, luaL_getn(L, 1));
++  if (i > e) return 0;  /* empty range */
+   n = e - i + 1;  /* number of elements */
+-  if (n <= 0) return 0;  /* empty range */
+-  luaL_checkstack(L, n, "table too big to unpack");
+-  for (; i<=e; i++)  /* push arg[i...e] */
++  if (n <= 0 || !lua_checkstack(L, n))  /* n <= 0 means arith. overflow */
++    return luaL_error(L, "too many results to unpack");
++  lua_rawgeti(L, 1, i);  /* push arg[i] (avoiding overflow problems) */
++  while (i++ < e)  /* push arg[i + 1...e] */
+     lua_rawgeti(L, 1, i);
+   return n;
+ }
+
diff --git a/dev-lang/lua/files/lua-5.1.3-deprecated.patch b/dev-lang/lua/files/lua-5.1.3-deprecated.patch
new file mode 100644 (file)
index 0000000..a88a991
--- /dev/null
@@ -0,0 +1,46 @@
+diff -rdu lua-5.1.3.orig/src/luaconf.h lua-5.1.3/src/luaconf.h
+--- lua-5.1.3.orig/src/luaconf.h       2008-02-12 17:00:03.000000000 +0000
++++ lua-5.1.3/src/luaconf.h    2008-02-12 17:07:55.000000000 +0000
+@@ -340,14 +340,14 @@
+ ** CHANGE it to undefined as soon as your programs use only '...' to
+ ** access vararg parameters (instead of the old 'arg' table).
+ */
+-#define LUA_COMPAT_VARARG
++#undef LUA_COMPAT_VARARG
+ 
+ /*
+ @@ LUA_COMPAT_MOD controls compatibility with old math.mod function.
+ ** CHANGE it to undefined as soon as your programs use 'math.fmod' or
+ ** the new '%' operator instead of 'math.mod'.
+ */
+-#define LUA_COMPAT_MOD
++#undef LUA_COMPAT_MOD
+ 
+ /*
+ @@ LUA_COMPAT_LSTR controls compatibility with old long string nesting
+@@ -355,14 +355,14 @@
+ ** CHANGE it to 2 if you want the old behaviour, or undefine it to turn
+ ** off the advisory error when nesting [[...]].
+ */
+-#define LUA_COMPAT_LSTR               1
++#undef LUA_COMPAT_LSTR
+ 
+ /*
+ @@ LUA_COMPAT_GFIND controls compatibility with old 'string.gfind' name.
+ ** CHANGE it to undefined as soon as you rename 'string.gfind' to
+ ** 'string.gmatch'.
+ */
+-#define LUA_COMPAT_GFIND
++#undef LUA_COMPAT_GFIND
+ 
+ /*
+ @@ LUA_COMPAT_OPENLIB controls compatibility with old 'luaL_openlib'
+@@ -370,7 +370,7 @@
+ ** CHANGE it to undefined as soon as you replace to 'luaL_register'
+ ** your uses of 'luaL_openlib'
+ */
+-#define LUA_COMPAT_OPENLIB
++#undef LUA_COMPAT_OPENLIB
+ 
+ 
+ 
diff --git a/dev-lang/lua/lua-5.1.3-r1.ebuild b/dev-lang/lua/lua-5.1.3-r1.ebuild
new file mode 100644 (file)
index 0000000..dd50a05
--- /dev/null
@@ -0,0 +1,113 @@
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-lang/lua/lua-5.1.3-r1.ebuild,v 1.1 2008/02/17 16:48:40 mabi Exp $
+
+inherit eutils portability 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 ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+IUSE="deprecated readline static"
+
+DEPEND="readline? ( sys-libs/readline )"
+
+src_unpack() {
+       local PATCH_PV=$(get_version_component_range 1-2)
+       unpack ${A}
+       cd "${S}"
+
+       epatch "${FILESDIR}"/${PN}-${PATCH_PV}-make.patch
+       epatch "${FILESDIR}"/${PN}-${PATCH_PV}-module_paths.patch
+
+       EPATCH_SOURCE="${FILESDIR}/${PV}" EPATCH_SUFFIX="upstream.patch" epatch
+
+       # correct lua versioning
+       sed -i -e 's/\(LIB_VERSION = \)6:1:1/\16:3:1/' src/Makefile
+
+       sed -i -e 's:\(/README\)\("\):\1.gz\2:g' doc/readme.html
+
+       if ! use deprecated ; then
+               epatch "${FILESDIR}"/${P}-no-deprecated.patch
+       fi
+
+       if ! use readline ; then
+               epatch "${FILESDIR}"/${PN}-${PATCH_PV}-readline.patch
+       fi
+
+       # Using dynamic linked lua is not recommended upstream 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
+       # Not 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
+               epatch "${FILESDIR}"/${PN}-${PATCH_PV}-make_static.patch
+       fi
+
+       # We want packages to find our things...
+       sed -i -e 's:/usr/local:/usr:' etc/lua.pc
+}
+
+src_compile() {
+       myflags=
+       # what to link to liblua
+       liblibs="-lm"
+       if use ppc-macos; then
+               mycflags="${mycflags} -DLUA_USE_MACOSX"
+       else # building for standard linux (and bsd too)
+               mycflags="${mycflags} -DLUA_USE_LINUX"
+               liblibs="${liblibs} $(dlopen_lib)"
+       fi
+
+       # what to link to the executables
+       mylibs=
+       if use readline; then
+               mylibs="-lreadline"
+       fi
+
+       cd src
+       emake CFLAGS="${mycflags} ${CFLAGS}" \
+                       RPATH="/usr/$(get_libdir)/" \
+                       LUA_LIBS="${mylibs}" \
+                       LIB_LIBS="${liblibs}" \
+                       V=${PV} \
+                       gentoo_all || die "emake failed"
+
+       mv lua_test ../test/lua.static
+}
+
+src_install() {
+       emake INSTALL_TOP="${D}/usr/" INSTALL_LIB="${D}/usr/$(get_libdir)/" \
+                       V=${PV} gentoo_install \
+       || die "emake install gentoo_install failed"
+
+       dodoc HISTORY README
+       dohtml doc/*.html doc/*.gif
+
+       insinto /usr/share/pixmaps
+       doins etc/lua.ico
+       insinto /usr/$(get_libdir)/pkgconfig
+       doins etc/lua.pc
+
+       doman doc/lua.1 doc/luac.1
+}
+
+src_test() {
+       local positive="bisect cf echo env factorial fib fibfor hello printf sieve
+       sort trace-calls trace-globals"
+       local negative="readonly"
+       local test
+
+       cd "${S}"
+       for test in ${positive}; do
+               test/lua.static test/${test}.lua &> /dev/null || die "test $test failed"
+       done
+
+       for test in ${negative}; do
+               test/lua.static test/${test}.lua &> /dev/null && die "test $test failed"
+       done
+}