public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/lua-patches:5.1.5 commit in: src/, /, doc/
@ 2022-09-06 10:06 David Seifert
  0 siblings, 0 replies; only message in thread
From: David Seifert @ 2022-09-06 10:06 UTC (permalink / raw
  To: gentoo-commits

commit:     a336d1bd47c13927547676b34aa809f583fb8cdc
Author:     David Seifert <soap <AT> gentoo <DOT> org>
AuthorDate: Tue Sep  6 10:05:50 2022 +0000
Commit:     David Seifert <soap <AT> gentoo <DOT> org>
CommitDate: Tue Sep  6 10:05:50 2022 +0000
URL:        https://gitweb.gentoo.org/proj/lua-patches.git/commit/?id=a336d1bd

Add Autotools

* inspired by Fedora's patches, but mostly rewritten
  for Gentoo's multi-versioned approach.

Signed-off-by: David Seifert <soap <AT> gentoo.org>

 Makefile.am                     | 72 +++++++++++++++++++++++++++++++++++++++++
 configure.ac                    | 58 +++++++++++++++++++++++++++++++++
 doc/{lua.1 => lua5.1.1}         |  0
 doc/{luac.1 => luac5.1.1}       |  0
 src/ldo.h                       |  2 +-
 src/lfunc.h                     |  2 +-
 src/lmem.h                      |  4 +--
 src/lstring.h                   |  2 +-
 src/lua5.1.pc.in                | 17 ++++++++++
 src/luac.c                      |  1 -
 src/{luaconf.h => luaconf.h.in} | 12 ++-----
 src/lundump.h                   |  2 +-
 test-wrapper.sh                 | 13 ++++++++
 13 files changed, 169 insertions(+), 16 deletions(-)

diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..23d039a
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,72 @@
+########
+# doc/ #
+########
+
+dist_doc_DATA = HISTORY README
+dist_man1_MANS = doc/lua5.1.1 doc/luac5.1.1
+dist_html_DATA = \
+	doc/contents.html doc/cover.png doc/logo.gif doc/luac.html doc/lua.css \
+	doc/lua.html doc/manual.css doc/manual.html doc/readme.html
+
+########
+# src/ #
+########
+
+AM_CFLAGS = -Wall
+AM_CPPFLAGS = -I$(builddir)/src # for luaconf.h
+
+luadir = $(includedir)/lua5.1
+lua_HEADERS = src/lua.h src/lualib.h src/lauxlib.h etc/lua.hpp
+nodist_lua_HEADERS = src/luaconf.h
+
+lib_LTLIBRARIES = src/liblua5.1.la
+src_liblua5_1_la_LIBADD = $(LIBM)
+src_liblua5_1_la_SOURCES = \
+	src/lapi.c src/lapi.h src/lauxlib.c src/lbaselib.c src/lcode.c src/lcode.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/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/loslib.c src/lparser.c src/lparser.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/lvm.c \
+	src/lvm.h src/lzio.c src/lzio.h
+
+bin_PROGRAMS = lua5.1 luac5.1
+
+lua5_1_SOURCES = src/lua.c
+lua5_1_CPPFLAGS = $(AM_CPPFLAGS) $(READLINE_CFLAGS)
+lua5_1_LDADD = src/liblua5.1.la $(READLINE_LIBS)
+
+luac5_1_SOURCES = src/luac.c
+luac5_1_LDADD = src/liblua5.1.la
+
+EXTRA_DIST = src/luaconf.h.in
+BUILT_SOURCES = src/luaconf.h
+CLEANFILES = $(BUILT_SOURCES)
+
+pkgconfig_DATA = src/lua5.1.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 = \
+	test/bisect.lua test/cf.lua test/echo.lua test/env.lua test/factorial.lua \
+	test/fib.lua test/fibfor.lua test/hello.lua test/printf.lua test/sieve.lua \
+	test/sort.lua test/trace-calls.lua test/trace-globals.lua
+TESTS_ENVIRONMENT = env LUA=$(abs_builddir)/lua5.1 $(abs_srcdir)/test-wrapper.sh
+
+EXTRA_DIST += test-wrapper.sh \
+	test/bisect.lua test/cf.lua test/echo.lua test/env.lua test/factorial.lua \
+	test/fibfor.lua test/fib.lua test/globals.lua test/hello.lua test/life.lua \
+	test/luac.lua test/printf.lua test/readonly.lua test/sieve.lua test/sort.lua \
+	test/table.lua test/trace-calls.lua test/trace-globals.lua test/xd.lua

diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..f483977
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,58 @@
+AC_PREREQ([2.69])
+AC_INIT([lua5.1], [5.1.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_ENABLE([deprecated],
+  [AS_HELP_STRING([--disable-deprecated], [Disable deprecated APIs [default=yes]])])
+
+AS_IF([test "x$enable_deprecated" != "xno"], [
+  AC_DEFINE([LUA_COMPAT_VARARG], [1], [Compatibility with old vararg feature])
+  AC_DEFINE([LUA_COMPAT_MOD], [1], [Compatibility with old math.mod function])
+  AC_DEFINE([LUA_COMPAT_LSTR], [1], [Compatibility with old long string nesting facility])
+  AC_DEFINE([LUA_COMPAT_GFIND], [1], [Compatibility with old 'string.gfind' name])
+  AC_DEFINE([LUA_COMPAT_OPENLIB], [1], [Compatibility with old 'luaL_openlib' behavior])
+])
+
+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.1.pc])
+AC_OUTPUT

diff --git a/doc/lua.1 b/doc/lua5.1.1
similarity index 100%
rename from doc/lua.1
rename to doc/lua5.1.1

diff --git a/doc/luac.1 b/doc/luac5.1.1
similarity index 100%
rename from doc/luac.1
rename to doc/luac5.1.1

diff --git a/src/ldo.h b/src/ldo.h
index 98fddac..bb56360 100644
--- a/src/ldo.h
+++ b/src/ldo.h
@@ -46,7 +46,7 @@ LUAI_FUNC int luaD_pcall (lua_State *L, Pfunc func, void *u,
 LUAI_FUNC int luaD_poscall (lua_State *L, StkId firstResult);
 LUAI_FUNC void luaD_reallocCI (lua_State *L, int newsize);
 LUAI_FUNC void luaD_reallocstack (lua_State *L, int newsize);
-LUAI_FUNC void luaD_growstack (lua_State *L, int n);
+void luaD_growstack (lua_State *L, int n);
 
 LUAI_FUNC void luaD_throw (lua_State *L, int errcode);
 LUAI_FUNC int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud);

diff --git a/src/lfunc.h b/src/lfunc.h
index a68cf51..475edaf 100644
--- a/src/lfunc.h
+++ b/src/lfunc.h
@@ -18,7 +18,7 @@
                          cast(int, sizeof(TValue *)*((n)-1)))
 
 
