Gentoo Archives: gentoo-commits

From: David Seifert <soap@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/lua-patches:5.3.6 commit in: doc/, src/, /
Date: Mon, 05 Sep 2022 14:47:01
Message-Id: 1662389145.ed8a6d784aea561e5e2af33a70f800c6bb570bf9.soap@gentoo
1 commit: ed8a6d784aea561e5e2af33a70f800c6bb570bf9
2 Author: David Seifert <soap <AT> gentoo <DOT> org>
3 AuthorDate: Mon Sep 5 14:45:45 2022 +0000
4 Commit: David Seifert <soap <AT> gentoo <DOT> org>
5 CommitDate: Mon Sep 5 14:45:45 2022 +0000
6 URL: https://gitweb.gentoo.org/proj/lua-patches.git/commit/?id=ed8a6d78
7
8 Add Autotools
9
10 * inspired by Fedora's patches, but mostly rewritten
11 for Gentoo's multi-versioned approach.
12
13 Signed-off-by: David Seifert <soap <AT> gentoo.org>
14
15 Makefile.am | 73 +++++++++++++++++++++++++++++++++++++++++
16 configure.ac | 49 +++++++++++++++++++++++++++
17 doc/{lua.1 => lua5.3.1} | 0
18 doc/{luac.1 => luac5.3.1} | 0
19 src/lopcodes.c | 4 +--
20 src/lopcodes.h | 4 +--
21 src/lua5.3.pc.in | 18 ++++++++++
22 src/{luaconf.h => luaconf.h.in} | 8 ++---
23 src/lundump.h | 2 +-
24 test-wrapper.sh | 13 ++++++++
25 10 files changed, 161 insertions(+), 10 deletions(-)
26
27 diff --git a/Makefile.am b/Makefile.am
28 new file mode 100644
29 index 0000000..c412322
30 --- /dev/null
31 +++ b/Makefile.am
32 @@ -0,0 +1,73 @@
33 +########
34 +# doc/ #
35 +########
36 +
37 +dist_doc_DATA = README
38 +dist_man1_MANS = doc/lua5.3.1 doc/luac5.3.1
39 +dist_html_DATA = \
40 + doc/contents.html doc/index.css doc/logo.gif doc/lua.css doc/manual.css \
41 + doc/manual.html doc/osi-certified-72x60.png doc/readme.html
42 +
43 +########
44 +# src/ #
45 +########
46 +
47 +AM_CFLAGS = -Wall
48 +AM_CPPFLAGS = -I$(builddir)/src # for luaconf.h
49 +
50 +luadir = $(includedir)/lua5.3
51 +lua_HEADERS = src/lua.h src/lualib.h src/lauxlib.h src/lua.hpp
52 +nodist_lua_HEADERS = src/luaconf.h
53 +
54 +lib_LTLIBRARIES = src/liblua5.3.la
55 +src_liblua5_3_la_LIBADD = $(LIBM)
56 +src_liblua5_3_la_SOURCES = \
57 + src/lapi.c src/lapi.h src/lauxlib.c src/lbaselib.c src/lcode.c src/lcode.h \
58 + src/lcorolib.c src/lctype.c src/lctype.h src/ldblib.c src/ldebug.c \
59 + src/ldebug.h src/ldo.c src/ldo.h src/ldump.c src/lfunc.c src/lfunc.h \
60 + src/lgc.c src/lbitlib.c src/lgc.h src/linit.c src/liolib.c src/llex.c \
61 + src/llex.h src/llimits.h src/lmathlib.c src/lmem.c src/lmem.h src/loadlib.c \
62 + src/lobject.c src/lobject.h src/lopcodes.c src/lopcodes.h \
63 + src/loslib.c src/lparser.c src/lparser.h src/lprefix.h src/lstate.c \
64 + src/lstate.h src/lstring.c src/lstring.h src/lstrlib.c src/ltable.c \
65 + src/ltable.h src/ltablib.c src/ltm.c src/ltm.h src/lundump.c src/lundump.h \
66 + src/lutf8lib.c src/lvm.c src/lvm.h src/lzio.c src/lzio.h
67 +
68 +bin_PROGRAMS = lua5.3 luac5.3
69 +
70 +lua5_3_SOURCES = src/lua.c
71 +lua5_3_CPPFLAGS = $(AM_CPPFLAGS) $(READLINE_CFLAGS)
72 +lua5_3_LDADD = src/liblua5.3.la $(READLINE_LIBS)
73 +
74 +luac5_3_SOURCES = src/luac.c
75 +luac5_3_LDADD = src/liblua5.3.la
76 +
77 +EXTRA_DIST = src/luaconf.h.in
78 +BUILT_SOURCES = src/luaconf.h
79 +CLEANFILES = $(BUILT_SOURCES)
80 +
81 +pkgconfig_DATA = src/lua5.3.pc
82 +
83 +edit = $(SED) \
84 + -e 's,@prefix[@],$(prefix),g' \
85 + -e 's,@datadir[@],$(datadir),g' \
86 + -e 's,@libdir[@],$(libdir),g'
87 +
88 +src/luaconf.h: $(srcdir)/src/luaconf.h.in
89 + rm -f $@ && $(edit) $(srcdir)/src/luaconf.h.in >$@
90 +
91 +##########
92 +# tests/ #
93 +##########
94 +
95 +TESTS = tests/all.lua
96 +TESTS_ENVIRONMENT = env LUA=$(abs_builddir)/lua5.3 $(abs_srcdir)/test-wrapper.sh
97 +
98 +EXTRA_DIST += test-wrapper.sh \
99 + tests/all.lua tests/api.lua tests/attrib.lua tests/big.lua tests/bitwise.lua \
100 + tests/calls.lua tests/closure.lua tests/code.lua tests/constructs.lua \
101 + tests/coroutine.lua tests/db.lua tests/errors.lua tests/events.lua \
102 + tests/files.lua tests/gc.lua tests/goto.lua tests/literals.lua \
103 + tests/locals.lua tests/main.lua tests/math.lua tests/nextvar.lua \
104 + tests/pm.lua tests/sort.lua tests/strings.lua tests/tpack.lua tests/utf8.lua \
105 + tests/vararg.lua tests/verybig.lua
106
107 diff --git a/configure.ac b/configure.ac
108 new file mode 100644
109 index 0000000..94c6f02
110 --- /dev/null
111 +++ b/configure.ac
112 @@ -0,0 +1,49 @@
113 +AC_PREREQ([2.69])
114 +AC_INIT([lua5.3], [5.3.6], [https://bugs.gentoo.org/], [lua], [http://www.lua.org])
115 +
116 +AC_CONFIG_SRCDIR([src/lapi.c])
117 +AC_CONFIG_MACRO_DIR([m4])
118 +
119 +AM_INIT_AUTOMAKE([1.15 foreign dist-xz no-dist-gzip serial-tests subdir-objects -Wall])
120 +
121 +AC_PROG_CC
122 +AC_PROG_SED
123 +AM_PROG_AR
124 +LT_INIT([disable-static])
125 +LT_LIB_M
126 +
127 +PKG_INSTALLDIR
128 +
129 +AC_ARG_WITH([readline],
130 + [AS_HELP_STRING([--with-readline], [Use readline for interpreter input [default=yes]])])
131 +
132 +# Check for readline
133 +AS_IF([test "x$with_readline" != "xno"], [
134 + PKG_CHECK_MODULES([READLINE], [readline])
135 + AC_DEFINE([LUA_USE_READLINE], [1], [Building with readline support])
136 + READLINE_REQUIRES_PRIVATE=readline
137 +])
138 +AC_SUBST([READLINE_REQUIRES_PRIVATE])
139 +
140 +AS_CASE([${host}],
141 + [*-mingw*], [
142 + AC_DEFINE([LUA_BUILD_AS_DLL], [1], [Building a DLL under Win32])
143 + ],
144 + [*-darwin*], [
145 + AC_DEFINE([LUA_USE_MACOSX], [1], [Use macOS routines])
146 + ],
147 + [*-linux*], [
148 + AC_DEFINE([LUA_USE_LINUX], [1], [Use Linux routines])
149 + AC_SEARCH_LIBS([dlopen], [dl dld], [], [
150 + AC_MSG_ERROR([unable to find the dlopen() function])
151 + ])
152 + ], [
153 + AC_DEFINE([LUA_USE_POSIX], [1], [Use POSIX routines])
154 + AC_SEARCH_LIBS([dlopen], [dl dld], [], [
155 + AC_MSG_ERROR([unable to find the dlopen() function])
156 + ])
157 + ]
158 +)
159 +
160 +AC_CONFIG_FILES([Makefile src/lua5.3.pc])
161 +AC_OUTPUT
162
163 diff --git a/doc/lua.1 b/doc/lua5.3.1
164 similarity index 100%
165 rename from doc/lua.1
166 rename to doc/lua5.3.1
167
168 diff --git a/doc/luac.1 b/doc/luac5.3.1
169 similarity index 100%
170 rename from doc/luac.1
171 rename to doc/luac5.3.1
172
173 diff --git a/src/lopcodes.c b/src/lopcodes.c
174 index 5ca3eb2..3bb4701 100644
175 --- a/src/lopcodes.c
176 +++ b/src/lopcodes.c
177 @@ -17,7 +17,7 @@
178
179 /* ORDER OP */
180
181 -LUAI_DDEF const char *const luaP_opnames[NUM_OPCODES+1] = {
182 +const char *const luaP_opnames[NUM_OPCODES+1] = {
183 "MOVE",
184 "LOADK",
185 "LOADKX",
186 @@ -71,7 +71,7 @@ LUAI_DDEF const char *const luaP_opnames[NUM_OPCODES+1] = {
187
188 #define opmode(t,a,b,c,m) (((t)<<7) | ((a)<<6) | ((b)<<4) | ((c)<<2) | (m))
189
190 -LUAI_DDEF const lu_byte luaP_opmodes[NUM_OPCODES] = {
191 +const lu_byte luaP_opmodes[NUM_OPCODES] = {
192 /* T A B C mode opcode */
193 opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_MOVE */
194 ,opmode(0, 1, OpArgK, OpArgN, iABx) /* OP_LOADK */
195
196 diff --git a/src/lopcodes.h b/src/lopcodes.h
197 index 6feaa1c..fae3e1f 100644
198 --- a/src/lopcodes.h
199 +++ b/src/lopcodes.h
200 @@ -278,7 +278,7 @@ enum OpArgMask {
201 OpArgK /* argument is a constant or register/constant */
202 };
203
204 -LUAI_DDEC const lu_byte luaP_opmodes[NUM_OPCODES];
205 +extern const lu_byte luaP_opmodes[NUM_OPCODES];
206
207 #define getOpMode(m) (cast(enum OpMode, luaP_opmodes[m] & 3))
208 #define getBMode(m) (cast(enum OpArgMask, (luaP_opmodes[m] >> 4) & 3))
209 @@ -287,7 +287,7 @@ LUAI_DDEC const lu_byte luaP_opmodes[NUM_OPCODES];
210 #define testTMode(m) (luaP_opmodes[m] & (1 << 7))
211
212
213 -LUAI_DDEC const char *const luaP_opnames[NUM_OPCODES+1]; /* opcode names */
214 +extern const char *const luaP_opnames[NUM_OPCODES+1]; /* opcode names */
215
216
217 /* number of list items to accumulate before a SETLIST instruction */
218
219 diff --git a/src/lua5.3.pc.in b/src/lua5.3.pc.in
220 new file mode 100644
221 index 0000000..ab8c88f
222 --- /dev/null
223 +++ b/src/lua5.3.pc.in
224 @@ -0,0 +1,18 @@
225 +prefix=@prefix@
226 +exec_prefix=@exec_prefix@
227 +libdir=@libdir@
228 +includedir=@includedir@/lua5.3
229 +datarootdir=@datarootdir@
230 +datadir=@datadir@
231 +
232 +Name: Lua
233 +Description: An Extensible Extension Language
234 +Version: @PACKAGE_VERSION@
235 +Requires.private: @READLINE_REQUIRES_PRIVATE@
236 +Libs: -L${libdir} -llua5.3
237 +Libs.private: @LIBM@ @LIBS@
238 +Cflags: -I${includedir}
239 +
240 +# information required by lua-utils.eclass::_lua_export
241 +INSTALL_LMOD=${datadir}/lua/5.3
242 +INSTALL_CMOD=${libdir}/lua/5.3
243
244 diff --git a/src/luaconf.h b/src/luaconf.h.in
245 similarity index 98%
246 rename from src/luaconf.h
247 rename to src/luaconf.h.in
248 index 9eeeea6..9865a76 100644
249 --- a/src/luaconf.h
250 +++ b/src/luaconf.h.in
251 @@ -61,14 +61,12 @@
252 #if defined(LUA_USE_LINUX)
253 #define LUA_USE_POSIX
254 #define LUA_USE_DLOPEN /* needs an extra library: -ldl */
255 -#define LUA_USE_READLINE /* needs some extra libraries */
256 #endif
257
258
259 #if defined(LUA_USE_MACOSX)
260 #define LUA_USE_POSIX
261 #define LUA_USE_DLOPEN /* MacOS does not need -ldl */
262 -#define LUA_USE_READLINE /* needs an extra library: -lreadline */
263 #endif
264
265
266 @@ -200,9 +198,9 @@
267
268 #else /* }{ */
269
270 -#define LUA_ROOT "/usr/local/"
271 -#define LUA_LDIR LUA_ROOT "share/lua/" LUA_VDIR "/"
272 -#define LUA_CDIR LUA_ROOT "lib/lua/" LUA_VDIR "/"
273 +#define LUA_ROOT "@prefix@/"
274 +#define LUA_LDIR "@datadir@/lua/" LUA_VDIR "/"
275 +#define LUA_CDIR "@libdir@/lua/" LUA_VDIR "/"
276 #define LUA_PATH_DEFAULT \
277 LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \
278 LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua;" \
279
280 diff --git a/src/lundump.h b/src/lundump.h
281 index ce492d6..c6485fe 100644
282 --- a/src/lundump.h
283 +++ b/src/lundump.h
284 @@ -26,7 +26,7 @@
285 LUAI_FUNC LClosure* luaU_undump (lua_State* L, ZIO* Z, const char* name);
286
287 /* dump one chunk; from ldump.c */
288 -LUAI_FUNC int luaU_dump (lua_State* L, const Proto* f, lua_Writer w,
289 +int luaU_dump (lua_State* L, const Proto* f, lua_Writer w,
290 void* data, int strip);
291
292 #endif
293
294 diff --git a/test-wrapper.sh b/test-wrapper.sh
295 new file mode 100755
296 index 0000000..57320d6
297 --- /dev/null
298 +++ b/test-wrapper.sh
299 @@ -0,0 +1,13 @@
300 +#!/usr/bin/env sh
301 +set -e
302 +
303 +# https://www.lua.org/tests/
304 +# There are two sets:
305 +# 1. basic
306 +# 2. complete
307 +#
308 +# The basic subset is selected by passing -e'_U=true'
309 +# The complete set is noted to contain tests that may consume too much memory or have non-portable tests.
310 +# attrib.lua for example needs some multilib customization (have to compile the stuff in libs/ for each ABI)
311 +
312 +cd "${srcdir}"/tests && "${LUA}" -e_U=true $(basename ${1})