1 |
commit: 108de56d49e60b29f4203e255ab222fe6860c34c |
2 |
Author: David Seifert <soap <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Sep 5 14:47:27 2022 +0000 |
4 |
Commit: David Seifert <soap <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Sep 5 14:47:27 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/lua-patches.git/commit/?id=108de56d |
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 | 74 +++++++++++++++++++++++++++++++++++++++++ |
16 |
configure.ac | 49 +++++++++++++++++++++++++++ |
17 |
doc/{lua.1 => lua5.4.1} | 0 |
18 |
doc/{luac.1 => luac5.4.1} | 0 |
19 |
src/ldebug.h | 2 +- |
20 |
src/lmem.h | 2 +- |
21 |
src/lua5.4.pc.in | 18 ++++++++++ |
22 |
src/{luaconf.h => luaconf.h.in} | 6 ++-- |
23 |
src/lundump.h | 2 +- |
24 |
test-wrapper.sh | 13 ++++++++ |
25 |
10 files changed, 160 insertions(+), 6 deletions(-) |
26 |
|
27 |
diff --git a/Makefile.am b/Makefile.am |
28 |
new file mode 100644 |
29 |
index 0000000..d610ce4 |
30 |
--- /dev/null |
31 |
+++ b/Makefile.am |
32 |
@@ -0,0 +1,74 @@ |
33 |
+######## |
34 |
+# doc/ # |
35 |
+######## |
36 |
+ |
37 |
+dist_doc_DATA = README |
38 |
+dist_man1_MANS = doc/lua5.4.1 doc/luac5.4.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.4 |
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.4.la |
55 |
+src_liblua5_4_la_LIBADD = $(LIBM) |
56 |
+src_liblua5_4_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/lgc.h src/linit.c src/liolib.c src/ljumptab.h 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 src/lopnames.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.4 luac5.4 |
69 |
+ |
70 |
+lua5_4_SOURCES = src/lua.c |
71 |
+lua5_4_CPPFLAGS = $(AM_CPPFLAGS) $(READLINE_CFLAGS) |
72 |
+lua5_4_LDADD = src/liblua5.4.la $(READLINE_LIBS) |
73 |
+ |
74 |
+luac5_4_SOURCES = src/luac.c |
75 |
+luac5_4_LDADD = src/liblua5.4.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.4.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.4 $(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/bwcoercion.lua tests/calls.lua tests/closure.lua tests/code.lua \ |
101 |
+ tests/constructs.lua tests/coroutine.lua tests/cstack.lua tests/db.lua \ |
102 |
+ tests/errors.lua tests/events.lua tests/files.lua tests/gc.lua \ |
103 |
+ tests/gengc.lua tests/goto.lua tests/heavy.lua tests/literals.lua \ |
104 |
+ tests/locals.lua tests/main.lua tests/math.lua tests/nextvar.lua \ |
105 |
+ tests/pm.lua tests/sort.lua tests/strings.lua tests/tpack.lua \ |
106 |
+ tests/tracegc.lua tests/utf8.lua tests/vararg.lua tests/verybig.lua |
107 |
|
108 |
diff --git a/configure.ac b/configure.ac |
109 |
new file mode 100644 |
110 |
index 0000000..fb81b7f |
111 |
--- /dev/null |
112 |
+++ b/configure.ac |
113 |
@@ -0,0 +1,49 @@ |
114 |
+AC_PREREQ([2.69]) |
115 |
+AC_INIT([lua5.4], [5.4.4], [https://bugs.gentoo.org/], [lua], [http://www.lua.org]) |
116 |
+ |
117 |
+AC_CONFIG_SRCDIR([src/lapi.c]) |
118 |
+AC_CONFIG_MACRO_DIR([m4]) |
119 |
+ |
120 |
+AM_INIT_AUTOMAKE([1.15 foreign dist-xz no-dist-gzip serial-tests subdir-objects -Wall]) |
121 |
+ |
122 |
+AC_PROG_CC |
123 |
+AC_PROG_SED |
124 |
+AM_PROG_AR |
125 |
+LT_INIT([disable-static]) |
126 |
+LT_LIB_M |
127 |
+ |
128 |
+PKG_INSTALLDIR |
129 |
+ |
130 |
+AC_ARG_WITH([readline], |
131 |
+ [AS_HELP_STRING([--with-readline], [Use readline for interpreter input [default=yes]])]) |
132 |
+ |
133 |
+# Check for readline |
134 |
+AS_IF([test "x$with_readline" != "xno"], [ |
135 |
+ PKG_CHECK_MODULES([READLINE], [readline]) |
136 |
+ AC_DEFINE([LUA_USE_READLINE], [1], [Building with readline support]) |
137 |
+ READLINE_REQUIRES_PRIVATE=readline |
138 |
+]) |
139 |
+AC_SUBST([READLINE_REQUIRES_PRIVATE]) |
140 |
+ |
141 |
+AS_CASE([${host}], |
142 |
+ [*-mingw*], [ |
143 |
+ AC_DEFINE([LUA_BUILD_AS_DLL], [1], [Building a DLL under Win32]) |
144 |
+ ], |
145 |
+ [*-darwin*], [ |
146 |
+ AC_DEFINE([LUA_USE_MACOSX], [1], [Use macOS routines]) |
147 |
+ ], |
148 |
+ [*-linux*], [ |
149 |
+ AC_DEFINE([LUA_USE_LINUX], [1], [Use Linux routines]) |
150 |
+ AC_SEARCH_LIBS([dlopen], [dl dld], [], [ |
151 |
+ AC_MSG_ERROR([unable to find the dlopen() function]) |
152 |
+ ]) |
153 |
+ ], [ |
154 |
+ AC_DEFINE([LUA_USE_POSIX], [1], [Use POSIX routines]) |
155 |
+ AC_SEARCH_LIBS([dlopen], [dl dld], [], [ |
156 |
+ AC_MSG_ERROR([unable to find the dlopen() function]) |
157 |
+ ]) |
158 |
+ ] |
159 |
+) |
160 |
+ |
161 |
+AC_CONFIG_FILES([Makefile src/lua5.4.pc]) |
162 |
+AC_OUTPUT |
163 |
|
164 |
diff --git a/doc/lua.1 b/doc/lua5.4.1 |
165 |
similarity index 100% |
166 |
rename from doc/lua.1 |
167 |
rename to doc/lua5.4.1 |
168 |
|
169 |
diff --git a/doc/luac.1 b/doc/luac5.4.1 |
170 |
similarity index 100% |
171 |
rename from doc/luac.1 |
172 |
rename to doc/luac5.4.1 |
173 |
|
174 |
diff --git a/src/ldebug.h b/src/ldebug.h |
175 |
index 974960e..f62aa6b 100644 |
176 |
--- a/src/ldebug.h |
177 |
+++ b/src/ldebug.h |
178 |
@@ -36,7 +36,7 @@ |
179 |
#endif |
180 |
|
181 |
|
182 |
-LUAI_FUNC int luaG_getfuncline (const Proto *f, int pc); |
183 |
+int luaG_getfuncline (const Proto *f, int pc); |
184 |
LUAI_FUNC const char *luaG_findlocal (lua_State *L, CallInfo *ci, int n, |
185 |
StkId *pos); |
186 |
LUAI_FUNC l_noret luaG_typeerror (lua_State *L, const TValue *o, |
187 |
|
188 |
diff --git a/src/lmem.h b/src/lmem.h |
189 |
index 8c75a44..e50c8ae 100644 |
190 |
--- a/src/lmem.h |
191 |
+++ b/src/lmem.h |
192 |
@@ -81,7 +81,7 @@ LUAI_FUNC void *luaM_realloc_ (lua_State *L, void *block, size_t oldsize, |
193 |
size_t size); |
194 |
LUAI_FUNC void *luaM_saferealloc_ (lua_State *L, void *block, size_t oldsize, |
195 |
size_t size); |
196 |
-LUAI_FUNC void luaM_free_ (lua_State *L, void *block, size_t osize); |
197 |
+void luaM_free_ (lua_State *L, void *block, size_t osize); |
198 |
LUAI_FUNC void *luaM_growaux_ (lua_State *L, void *block, int nelems, |
199 |
int *size, int size_elem, int limit, |
200 |
const char *what); |
201 |
|
202 |
diff --git a/src/lua5.4.pc.in b/src/lua5.4.pc.in |
203 |
new file mode 100644 |
204 |
index 0000000..334f22f |
205 |
--- /dev/null |
206 |
+++ b/src/lua5.4.pc.in |
207 |
@@ -0,0 +1,18 @@ |
208 |
+prefix=@prefix@ |
209 |
+exec_prefix=@exec_prefix@ |
210 |
+libdir=@libdir@ |
211 |
+includedir=@includedir@/lua5.4 |
212 |
+datarootdir=@datarootdir@ |
213 |
+datadir=@datadir@ |
214 |
+ |
215 |
+Name: Lua |
216 |
+Description: An Extensible Extension Language |
217 |
+Version: @PACKAGE_VERSION@ |
218 |
+Requires.private: @READLINE_REQUIRES_PRIVATE@ |
219 |
+Libs: -L${libdir} -llua5.4 |
220 |
+Libs.private: @LIBM@ @LIBS@ |
221 |
+Cflags: -I${includedir} |
222 |
+ |
223 |
+# information required by lua-utils.eclass::_lua_export |
224 |
+INSTALL_LMOD=${datadir}/lua/5.4 |
225 |
+INSTALL_CMOD=${libdir}/lua/5.4 |
226 |
|
227 |
diff --git a/src/luaconf.h b/src/luaconf.h.in |
228 |
similarity index 99% |
229 |
rename from src/luaconf.h |
230 |
rename to src/luaconf.h.in |
231 |
index d42d14b..b77ee3c 100644 |
232 |
--- a/src/luaconf.h |
233 |
+++ b/src/luaconf.h.in |
234 |
@@ -217,9 +217,9 @@ |
235 |
|
236 |
#else /* }{ */ |
237 |
|
238 |
-#define LUA_ROOT "/usr/local/" |
239 |
-#define LUA_LDIR LUA_ROOT "share/lua/" LUA_VDIR "/" |
240 |
-#define LUA_CDIR LUA_ROOT "lib/lua/" LUA_VDIR "/" |
241 |
+#define LUA_ROOT "@prefix@/" |
242 |
+#define LUA_LDIR "@datadir@/lua/" LUA_VDIR "/" |
243 |
+#define LUA_CDIR "@libdir@/lua/" LUA_VDIR "/" |
244 |
|
245 |
#if !defined(LUA_PATH_DEFAULT) |
246 |
#define LUA_PATH_DEFAULT \ |
247 |
|
248 |
diff --git a/src/lundump.h b/src/lundump.h |
249 |
index f3748a9..27b9e86 100644 |
250 |
--- a/src/lundump.h |
251 |
+++ b/src/lundump.h |
252 |
@@ -30,7 +30,7 @@ |
253 |
LUAI_FUNC LClosure* luaU_undump (lua_State* L, ZIO* Z, const char* name); |
254 |
|
255 |
/* dump one chunk; from ldump.c */ |
256 |
-LUAI_FUNC int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, |
257 |
+int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, |
258 |
void* data, int strip); |
259 |
|
260 |
#endif |
261 |
|
262 |
diff --git a/test-wrapper.sh b/test-wrapper.sh |
263 |
new file mode 100755 |
264 |
index 0000000..57320d6 |
265 |
--- /dev/null |
266 |
+++ b/test-wrapper.sh |
267 |
@@ -0,0 +1,13 @@ |
268 |
+#!/usr/bin/env sh |
269 |
+set -e |
270 |
+ |
271 |
+# https://www.lua.org/tests/ |
272 |
+# There are two sets: |
273 |
+# 1. basic |
274 |
+# 2. complete |
275 |
+# |
276 |
+# The basic subset is selected by passing -e'_U=true' |
277 |
+# The complete set is noted to contain tests that may consume too much memory or have non-portable tests. |
278 |
+# attrib.lua for example needs some multilib customization (have to compile the stuff in libs/ for each ABI) |
279 |
+ |
280 |
+cd "${srcdir}"/tests && "${LUA}" -e_U=true $(basename ${1}) |