-LUAI_FUNC Proto *luaF_newproto (lua_State *L);
+Proto *luaF_newproto (lua_State *L);
 LUAI_FUNC Closure *luaF_newCclosure (lua_State *L, int nelems, Table *e);
 LUAI_FUNC Closure *luaF_newLclosure (lua_State *L, int nelems, Table *e);
 LUAI_FUNC UpVal *luaF_newupval (lua_State *L);

diff --git a/src/lmem.h b/src/lmem.h
index 7c2dcb3..96575bc 100644
--- a/src/lmem.h
+++ b/src/lmem.h
@@ -38,9 +38,9 @@
    ((v)=cast(t *, luaM_reallocv(L, v, oldn, n, sizeof(t))))
 
 
-LUAI_FUNC void *luaM_realloc_ (lua_State *L, void *block, size_t oldsize,
+void *luaM_realloc_ (lua_State *L, void *block, size_t oldsize,
                                                           size_t size);
-LUAI_FUNC void *luaM_toobig (lua_State *L);
+void *luaM_toobig (lua_State *L);
 LUAI_FUNC void *luaM_growaux_ (lua_State *L, void *block, int *size,
                                size_t size_elem, int limit,
                                const char *errormsg);

diff --git a/src/lstring.h b/src/lstring.h
index 73a2ff8..70fd8e4 100644
--- a/src/lstring.h
+++ b/src/lstring.h
@@ -25,7 +25,7 @@
 
 LUAI_FUNC void luaS_resize (lua_State *L, int newsize);
 LUAI_FUNC Udata *luaS_newudata (lua_State *L, size_t s, Table *e);
-LUAI_FUNC TString *luaS_newlstr (lua_State *L, const char *str, size_t l);
+TString *luaS_newlstr (lua_State *L, const char *str, size_t l);
 
 
 #endif

diff --git a/src/lua5.1.pc.in b/src/lua5.1.pc.in
new file mode 100644
index 0000000..9b5bec8
--- /dev/null
+++ b/src/lua5.1.pc.in
@@ -0,0 +1,17 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@/lua5.1
+datarootdir=@datarootdir@
+datadir=@datadir@
+
+Name: Lua
+Description: An Extensible Extension Language
+Version: @PACKAGE_VERSION@
+Libs: -L${libdir} -llua5.1
+Libs.private: @LIBM@ @LIBS@
+Cflags: -I${includedir}
+
+# information required by lua-utils.eclass::_lua_export
+INSTALL_LMOD=${datadir}/lua/5.1
+INSTALL_CMOD=${libdir}/lua/5.1

diff --git a/src/luac.c b/src/luac.c
index d070173..86474c2 100644
--- a/src/luac.c
+++ b/src/luac.c
@@ -169,7 +169,6 @@ static int pmain(lua_State* L)
   if (luaL_loadfile(L,filename)!=0) fatal(lua_tostring(L,-1));
  }
  f=combine(L,argc);
