1 |
commit: 719f9a18c8709bf355d7ea80c09cd4e87f0a11fe |
2 |
Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Jan 23 23:35:30 2020 +0000 |
4 |
Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Jan 23 23:36:34 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=719f9a18 |
7 |
|
8 |
dev-lang/lua: EAPI bump |
9 |
|
10 |
Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org> |
11 |
|
12 |
.../lua/files/lua-5.1.5-disable-deprecated.patch | 59 +++++++++++ |
13 |
dev-lang/lua/files/lua-5.1.5-gentoo-build.patch | 118 +++++++++++++++++++++ |
14 |
dev-lang/lua/files/lua-5.1.5-readline.patch | 17 +++ |
15 |
dev-lang/lua/lua-5.1.5-r5.ebuild | 113 ++++++++++++++++++++ |
16 |
4 files changed, 307 insertions(+) |
17 |
|
18 |
diff --git a/dev-lang/lua/files/lua-5.1.5-disable-deprecated.patch b/dev-lang/lua/files/lua-5.1.5-disable-deprecated.patch |
19 |
new file mode 100644 |
20 |
index 00000000000..d1d7fb10115 |
21 |
--- /dev/null |
22 |
+++ b/dev-lang/lua/files/lua-5.1.5-disable-deprecated.patch |
23 |
@@ -0,0 +1,59 @@ |
24 |
+diff -rdu old/src/luaconf.h new/src/luaconf.h |
25 |
+--- old/src/luaconf.h 2008-02-12 17:00:03.000000000 +0000 |
26 |
++++ new/src/luaconf.h 2008-02-12 17:07:55.000000000 +0000 |
27 |
+@@ -340,14 +340,14 @@ |
28 |
+ ** CHANGE it to undefined as soon as your programs use only '...' to |
29 |
+ ** access vararg parameters (instead of the old 'arg' table). |
30 |
+ */ |
31 |
+-#define LUA_COMPAT_VARARG |
32 |
++#undef LUA_COMPAT_VARARG |
33 |
+ |
34 |
+ /* |
35 |
+ @@ LUA_COMPAT_MOD controls compatibility with old math.mod function. |
36 |
+ ** CHANGE it to undefined as soon as your programs use 'math.fmod' or |
37 |
+ ** the new '%' operator instead of 'math.mod'. |
38 |
+ */ |
39 |
+-#define LUA_COMPAT_MOD |
40 |
++#undef LUA_COMPAT_MOD |
41 |
+ |
42 |
+ /* |
43 |
+ @@ LUA_COMPAT_LSTR controls compatibility with old long string nesting |
44 |
+@@ -355,14 +355,14 @@ |
45 |
+ ** CHANGE it to 2 if you want the old behaviour, or undefine it to turn |
46 |
+ ** off the advisory error when nesting [[...]]. |
47 |
+ */ |
48 |
+-#define LUA_COMPAT_LSTR 1 |
49 |
++#undef LUA_COMPAT_LSTR |
50 |
+ |
51 |
+ /* |
52 |
+ @@ LUA_COMPAT_GFIND controls compatibility with old 'string.gfind' name. |
53 |
+ ** CHANGE it to undefined as soon as you rename 'string.gfind' to |
54 |
+ ** 'string.gmatch'. |
55 |
+ */ |
56 |
+-#define LUA_COMPAT_GFIND |
57 |
++#undef LUA_COMPAT_GFIND |
58 |
+ |
59 |
+ /* |
60 |
+ @@ LUA_COMPAT_OPENLIB controls compatibility with old 'luaL_openlib' |
61 |
+@@ -370,7 +370,7 @@ |
62 |
+ ** CHANGE it to undefined as soon as you replace to 'luaL_register' |
63 |
+ ** your uses of 'luaL_openlib' |
64 |
+ */ |
65 |
+-#define LUA_COMPAT_OPENLIB |
66 |
++#undef LUA_COMPAT_OPENLIB |
67 |
+ |
68 |
+ |
69 |
+ |
70 |
+diff -rdu old/test/sieve.lua new/test/sieve.lua |
71 |
+Rename deprecated functions in test scripts |
72 |
+--- old/test/sieve.lua~ 2002-10-31 03:52:58.000000000 +0100 |
73 |
++++ new/test/sieve.lua 2008-02-20 17:44:22.468281121 +0100 |
74 |
+@@ -14,7 +14,7 @@ |
75 |
+ while 1 do |
76 |
+ local n = g() |
77 |
+ if n == nil then return end |
78 |
+- if math.mod(n, p) ~= 0 then coroutine.yield(n) end |
79 |
++ if math.fmod(n, p) ~= 0 then coroutine.yield(n) end |
80 |
+ end |
81 |
+ end) |
82 |
+ end |
83 |
|
84 |
diff --git a/dev-lang/lua/files/lua-5.1.5-gentoo-build.patch b/dev-lang/lua/files/lua-5.1.5-gentoo-build.patch |
85 |
new file mode 100644 |
86 |
index 00000000000..62c4ed33648 |
87 |
--- /dev/null |
88 |
+++ b/dev-lang/lua/files/lua-5.1.5-gentoo-build.patch |
89 |
@@ -0,0 +1,118 @@ |
90 |
+--- old/Makefile 2012-02-10 10:50:23.000000000 +0100 |
91 |
++++ new/Makefile 2019-07-12 12:00:30.807725876 +0200 |
92 |
+@@ -22,7 +22,8 @@ |
93 |
+ |
94 |
+ # How to install. If your install program does not support "-p", then you |
95 |
+ # may have to run ranlib on the installed liblua.a (do "make ranlib"). |
96 |
+-INSTALL= install -p |
97 |
++INSTALL?= install -p |
98 |
++INSTALL_LINK= ln -s |
99 |
+ INSTALL_EXEC= $(INSTALL) -m 0755 |
100 |
+ INSTALL_DATA= $(INSTALL) -m 0644 |
101 |
+ # |
102 |
+@@ -33,7 +34,7 @@ |
103 |
+ |
104 |
+ # Utilities. |
105 |
+ MKDIR= mkdir -p |
106 |
+-RANLIB= ranlib |
107 |
++RANLIB?= ranlib |
108 |
+ |
109 |
+ # == END OF USER SETTINGS. NO NEED TO CHANGE ANYTHING BELOW THIS LINE ========= |
110 |
+ |
111 |
+@@ -47,13 +48,17 @@ |
112 |
+ TO_MAN= lua.1 luac.1 |
113 |
+ |
114 |
+ # Lua version and release. |
115 |
++M= 5 |
116 |
+ V= 5.1 |
117 |
+ R= 5.1.5 |
118 |
+ |
119 |
++# Export to sub-make |
120 |
++export M R |
121 |
++ |
122 |
+ all: $(PLAT) |
123 |
+ |
124 |
+ $(PLATS) clean: |
125 |
+- cd src && $(MAKE) $@ |
126 |
++ cd src && $(MKDIR) .libs && $(MAKE) $@ |
127 |
+ |
128 |
+ test: dummy |
129 |
+ src/lua test/hello.lua |
130 |
+@@ -61,6 +66,8 @@ |
131 |
+ install: dummy |
132 |
+ cd src && $(MKDIR) $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB) $(INSTALL_MAN) $(INSTALL_LMOD) $(INSTALL_CMOD) |
133 |
+ cd src && $(INSTALL_EXEC) $(TO_BIN) $(INSTALL_BIN) |
134 |
++ cd src && $(INSTALL_EXEC) $(TO_LIB:.a=.so.$(R)) $(INSTALL_LIB) |
135 |
++ cd src && $(INSTALL_LINK) $(TO_LIB:.a=.so.$(R)) $(INSTALL_LIB)/$(TO_LIB:.a=.so.$(M)) |
136 |
+ cd src && $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC) |
137 |
+ cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB) |
138 |
+ cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN) |
139 |
+--- old/src/Makefile 2012-02-13 21:41:22.000000000 +0100 |
140 |
++++ new/src/Makefile 2019-07-12 11:31:02.945290602 +0200 |
141 |
+@@ -7,12 +7,14 @@ |
142 |
+ # Your platform. See PLATS for possible values. |
143 |
+ PLAT= none |
144 |
+ |
145 |
+-CC= gcc |
146 |
+-CFLAGS= -O2 -Wall $(MYCFLAGS) |
147 |
+-AR= ar rcu |
148 |
+-RANLIB= ranlib |
149 |
++CC?= gcc |
150 |
++CFLAGS?= -O2 -Wall $(MYCFLAGS) |
151 |
++SOFLAGS= -shared -fPIC -DPIC -Wl,-O1 -Wl,--as-needed -Wl,-soname -Wl,$(LUA_A:.a=.so.$(M)) $(MYLDFLAGS) |
152 |
++AR?= ar |
153 |
++ARFLAGS?= rcu |
154 |
++RANLIB?= ranlib |
155 |
+ RM= rm -f |
156 |
+-LIBS= -lm $(MYLIBS) |
157 |
++LIBS?= -lm $(MYLIBS) |
158 |
+ |
159 |
+ MYCFLAGS= |
160 |
+ MYLDFLAGS= |
161 |
+@@ -35,8 +37,11 @@ |
162 |
+ LUAC_T= luac |
163 |
+ LUAC_O= luac.o print.o |
164 |
+ |
165 |
+-ALL_O= $(CORE_O) $(LIB_O) $(LUA_O) $(LUAC_O) |
166 |
+-ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T) |
167 |
++LUAS_T= $(LUA_A:.a=.so.$(R)) |
168 |
++LUAS_O= $(addprefix .libs/,$(CORE_O) $(LIB_O) $(LUA_O)) |
169 |
++ |
170 |
++ALL_O= $(CORE_O) $(LIB_O) $(LUA_O) $(LUAC_O) $(LUAS_O) |
171 |
++ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T) $(LUAS_T) |
172 |
+ ALL_A= $(LUA_A) |
173 |
+ |
174 |
+ default: $(PLAT) |
175 |
+@@ -48,9 +53,12 @@ |
176 |
+ a: $(ALL_A) |
177 |
+ |
178 |
+ $(LUA_A): $(CORE_O) $(LIB_O) |
179 |
+- $(AR) $@ $(CORE_O) $(LIB_O) # DLL needs all object files |
180 |
++ $(AR) $(ARFLAGS) $@ $(CORE_O) $(LIB_O) # DLL needs all object files |
181 |
+ $(RANLIB) $@ |
182 |
+ |
183 |
++$(LUAS_T): $(LUAS_O) |
184 |
++ $(CC) -o $@ $(SOFLAGS) $(LUAS_O) $(LIBS) |
185 |
++ |
186 |
+ $(LUA_T): $(LUA_O) $(LUA_A) |
187 |
+ $(CC) -o $@ $(MYLDFLAGS) $(LUA_O) $(LUA_A) $(LIBS) |
188 |
+ |
189 |
+@@ -67,7 +75,7 @@ |
190 |
+ @echo "PLAT = $(PLAT)" |
191 |
+ @echo "CC = $(CC)" |
192 |
+ @echo "CFLAGS = $(CFLAGS)" |
193 |
+- @echo "AR = $(AR)" |
194 |
++ @echo "AR = $(AR) $(ARFLAGS)" |
195 |
+ @echo "RANLIB = $(RANLIB)" |
196 |
+ @echo "RM = $(RM)" |
197 |
+ @echo "MYCFLAGS = $(MYCFLAGS)" |
198 |
+@@ -120,6 +128,9 @@ |
199 |
+ |
200 |
+ # DO NOT DELETE |
201 |
+ |
202 |
++.libs/%o: %c |
203 |
++ $(CC) $(CFLAGS) -fPIC -DPIC -c -o $@ $< |
204 |
++ |
205 |
+ lapi.o: lapi.c lua.h luaconf.h lapi.h lobject.h llimits.h ldebug.h \ |
206 |
+ lstate.h ltm.h lzio.h lmem.h ldo.h lfunc.h lgc.h lstring.h ltable.h \ |
207 |
+ lundump.h lvm.h |
208 |
|
209 |
diff --git a/dev-lang/lua/files/lua-5.1.5-readline.patch b/dev-lang/lua/files/lua-5.1.5-readline.patch |
210 |
new file mode 100644 |
211 |
index 00000000000..2b5221a8ab4 |
212 |
--- /dev/null |
213 |
+++ b/dev-lang/lua/files/lua-5.1.5-readline.patch |
214 |
@@ -0,0 +1,17 @@ |
215 |
+--- old/src/luaconf.h 2006-04-10 20:27:23.000000000 +0200 |
216 |
++++ new/src/luaconf.h 2006-11-15 14:53:07.000000000 +0100 |
217 |
+@@ -36,7 +36,6 @@ |
218 |
+ #if defined(LUA_USE_LINUX) |
219 |
+ #define LUA_USE_POSIX |
220 |
+ #define LUA_USE_DLOPEN /* needs an extra library: -ldl */ |
221 |
+-#define LUA_USE_READLINE /* needs some extra libraries */ |
222 |
+ #endif |
223 |
+ |
224 |
+ #if defined(LUA_USE_MACOSX) |
225 |
+--- old/src/Makefile 2012-02-13 21:41:22.000000000 +0100 |
226 |
++++ old/src/Makefile 2019-07-09 09:53:00.000000000 +0100 |
227 |
+@@ -98,3 +98,3 @@ |
228 |
+ linux: |
229 |
+- $(MAKE) all MYCFLAGS=-DLUA_USE_LINUX MYLIBS="-Wl,-E -ldl -lreadline -lhistory -lncurses" |
230 |
++ $(MAKE) all MYCFLAGS=-DLUA_USE_LINUX MYLIBS="-Wl,-E -ldl" |
231 |
+ |
232 |
|
233 |
diff --git a/dev-lang/lua/lua-5.1.5-r5.ebuild b/dev-lang/lua/lua-5.1.5-r5.ebuild |
234 |
new file mode 100644 |
235 |
index 00000000000..f6bb7d48bff |
236 |
--- /dev/null |
237 |
+++ b/dev-lang/lua/lua-5.1.5-r5.ebuild |
238 |
@@ -0,0 +1,113 @@ |
239 |
+# Copyright 1999-2019 Gentoo Authors |
240 |
+# Distributed under the terms of the GNU General Public License v2 |
241 |
+ |
242 |
+EAPI=6 |
243 |
+ |
244 |
+inherit eutils multilib multilib-minimal portability toolchain-funcs versionator flag-o-matic |
245 |
+ |
246 |
+DESCRIPTION="A powerful light-weight programming language designed for extending applications" |
247 |
+HOMEPAGE="http://www.lua.org/" |
248 |
+SRC_URI="http://www.lua.org/ftp/${P}.tar.gz" |
249 |
+ |
250 |
+LICENSE="MIT" |
251 |
+SLOT="0" |
252 |
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" |
253 |
+IUSE="+deprecated emacs readline doc" |
254 |
+ |
255 |
+RDEPEND="readline? ( >=sys-libs/readline-6.2_p5-r1:0=[${MULTILIB_USEDEP}] )" |
256 |
+DEPEND="${RDEPEND}" |
257 |
+PDEPEND="emacs? ( app-emacs/lua-mode )" |
258 |
+ |
259 |
+MULTILIB_WRAPPED_HEADERS=( |
260 |
+ /usr/include/luaconf.h |
261 |
+) |
262 |
+ |
263 |
+src_prepare() { |
264 |
+ # Correct documentation link |
265 |
+ sed -i -e 's:\(/README\)\("\):\1.gz\2:g' doc/readme.html || die |
266 |
+ |
267 |
+ # Using dynamic linked lua is not recommended for performance |
268 |
+ # reasons. http://article.gmane.org/gmane.comp.lang.lua.general/18519 |
269 |
+ # Mainly, this is of concern if your arch is poor with GPRs, like x86. |
270 |
+ |
271 |
+ # Therefore both lua interpreter and compiler are statically linked to |
272 |
+ # the core library modules. |
273 |
+ |
274 |
+ # Note: This patch only adds the required targets to the makefiles |
275 |
+ # instead of relying upon libtool, which fails cross-compiling. Both |
276 |
+ # shared and static versions of lua libraries are installed. |
277 |
+ epatch "${FILESDIR}"/${P}-gentoo-build.patch |
278 |
+ |
279 |
+ # Rename deprecated functions in scripts |
280 |
+ use deprecated || epatch "${FILESDIR}"/${P}-disable-deprecated.patch |
281 |
+ |
282 |
+ # Remove readline dependency if not requested |
283 |
+ use readline || epatch "${FILESDIR}"/${P}-disable-readline.patch |
284 |
+ |
285 |
+ epatch "${FILESDIR}/${P}-fix_vararg_calls.patch" |
286 |
+ |
287 |
+ # Required by EAPI >= 6 |
288 |
+ eapply_user |
289 |
+ |
290 |
+ # Add documentation URIs if needed |
291 |
+ use doc && \ |
292 |
+ HTML_DOCS=( doc/*.{html,css,png,gif} ) && \ |
293 |
+ DOCS="HISTORY README" |
294 |
+ |
295 |
+ # custom Makefiles |
296 |
+ multilib_copy_sources |
297 |
+} |
298 |
+ |
299 |
+multilib_src_configure() { |
300 |
+ # Fix directories according to FHS/Gentoo policy paths and ABI |
301 |
+ sed -i \ |
302 |
+ -e 's:/usr/local:'${EPREFIX}'/usr:' \ |
303 |
+ -e 's:/man/:/share/man/:' \ |
304 |
+ -e "s:\([/\"]\)\<lib\>:\1$(get_libdir):g" \ |
305 |
+ Makefile etc/lua.pc src/luaconf.h doc/manual.html || die |
306 |
+} |
307 |
+ |
308 |
+multilib_src_compile() { |
309 |
+ append-cflags "-DLUA_USE_LINUX" |
310 |
+ append-ldflags "-Wl,-E" |
311 |
+ tc-export AR CC CPP LD RANLIB |
312 |
+ emake \ |
313 |
+ MYLDFLAGS="${LDFLAGS}" \ |
314 |
+ MYCFLAGS="${CFLAGS}" \ |
315 |
+ linux |
316 |
+} |
317 |
+ |
318 |
+multilib_src_install() { |
319 |
+ emake -j1 install INSTALL_TOP="${ED}/usr" |
320 |
+ |
321 |
+ insinto usr/$(get_libdir)/pkgconfig |
322 |
+ doins etc/lua.pc |
323 |
+} |
324 |
+ |
325 |
+multilib_src_install_all() { |
326 |
+ einstalldocs -r |
327 |
+ |
328 |
+ doicon etc/lua.ico |
329 |
+ |
330 |
+ doman doc/lua.1 doc/luac.1 |
331 |
+} |
332 |
+ |
333 |
+multilib_src_test() { |
334 |
+ # These tests MUST succeed for the ebuild to succeed |
335 |
+ local MUST_SUCCEED="bisect cf echo env factorial fib fibfor hello printf sieve |
336 |
+ sort trace-calls trace-globals" |
337 |
+ |
338 |
+ # These tests MUST fail for the ebuild to succeed |
339 |
+ local MUST_FAIL="readonly" |
340 |
+ |
341 |
+ cd "${BUILD_DIR}" || die |
342 |
+ |
343 |
+ local test |
344 |
+ for test in ${MUST_SUCCEED}; do |
345 |
+ src/lua test/${test}.lua || die "test $test failed" |
346 |
+ done |
347 |
+ |
348 |
+ for test in ${MUST_FAIL}; do |
349 |
+ src/lua test/${test}.lua && die "test $test failed" |
350 |
+ done |
351 |
+} |