Gentoo Archives: gentoo-commits

From: David Seifert <soap@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/lua-patches:5.4.4 commit in: src/, doc/, /
Date: Tue, 06 Sep 2022 10:39:16
Message-Id: 1662459003.f6e01395e872d325587026017cfd875436262116.soap@gentoo
1 commit: f6e01395e872d325587026017cfd875436262116
2 Author: David Seifert <soap <AT> gentoo <DOT> org>
3 AuthorDate: Tue Sep 6 10:10:03 2022 +0000
4 Commit: David Seifert <soap <AT> gentoo <DOT> org>
5 CommitDate: Tue Sep 6 10:10:03 2022 +0000
6 URL: https://gitweb.gentoo.org/proj/lua-patches.git/commit/?id=f6e01395
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 | 47 ++++++++++++++++++++++++++
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 | 17 ++++++++++
22 src/{luaconf.h => luaconf.h.in} | 6 ++--
23 src/lundump.h | 2 +-
24 test-wrapper.sh | 13 ++++++++
25 10 files changed, 157 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..6e290a8
111 --- /dev/null
112 +++ b/configure.ac
113 @@ -0,0 +1,47 @@
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 +])
138 +
139 +AS_CASE([${host}],
140 + [*-mingw*], [
141 + AC_DEFINE([LUA_BUILD_AS_DLL], [1], [Building a DLL under Win32])
142 + ],
143 + [*-darwin*], [
144 + AC_DEFINE([LUA_USE_MACOSX], [1], [Use macOS routines])
145 + ],
146 + [*-linux*], [
147 + AC_DEFINE([LUA_USE_LINUX], [1], [Use Linux routines])
148 + AC_SEARCH_LIBS([dlopen], [dl dld], [], [
149 + AC_MSG_ERROR([unable to find the dlopen() function])
150 + ])
151 + ], [
152 + AC_DEFINE([LUA_USE_POSIX], [1], [Use POSIX routines])
153 + AC_SEARCH_LIBS([dlopen], [dl dld], [], [
154 + AC_MSG_ERROR([unable to find the dlopen() function])
155 + ])
156 + ]
157 +)
158 +
159 +AC_CONFIG_FILES([Makefile src/lua5.4.pc])
160 +AC_OUTPUT
161
162 diff --git a/doc/lua.1 b/doc/lua5.4.1
163 similarity index 100%
164 rename from doc/lua.1
165 rename to doc/lua5.4.1
166
167 diff --git a/doc/luac.1 b/doc/luac5.4.1
168 similarity index 100%
169 rename from doc/luac.1
170 rename to doc/luac5.4.1
171
172 diff --git a/src/ldebug.h b/src/ldebug.h
173 index 974960e..f62aa6b 100644
174 --- a/src/ldebug.h
175 +++ b/src/ldebug.h
176 @@ -36,7 +36,7 @@
177 #endif
178
179
180 -LUAI_FUNC int luaG_getfuncline (const Proto *f, int pc);
181 +int luaG_getfuncline (const Proto *f, int pc);
182 LUAI_FUNC const char *luaG_findlocal (lua_State *L, CallInfo *ci, int n,
183 StkId *pos);
184 LUAI_FUNC l_noret luaG_typeerror (lua_State *L, const TValue *o,
185
186 diff --git a/src/lmem.h b/src/lmem.h
187 index 8c75a44..e50c8ae 100644
188 --- a/src/lmem.h
189 +++ b/src/lmem.h
190 @@ -81,7 +81,7 @@ LUAI_FUNC void *luaM_realloc_ (lua_State *L, void *block, size_t oldsize,
191 size_t size);
192 LUAI_FUNC void *luaM_saferealloc_ (lua_State *L, void *block, size_t oldsize,
193 size_t size);
194 -LUAI_FUNC void luaM_free_ (lua_State *L, void *block, size_t osize);
195 +void luaM_free_ (lua_State *L, void *block, size_t osize);
196 LUAI_FUNC void *luaM_growaux_ (lua_State *L, void *block, int nelems,
197 int *size, int size_elem, int limit,
198 const char *what);
199
200 diff --git a/src/lua5.4.pc.in b/src/lua5.4.pc.in
201 new file mode 100644
202 index 0000000..e5bd96c
203 --- /dev/null
204 +++ b/src/lua5.4.pc.in
205 @@ -0,0 +1,17 @@
206 +prefix=@prefix@
207 +exec_prefix=@exec_prefix@
208 +libdir=@libdir@
209 +includedir=@includedir@/lua5.4
210 +datarootdir=@datarootdir@
211 +datadir=@datadir@
212 +
213 +Name: Lua
214 +Description: An Extensible Extension Language
215 +Version: @PACKAGE_VERSION@
216 +Libs: -L${libdir} -llua5.4
217 +Libs.private: @LIBM@ @LIBS@
218 +Cflags: -I${includedir}
219 +
220 +# information required by lua-utils.eclass::_lua_export
221 +INSTALL_LMOD=${datadir}/lua/5.4
222 +INSTALL_CMOD=${libdir}/lua/5.4
223
224 diff --git a/src/luaconf.h b/src/luaconf.h.in
225 similarity index 99%
226 rename from src/luaconf.h
227 rename to src/luaconf.h.in
228 index d42d14b..b77ee3c 100644
229 --- a/src/luaconf.h
230 +++ b/src/luaconf.h.in
231 @@ -217,9 +217,9 @@
232
233 #else /* }{ */
234
235 -#define LUA_ROOT "/usr/local/"
236 -#define LUA_LDIR LUA_ROOT "share/lua/" LUA_VDIR "/"
237 -#define LUA_CDIR LUA_ROOT "lib/lua/" LUA_VDIR "/"
238 +#define LUA_ROOT "@prefix@/"
239 +#define LUA_LDIR "@datadir@/lua/" LUA_VDIR "/"
240 +#define LUA_CDIR "@libdir@/lua/" LUA_VDIR "/"
241
242 #if !defined(LUA_PATH_DEFAULT)
243 #define LUA_PATH_DEFAULT \
244
245 diff --git a/src/lundump.h b/src/lundump.h
246 index f3748a9..27b9e86 100644
247 --- a/src/lundump.h
248 +++ b/src/lundump.h
249 @@ -30,7 +30,7 @@
250 LUAI_FUNC LClosure* luaU_undump (lua_State* L, ZIO* Z, const char* name);
251
252 /* dump one chunk; from ldump.c */
253 -LUAI_FUNC int luaU_dump (lua_State* L, const Proto* f, lua_Writer w,
254 +int luaU_dump (lua_State* L, const Proto* f, lua_Writer w,
255 void* data, int strip);
256
257 #endif
258
259 diff --git a/test-wrapper.sh b/test-wrapper.sh
260 new file mode 100755
261 index 0000000..57320d6
262 --- /dev/null
263 +++ b/test-wrapper.sh
264 @@ -0,0 +1,13 @@
265 +#!/usr/bin/env sh
266 +set -e
267 +
268 +# https://www.lua.org/tests/
269 +# There are two sets:
270 +# 1. basic
271 +# 2. complete
272 +#
273 +# The basic subset is selected by passing -e'_U=true'
274 +# The complete set is noted to contain tests that may consume too much memory or have non-portable tests.
275 +# attrib.lua for example needs some multilib customization (have to compile the stuff in libs/ for each ABI)
276 +
277 +cd "${srcdir}"/tests && "${LUA}" -e_U=true $(basename ${1})