- if (listing) luaU_print(f,listing>1);
  if (dumping)
  {
   FILE* D= (output==NULL) ? stdout : fopen(output,"wb");

diff --git a/src/luaconf.h b/src/luaconf.h.in
similarity index 98%
rename from src/luaconf.h
rename to src/luaconf.h.in
index e2cb261..0947b47 100644
--- a/src/luaconf.h
+++ b/src/luaconf.h.in
@@ -36,7 +36,6 @@
 #if defined(LUA_USE_LINUX)
 #define LUA_USE_POSIX
 #define LUA_USE_DLOPEN		/* needs an extra library: -ldl */
-#define LUA_USE_READLINE	/* needs some extra libraries */
 #endif
 
 #if defined(LUA_USE_MACOSX)
@@ -94,9 +93,9 @@
 	".\\?.dll;"  LUA_CDIR"?.dll;" LUA_CDIR"loadall.dll"
 
 #else
-#define LUA_ROOT	"/usr/local/"
-#define LUA_LDIR	LUA_ROOT "share/lua/5.1/"
-#define LUA_CDIR	LUA_ROOT "lib/lua/5.1/"
+#define LUA_ROOT       "@prefix@/"
+#define LUA_LDIR       "@datadir@/lua/5.1/"
+#define LUA_CDIR       "@libdir@/lua/5.1/"
 #define LUA_PATH_DEFAULT  \
 		"./?.lua;"  LUA_LDIR"?.lua;"  LUA_LDIR"?/init.lua;" \
 		            LUA_CDIR"?.lua;"  LUA_CDIR"?/init.lua"
@@ -333,14 +332,12 @@
 ** CHANGE it to undefined as soon as your programs use only '...' to
 ** access vararg parameters (instead of the old 'arg' table).
 */
-#define LUA_COMPAT_VARARG
 
 /*
 @@ LUA_COMPAT_MOD controls compatibility with old math.mod function.
 ** CHANGE it to undefined as soon as your programs use 'math.fmod' or
 ** the new '%' operator instead of 'math.mod'.
 */
-#define LUA_COMPAT_MOD
 
 /*
 @@ LUA_COMPAT_LSTR controls compatibility with old long string nesting
@@ -348,14 +345,12 @@
 ** CHANGE it to 2 if you want the old behaviour, or undefine it to turn
 ** off the advisory error when nesting [[...]].
 */
-#define LUA_COMPAT_LSTR		1
 
 /*
 @@ LUA_COMPAT_GFIND controls compatibility with old 'string.gfind' name.
 ** CHANGE it to undefined as soon as you rename 'string.gfind' to
 ** 'string.gmatch'.
 */
-#define LUA_COMPAT_GFIND
 
 /*
 @@ LUA_COMPAT_OPENLIB controls compatibility with old 'luaL_openlib'
@@ -363,7 +358,6 @@
 ** CHANGE it to undefined as soon as you replace to 'luaL_register'
 ** your uses of 'luaL_openlib'
 */
-#define LUA_COMPAT_OPENLIB
 
 
 

diff --git a/src/lundump.h b/src/lundump.h
index c80189d..cb8376c 100644
--- a/src/lundump.h
+++ b/src/lundump.h
@@ -17,7 +17,7 @@ LUAI_FUNC Proto* luaU_undump (lua_State* L, ZIO* Z, Mbuffer* buff, const char* n
 LUAI_FUNC void luaU_header (char* h);
 
 /* dump one chunk; from ldump.c */
-LUAI_FUNC int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip);
+int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip);
 
 #ifdef luac_c
 /* print one chunk; from print.c */

diff --git a/test-wrapper.sh b/test-wrapper.sh
new file mode 100755
index 0000000..fe9309b
--- /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}"/test && "${LUA}" -e_U=true $(basename ${1})


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-09-06 10:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-06 10:06 [gentoo-commits] proj/lua-patches:5.1.5 commit in: src/, /, doc/ David Seifert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox