aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Seifert <soap@gentoo.org>2023-07-16 11:44:12 +0200
committerDavid Seifert <soap@gentoo.org>2023-07-16 11:44:12 +0200
commitfe362b7cd94f1b2d60ebd4d02bb295d211586a69 (patch)
tree86db3aca3966fd904e174bd53c1776daa7d5dbd3
parentAdd upstream tests (diff)
downloadlua-patches-fe362b7cd94f1b2d60ebd4d02bb295d211586a69.tar.gz
lua-patches-fe362b7cd94f1b2d60ebd4d02bb295d211586a69.tar.bz2
lua-patches-fe362b7cd94f1b2d60ebd4d02bb295d211586a69.zip
Add Autotools5.4.6
* inspired by Fedora's patches, but mostly rewritten for Gentoo's multi-versioned approach. Signed-off-by: David Seifert <soap@gentoo.org>
-rw-r--r--Makefile.am74
-rw-r--r--configure.ac47
-rw-r--r--doc/lua5.4.1 (renamed from doc/lua.1)0
-rw-r--r--doc/luac5.4.1 (renamed from doc/luac.1)0
-rw-r--r--src/ldebug.h2
-rw-r--r--src/lmem.h2
-rw-r--r--src/lua5.4.pc.in17
-rw-r--r--src/luaconf.h.in (renamed from src/luaconf.h)6
-rw-r--r--src/lundump.h2
-rwxr-xr-xtest-wrapper.sh13
10 files changed, 157 insertions, 6 deletions
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..d610ce4
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,74 @@
+########
+# doc/ #
+########
+
+dist_doc_DATA = README
+dist_man1_MANS = doc/lua5.4.1 doc/luac5.4.1
+dist_html_DATA = \
+ doc/contents.html doc/index.css doc/logo.gif doc/lua.css doc/manual.css \
+ doc/manual.html doc/osi-certified-72x60.png doc/readme.html
+
+########
+# src/ #
+########
+
+AM_CFLAGS = -Wall
+AM_CPPFLAGS = -I$(builddir)/src # for luaconf.h
+
+luadir = $(includedir)/lua5.4
+lua_HEADERS = src/lua.h src/lualib.h src/lauxlib.h src/lua.hpp
+nodist_lua_HEADERS = src/luaconf.h
+
+lib_LTLIBRARIES = src/liblua5.4.la
+src_liblua5_4_la_LIBADD = $(LIBM)
+src_liblua5_4_la_SOURCES = \
+ src/lapi.c src/lapi.h src/lauxlib.c src/lbaselib.c src/lcode.c src/lcode.h \
+ src/lcorolib.c src/lctype.c src/lctype.h src/ldblib.c src/ldebug.c \
+ src/ldebug.h src/ldo.c src/ldo.h src/ldump.c src/lfunc.c src/lfunc.h \
+ src/lgc.c src/lgc.h src/linit.c src/liolib.c src/ljumptab.h src/llex.c \
+ src/llex.h src/llimits.h src/lmathlib.c src/lmem.c src/lmem.h src/loadlib.c \
+ src/lobject.c src/lobject.h src/lopcodes.c src/lopcodes.h src/lopnames.h \
+ src/loslib.c src/lparser.c src/lparser.h src/lprefix.h src/lstate.c \
+ src/lstate.h src/lstring.c src/lstring.h src/lstrlib.c src/ltable.c \
+ src/ltable.h src/ltablib.c src/ltm.c src/ltm.h src/lundump.c src/lundump.h \
+ src/lutf8lib.c src/lvm.c src/lvm.h src/lzio.c src/lzio.h
+
+bin_PROGRAMS = lua5.4 luac5.4
+
+lua5_4_SOURCES = src/lua.c
+lua5_4_CPPFLAGS = $(AM_CPPFLAGS) $(READLINE_CFLAGS)
+lua5_4_LDADD = src/liblua5.4.la $(READLINE_LIBS)
+
+luac5_4_SOURCES = src/luac.c
+luac5_4_LDADD = src/liblua5.4.la
+
+EXTRA_DIST = src/luaconf.h.in
+BUILT_SOURCES = src/luaconf.h
+CLEANFILES = $(BUILT_SOURCES)
+
+pkgconfig_DATA = src/lua5.4.pc
+
+edit = $(SED) \
+ -e 's,@prefix[@],$(prefix),g' \
+ -e 's,@datadir[@],$(datadir),g' \
+ -e 's,@libdir[@],$(libdir),g'
+
+src/luaconf.h: $(srcdir)/src/luaconf.h.in
+ rm -f $@ && $(edit) $(srcdir)/src/luaconf.h.in >$@
+
+##########
+# tests/ #
+##########
+
+TESTS = tests/all.lua
+TESTS_ENVIRONMENT = env LUA=$(abs_builddir)/lua5.4 $(abs_srcdir)/test-wrapper.sh
+
+EXTRA_DIST += test-wrapper.sh \
+ tests/all.lua tests/api.lua tests/attrib.lua tests/big.lua tests/bitwise.lua \
+ tests/bwcoercion.lua tests/calls.lua tests/closure.lua tests/code.lua \
+ tests/constructs.lua tests/coroutine.lua tests/cstack.lua tests/db.lua \
+ tests/errors.lua tests/events.lua tests/files.lua tests/gc.lua \
+ tests/gengc.lua tests/goto.lua tests/heavy.lua tests/literals.lua \
+ tests/locals.lua tests/main.lua tests/math.lua tests/nextvar.lua \
+ tests/pm.lua tests/sort.lua tests/strings.lua tests/tpack.lua \
+ tests/tracegc.lua tests/utf8.lua tests/vararg.lua tests/verybig.lua
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..ab2a003
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,47 @@
+AC_PREREQ([2.69])
+AC_INIT([lua5.4], [5.4.6], [https://bugs.gentoo.org/], [lua], [http://www.lua.org])
+
+AC_CONFIG_SRCDIR([src/lapi.c])
+AC_CONFIG_MACRO_DIR([m4])
+
+AM_INIT_AUTOMAKE([1.15 foreign dist-xz no-dist-gzip serial-tests subdir-objects -Wall])
+
+AC_PROG_CC
+AC_PROG_SED
+AM_PROG_AR
+LT_INIT([disable-static])
+LT_LIB_M
+
+PKG_INSTALLDIR
+
+AC_ARG_WITH([readline],
+ [AS_HELP_STRING([--with-readline], [Use readline for interpreter input [default=yes]])])
+
+# Check for readline
+AS_IF([test "x$with_readline" != "xno"], [
+ PKG_CHECK_MODULES([READLINE], [readline])
+ AC_DEFINE([LUA_USE_READLINE], [1], [Building with readline support])
+])
+
+AS_CASE([${host}],
+ [*-mingw*], [
+ AC_DEFINE([LUA_BUILD_AS_DLL], [1], [Building a DLL under Win32])
+ ],
+ [*-darwin*], [
+ AC_DEFINE([LUA_USE_MACOSX], [1], [Use macOS routines])
+ ],
+ [*-linux*], [
+ AC_DEFINE([LUA_USE_LINUX], [1], [Use Linux routines])
+ AC_SEARCH_LIBS([dlopen], [dl dld], [], [
+ AC_MSG_ERROR([unable to find the dlopen() function])
+ ])
+ ], [
+ AC_DEFINE([LUA_USE_POSIX], [1], [Use POSIX routines])
+ AC_SEARCH_LIBS([dlopen], [dl dld], [], [
+ AC_MSG_ERROR([unable to find the dlopen() function])
+ ])
+ ]
+)
+
+AC_CONFIG_FILES([Makefile src/lua5.4.pc])
+AC_OUTPUT
diff --git a/doc/lua.1 b/doc/lua5.4.1
index 3f472fd..3f472fd 100644
--- a/doc/lua.1
+++ b/doc/lua5.4.1
diff --git a/doc/luac.1 b/doc/luac5.4.1
index 33a4ed0..33a4ed0 100644
--- a/doc/luac.1
+++ b/doc/luac5.4.1
diff --git a/src/ldebug.h b/src/ldebug.h
index 2c3074c..1efbdc3 100644
--- a/src/ldebug.h
+++ b/src/ldebug.h
@@ -36,7 +36,7 @@
#endif
-LUAI_FUNC int luaG_getfuncline (const Proto *f, int pc);
+int luaG_getfuncline (const Proto *f, int pc);
LUAI_FUNC const char *luaG_findlocal (lua_State *L, CallInfo *ci, int n,
StkId *pos);
LUAI_FUNC l_noret luaG_typeerror (lua_State *L, const TValue *o,
diff --git a/src/lmem.h b/src/lmem.h
index 8c75a44..e50c8ae 100644
--- a/src/lmem.h
+++ b/src/lmem.h
@@ -81,7 +81,7 @@ LUAI_FUNC void *luaM_realloc_ (lua_State *L, void *block, size_t oldsize,
size_t size);
LUAI_FUNC void *luaM_saferealloc_ (lua_State *L, void *block, size_t oldsize,
size_t size);
-LUAI_FUNC void luaM_free_ (lua_State *L, void *block, size_t osize);
+void luaM_free_ (lua_State *L, void *block, size_t osize);
LUAI_FUNC void *luaM_growaux_ (lua_State *L, void *block, int nelems,
int *size, int size_elem, int limit,
const char *what);
diff --git a/src/lua5.4.pc.in b/src/lua5.4.pc.in
new file mode 100644
index 0000000..e5bd96c
--- /dev/null
+++ b/src/lua5.4.pc.in
@@ -0,0 +1,17 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@/lua5.4
+datarootdir=@datarootdir@
+datadir=@datadir@
+
+Name: Lua
+Description: An Extensible Extension Language
+Version: @PACKAGE_VERSION@
+Libs: -L${libdir} -llua5.4
+Libs.private: @LIBM@ @LIBS@
+Cflags: -I${includedir}
+
+# information required by lua-utils.eclass::_lua_export
+INSTALL_LMOD=${datadir}/lua/5.4
+INSTALL_CMOD=${libdir}/lua/5.4
diff --git a/src/luaconf.h b/src/luaconf.h.in
index 137103e..2b77952 100644
--- a/src/luaconf.h
+++ b/src/luaconf.h.in
@@ -223,9 +223,9 @@
#else /* }{ */
-#define LUA_ROOT "/usr/local/"
-#define LUA_LDIR LUA_ROOT "share/lua/" LUA_VDIR "/"
-#define LUA_CDIR LUA_ROOT "lib/lua/" LUA_VDIR "/"
+#define LUA_ROOT "@prefix@/"
+#define LUA_LDIR "@datadir@/lua/" LUA_VDIR "/"
+#define LUA_CDIR "@libdir@/lua/" LUA_VDIR "/"
#if !defined(LUA_PATH_DEFAULT)
#define LUA_PATH_DEFAULT \
diff --git a/src/lundump.h b/src/lundump.h
index f3748a9..27b9e86 100644
--- a/src/lundump.h
+++ b/src/lundump.h
@@ -30,7 +30,7 @@
LUAI_FUNC LClosure* luaU_undump (lua_State* L, ZIO* Z, const char* name);
/* dump one chunk; from ldump.c */
-LUAI_FUNC int luaU_dump (lua_State* L, const Proto* f, lua_Writer w,
+int luaU_dump (lua_State* L, const Proto* f, lua_Writer w,
void* data, int strip);
#endif
diff --git a/test-wrapper.sh b/test-wrapper.sh
new file mode 100755
index 0000000..57320d6
--- /dev/null
+++ b/test-wrapper.sh
@@ -0,0 +1,13 @@
+#!/usr/bin/env sh
+set -e
+
+# https://www.lua.org/tests/
+# There are two sets:
+# 1. basic
+# 2. complete
+#
+# The basic subset is selected by passing -e'_U=true'
+# The complete set is noted to contain tests that may consume too much memory or have non-portable tests.
+# attrib.lua for example needs some multilib customization (have to compile the stuff in libs/ for each ABI)
+
+cd "${srcdir}"/tests && "${LUA}" -e_U=true $(basename ${1})