1 |
commit: 8e5d5dc26b7bc303cd4e584bd003bf0afb0611e5 |
2 |
Author: David Seifert <soap <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Sep 6 10:09:07 2022 +0000 |
4 |
Commit: David Seifert <soap <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Sep 6 10:09:07 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/lua-patches.git/commit/?id=8e5d5dc2 |
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 | 47 ++++++++++++++++++++++++++ |
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 | 17 ++++++++++ |
22 |
src/{luaconf.h => luaconf.h.in} | 8 ++--- |
23 |
src/lundump.h | 2 +- |
24 |
test-wrapper.sh | 13 ++++++++ |
25 |
10 files changed, 158 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..3faeae4 |
110 |
--- /dev/null |
111 |
+++ b/configure.ac |
112 |
@@ -0,0 +1,47 @@ |
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 |
+]) |
137 |
+ |
138 |
+AS_CASE([${host}], |
139 |
+ [*-mingw*], [ |
140 |
+ AC_DEFINE([LUA_BUILD_AS_DLL], [1], [Building a DLL under Win32]) |
141 |
+ ], |
142 |
+ [*-darwin*], [ |
143 |
+ AC_DEFINE([LUA_USE_MACOSX], [1], [Use macOS routines]) |
144 |
+ ], |
145 |
+ [*-linux*], [ |
146 |
+ AC_DEFINE([LUA_USE_LINUX], [1], [Use Linux routines]) |
147 |
+ AC_SEARCH_LIBS([dlopen], [dl dld], [], [ |
148 |
+ AC_MSG_ERROR([unable to find the dlopen() function]) |
149 |
+ ]) |
150 |
+ ], [ |
151 |
+ AC_DEFINE([LUA_USE_POSIX], [1], [Use POSIX routines]) |
152 |
+ AC_SEARCH_LIBS([dlopen], [dl dld], [], [ |
153 |
+ AC_MSG_ERROR([unable to find the dlopen() function]) |
154 |
+ ]) |
155 |
+ ] |
156 |
+) |
157 |
+ |
158 |
+AC_CONFIG_FILES([Makefile src/lua5.3.pc]) |
159 |
+AC_OUTPUT |
160 |
|
161 |
diff --git a/doc/lua.1 b/doc/lua5.3.1 |
162 |
similarity index 100% |
163 |
rename from doc/lua.1 |
164 |
rename to doc/lua5.3.1 |
165 |
|
166 |
diff --git a/doc/luac.1 b/doc/luac5.3.1 |
167 |
similarity index 100% |
168 |
rename from doc/luac.1 |
169 |
rename to doc/luac5.3.1 |
170 |
|
171 |
diff --git a/src/lopcodes.c b/src/lopcodes.c |
172 |
index 5ca3eb2..3bb4701 100644 |
173 |
--- a/src/lopcodes.c |
174 |
+++ b/src/lopcodes.c |
175 |
@@ -17,7 +17,7 @@ |
176 |
|
177 |
/* ORDER OP */ |
178 |
|
179 |
-LUAI_DDEF const char *const luaP_opnames[NUM_OPCODES+1] = { |
180 |
+const char *const luaP_opnames[NUM_OPCODES+1] = { |
181 |
"MOVE", |
182 |
"LOADK", |
183 |
"LOADKX", |
184 |
@@ -71,7 +71,7 @@ LUAI_DDEF const char *const luaP_opnames[NUM_OPCODES+1] = { |
185 |
|
186 |
#define opmode(t,a,b,c,m) (((t)<<7) | ((a)<<6) | ((b)<<4) | ((c)<<2) | (m)) |
187 |
|
188 |
-LUAI_DDEF const lu_byte luaP_opmodes[NUM_OPCODES] = { |
189 |
+const lu_byte luaP_opmodes[NUM_OPCODES] = { |
190 |
/* T A B C mode opcode */ |
191 |
opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_MOVE */ |
192 |
,opmode(0, 1, OpArgK, OpArgN, iABx) /* OP_LOADK */ |
193 |
|
194 |
diff --git a/src/lopcodes.h b/src/lopcodes.h |
195 |
index 6feaa1c..fae3e1f 100644 |
196 |
--- a/src/lopcodes.h |
197 |
+++ b/src/lopcodes.h |
198 |
@@ -278,7 +278,7 @@ enum OpArgMask { |
199 |
OpArgK /* argument is a constant or register/constant */ |
200 |
}; |
201 |
|
202 |
-LUAI_DDEC const lu_byte luaP_opmodes[NUM_OPCODES]; |
203 |
+extern const lu_byte luaP_opmodes[NUM_OPCODES]; |
204 |
|
205 |
#define getOpMode(m) (cast(enum OpMode, luaP_opmodes[m] & 3)) |
206 |
#define getBMode(m) (cast(enum OpArgMask, (luaP_opmodes[m] >> 4) & 3)) |
207 |
@@ -287,7 +287,7 @@ LUAI_DDEC const lu_byte luaP_opmodes[NUM_OPCODES]; |
208 |
#define testTMode(m) (luaP_opmodes[m] & (1 << 7)) |
209 |
|
210 |
|
211 |
-LUAI_DDEC const char *const luaP_opnames[NUM_OPCODES+1]; /* opcode names */ |
212 |
+extern const char *const luaP_opnames[NUM_OPCODES+1]; /* opcode names */ |
213 |
|
214 |
|
215 |
/* number of list items to accumulate before a SETLIST instruction */ |
216 |
|
217 |
diff --git a/src/lua5.3.pc.in b/src/lua5.3.pc.in |
218 |
new file mode 100644 |
219 |
index 0000000..e291f9c |
220 |
--- /dev/null |
221 |
+++ b/src/lua5.3.pc.in |
222 |
@@ -0,0 +1,17 @@ |
223 |
+prefix=@prefix@ |
224 |
+exec_prefix=@exec_prefix@ |
225 |
+libdir=@libdir@ |
226 |
+includedir=@includedir@/lua5.3 |
227 |
+datarootdir=@datarootdir@ |
228 |
+datadir=@datadir@ |
229 |
+ |
230 |
+Name: Lua |
231 |
+Description: An Extensible Extension Language |
232 |
+Version: @PACKAGE_VERSION@ |
233 |
+Libs: -L${libdir} -llua5.3 |
234 |
+Libs.private: @LIBM@ @LIBS@ |
235 |
+Cflags: -I${includedir} |
236 |
+ |
237 |
+# information required by lua-utils.eclass::_lua_export |
238 |
+INSTALL_LMOD=${datadir}/lua/5.3 |
239 |
+INSTALL_CMOD=${libdir}/lua/5.3 |
240 |
|
241 |
diff --git a/src/luaconf.h b/src/luaconf.h.in |
242 |
similarity index 98% |
243 |
rename from src/luaconf.h |
244 |
rename to src/luaconf.h.in |
245 |
index 9eeeea6..9865a76 100644 |
246 |
--- a/src/luaconf.h |
247 |
+++ b/src/luaconf.h.in |
248 |
@@ -61,14 +61,12 @@ |
249 |
#if defined(LUA_USE_LINUX) |
250 |
#define LUA_USE_POSIX |
251 |
#define LUA_USE_DLOPEN /* needs an extra library: -ldl */ |
252 |
-#define LUA_USE_READLINE /* needs some extra libraries */ |
253 |
#endif |
254 |
|
255 |
|
256 |
#if defined(LUA_USE_MACOSX) |
257 |
#define LUA_USE_POSIX |
258 |
#define LUA_USE_DLOPEN /* MacOS does not need -ldl */ |
259 |
-#define LUA_USE_READLINE /* needs an extra library: -lreadline */ |
260 |
#endif |
261 |
|
262 |
|
263 |
@@ -200,9 +198,9 @@ |
264 |
|
265 |
#else /* }{ */ |
266 |
|
267 |
-#define LUA_ROOT "/usr/local/" |
268 |
-#define LUA_LDIR LUA_ROOT "share/lua/" LUA_VDIR "/" |
269 |
-#define LUA_CDIR LUA_ROOT "lib/lua/" LUA_VDIR "/" |
270 |
+#define LUA_ROOT "@prefix@/" |
271 |
+#define LUA_LDIR "@datadir@/lua/" LUA_VDIR "/" |
272 |
+#define LUA_CDIR "@libdir@/lua/" LUA_VDIR "/" |
273 |
#define LUA_PATH_DEFAULT \ |
274 |
LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \ |
275 |
LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua;" \ |
276 |
|
277 |
diff --git a/src/lundump.h b/src/lundump.h |
278 |
index ce492d6..c6485fe 100644 |
279 |
--- a/src/lundump.h |
280 |
+++ b/src/lundump.h |
281 |
@@ -26,7 +26,7 @@ |
282 |
LUAI_FUNC LClosure* luaU_undump (lua_State* L, ZIO* Z, const char* name); |
283 |
|
284 |
/* dump one chunk; from ldump.c */ |
285 |
-LUAI_FUNC int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, |
286 |
+int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, |
287 |
void* data, int strip); |
288 |
|
289 |
#endif |
290 |
|
291 |
diff --git a/test-wrapper.sh b/test-wrapper.sh |
292 |
new file mode 100755 |
293 |
index 0000000..57320d6 |
294 |
--- /dev/null |
295 |
+++ b/test-wrapper.sh |
296 |
@@ -0,0 +1,13 @@ |
297 |
+#!/usr/bin/env sh |
298 |
+set -e |
299 |
+ |
300 |
+# https://www.lua.org/tests/ |
301 |
+# There are two sets: |
302 |
+# 1. basic |
303 |
+# 2. complete |
304 |
+# |
305 |
+# The basic subset is selected by passing -e'_U=true' |
306 |
+# The complete set is noted to contain tests that may consume too much memory or have non-portable tests. |
307 |
+# attrib.lua for example needs some multilib customization (have to compile the stuff in libs/ for each ABI) |
308 |
+ |
309 |
+cd "${srcdir}"/tests && "${LUA}" -e_U=true $(basename ${1}) |