1 |
commit: 856bde253c4184b33adc1f0267e80464d564763b |
2 |
Author: Rafael Martins <rafaelmartins <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Nov 28 19:13:03 2016 +0000 |
4 |
Commit: Rafael Martins <rafaelmartins <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Nov 28 19:13:28 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=856bde25 |
7 |
|
8 |
dev-lang/lua: fix for bug #520480 |
9 |
|
10 |
Package-Manager: portage-2.2.28 |
11 |
|
12 |
.../lua/files/lua-5.1.5-fix_vararg_calls.patch | 12 ++ |
13 |
dev-lang/lua/lua-5.1.5-r4.ebuild | 135 +++++++++++++++++++++ |
14 |
2 files changed, 147 insertions(+) |
15 |
|
16 |
diff --git a/dev-lang/lua/files/lua-5.1.5-fix_vararg_calls.patch b/dev-lang/lua/files/lua-5.1.5-fix_vararg_calls.patch |
17 |
new file mode 100644 |
18 |
index 00000000..cec8182 |
19 |
--- /dev/null |
20 |
+++ b/dev-lang/lua/files/lua-5.1.5-fix_vararg_calls.patch |
21 |
@@ -0,0 +1,12 @@ |
22 |
+diff -uNr lua-5.1.5.orig/src/ldo.c lua-5.1.5/src/ldo.c |
23 |
+--- lua-5.1.5.orig/src/ldo.c 2016-11-28 20:04:13.177047928 +0100 |
24 |
++++ lua-5.1.5/src/ldo.c 2016-11-28 20:07:15.170432525 +0100 |
25 |
+@@ -274,7 +274,7 @@ |
26 |
+ CallInfo *ci; |
27 |
+ StkId st, base; |
28 |
+ Proto *p = cl->p; |
29 |
+- luaD_checkstack(L, p->maxstacksize); |
30 |
++ luaD_checkstack(L, p->maxstacksize + p->numparams); |
31 |
+ func = restorestack(L, funcr); |
32 |
+ if (!p->is_vararg) { /* no varargs? */ |
33 |
+ base = func + 1; |
34 |
|
35 |
diff --git a/dev-lang/lua/lua-5.1.5-r4.ebuild b/dev-lang/lua/lua-5.1.5-r4.ebuild |
36 |
new file mode 100644 |
37 |
index 00000000..62189ff |
38 |
--- /dev/null |
39 |
+++ b/dev-lang/lua/lua-5.1.5-r4.ebuild |
40 |
@@ -0,0 +1,135 @@ |
41 |
+# Copyright 1999-2016 Gentoo Foundation |
42 |
+# Distributed under the terms of the GNU General Public License v2 |
43 |
+# $Id$ |
44 |
+ |
45 |
+EAPI=5 |
46 |
+ |
47 |
+inherit eutils multilib multilib-minimal portability toolchain-funcs versionator |
48 |
+ |
49 |
+DESCRIPTION="A powerful light-weight programming language designed for extending applications" |
50 |
+HOMEPAGE="http://www.lua.org/" |
51 |
+SRC_URI="http://www.lua.org/ftp/${P}.tar.gz" |
52 |
+ |
53 |
+LICENSE="MIT" |
54 |
+SLOT="0" |
55 |
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~arm-linux ~x86-linux ~ppc-aix ~x64-freebsd ~ia64-hpux ~x86-interix ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" |
56 |
+IUSE="+deprecated emacs readline static" |
57 |
+ |
58 |
+RDEPEND="readline? ( >=sys-libs/readline-6.2_p5-r1:0=[${MULTILIB_USEDEP}] )" |
59 |
+DEPEND="${RDEPEND} |
60 |
+ sys-devel/libtool" |
61 |
+PDEPEND="emacs? ( app-emacs/lua-mode )" |
62 |
+ |
63 |
+MULTILIB_WRAPPED_HEADERS=( |
64 |
+ /usr/include/luaconf.h |
65 |
+) |
66 |
+ |
67 |
+src_prepare() { |
68 |
+ local PATCH_PV=$(get_version_component_range 1-2) |
69 |
+ |
70 |
+ epatch "${FILESDIR}/${P}-fix_vararg_calls.patch" |
71 |
+ |
72 |
+ epatch "${FILESDIR}"/${PN}-${PATCH_PV}-make-r1.patch |
73 |
+ epatch "${FILESDIR}"/${PN}-${PATCH_PV}-module_paths.patch |
74 |
+ |
75 |
+ # use glibtool on Darwin (versus Apple libtool) |
76 |
+ if [[ ${CHOST} == *-darwin* ]] ; then |
77 |
+ sed -i -e '/LIBTOOL = /s:libtool:glibtool:' \ |
78 |
+ Makefile src/Makefile || die |
79 |
+ fi |
80 |
+ |
81 |
+ #EPATCH_SOURCE="${FILESDIR}/${PV}" EPATCH_SUFFIX="upstream.patch" epatch |
82 |
+ |
83 |
+ # correct lua versioning |
84 |
+ sed -i -e 's/\(LIB_VERSION = \)6:1:1/\16:5:1/' src/Makefile || die |
85 |
+ |
86 |
+ sed -i -e 's:\(/README\)\("\):\1.gz\2:g' doc/readme.html || die |
87 |
+ |
88 |
+ if ! use deprecated ; then |
89 |
+ # patches from 5.1.4 still apply |
90 |
+ epatch "${FILESDIR}"/${PN}-5.1.4-deprecated.patch |
91 |
+ epatch "${FILESDIR}"/${PN}-5.1.4-test.patch |
92 |
+ fi |
93 |
+ |
94 |
+ if ! use readline ; then |
95 |
+ epatch "${FILESDIR}"/${PN}-${PATCH_PV}-readline.patch |
96 |
+ fi |
97 |
+ |
98 |
+ # Using dynamic linked lua is not recommended for performance |
99 |
+ # reasons. http://article.gmane.org/gmane.comp.lang.lua.general/18519 |
100 |
+ # Mainly, this is of concern if your arch is poor with GPRs, like x86 |
101 |
+ # Note that this only affects the interpreter binary (named lua), not the lua |
102 |
+ # compiler (built statically) nor the lua libraries (both shared and static |
103 |
+ # are installed) |
104 |
+ if use static ; then |
105 |
+ epatch "${FILESDIR}"/${PN}-${PATCH_PV}-make_static-r1.patch |
106 |
+ fi |
107 |
+ |
108 |
+ # custom Makefiles |
109 |
+ multilib_copy_sources |
110 |
+} |
111 |
+ |
112 |
+multilib_src_configure() { |
113 |
+ # We want packages to find our things... |
114 |
+ sed -i \ |
115 |
+ -e 's:/usr/local:'${EPREFIX}'/usr:' \ |
116 |
+ -e "s:\([/\"]\)\<lib\>:\1$(get_libdir):g" \ |
117 |
+ etc/lua.pc src/luaconf.h || die |
118 |
+} |
119 |
+ |
120 |
+multilib_src_compile() { |
121 |
+ tc-export CC |
122 |
+ myflags= |
123 |
+ # what to link to liblua |
124 |
+ liblibs="-lm" |
125 |
+ liblibs="${liblibs} $(dlopen_lib)" |
126 |
+ |
127 |
+ # what to link to the executables |
128 |
+ mylibs= |
129 |
+ if use readline; then |
130 |
+ mylibs="-lreadline" |
131 |
+ fi |
132 |
+ |
133 |
+ cd src |
134 |
+ emake CC="${CC}" CFLAGS="-DLUA_USE_LINUX ${CFLAGS}" \ |
135 |
+ RPATH="${EPREFIX}/usr/$(get_libdir)/" \ |
136 |
+ LUA_LIBS="${mylibs}" \ |
137 |
+ LIB_LIBS="${liblibs}" \ |
138 |
+ V=${PV} \ |
139 |
+ gentoo_all |
140 |
+ |
141 |
+ mv lua_test ../test/lua.static |
142 |
+} |
143 |
+ |
144 |
+multilib_src_install() { |
145 |
+ emake INSTALL_TOP="${ED}/usr" INSTALL_LIB="${ED}/usr/$(get_libdir)" \ |
146 |
+ V=${PV} gentoo_install |
147 |
+ |
148 |
+ insinto /usr/$(get_libdir)/pkgconfig |
149 |
+ doins etc/lua.pc |
150 |
+} |
151 |
+ |
152 |
+multilib_src_install_all() { |
153 |
+ dodoc HISTORY README |
154 |
+ dohtml doc/*.html doc/*.png doc/*.css doc/*.gif |
155 |
+ |
156 |
+ doicon etc/lua.ico |
157 |
+ |
158 |
+ doman doc/lua.1 doc/luac.1 |
159 |
+} |
160 |
+ |
161 |
+multilib_src_test() { |
162 |
+ local positive="bisect cf echo env factorial fib fibfor hello printf sieve |
163 |
+ sort trace-calls trace-globals" |
164 |
+ local negative="readonly" |
165 |
+ local test |
166 |
+ |
167 |
+ cd "${BUILD_DIR}" || die |
168 |
+ for test in ${positive}; do |
169 |
+ test/lua.static test/${test}.lua || die "test $test failed" |
170 |
+ done |
171 |
+ |
172 |
+ for test in ${negative}; do |
173 |
+ test/lua.static test/${test}.lua && die "test $test failed" |
174 |
+ done |
175 |
+} |