Blame patches/lua-5.3.4_pre.local.patch

Lucio Andrés Illanes Albornoz (arab, vxp) d7f4fb
From 8a848c7ada873efa2b0878cee7f6871478fb47e5 Mon Sep 17 00:00:00 2001
7f55af
From: Neal Gompa <ngompa13@gmail.com>
7f55af
Date: Sat, 28 Apr 2018 09:22:35 -0400
7f55af
Subject: [PATCH] Autotoolize Lua 5.3.4
7f55af
7f55af
This is a super-patch of the Red Hat/Fedora patches for building Lua
7f55af
using Autotools.
7f55af
7f55af
It is made up of the following patches:
7f55af
* lua-5.3.0-autotoolize.patch
7f55af
* lua-5.3.0-idsize.patch
7f55af
* lua-5.2.2-configure-linux.patch
7f55af
* lua-5.3.0-configure-compat-module.patch
7f55af
7f55af
The canonical source of these patches is: https://src.fedoraproject.org/rpms/lua
7f55af
7f55af
Note that on minor version bumps, the full version must be replaced
7f55af
in configure.ac to match.
7f55af
7f55af
That is, all instances of "5.3.4" must be replaced with the new 5.3.x
7f55af
version. This can be accomplished with sed on this patch.
7f55af
7f55af
Cf. https://src.fedoraproject.org/rpms/lua/blob/ed24e54f3b10a67e141af985ff63b49337667b5d/f/lua.spec#_103-104
7f55af
7f55af
Before bumping Lua, check to see if the Fedora patch set for autotoolizing
7f55af
has changed and use those to rebase this super-patch.
7f55af
---
Lucio Andrés Illanes Albornoz (arab, vxp) d7f4fb
 Makefile.am                              |  3 +
Lucio Andrés Illanes Albornoz (arab, vxp) d7f4fb
 configure.ac                             | 88 ++++++++++++++++++++++++
Lucio Andrés Illanes Albornoz (arab, vxp) d7f4fb
 doc/Makefile.am                          |  4 ++
Lucio Andrés Illanes Albornoz (arab, vxp) d7f4fb
 src/.gitignore                           | 15 ++++
Lucio Andrés Illanes Albornoz (arab, vxp) d7f4fb
 src/Makefile.am                          | 46 +++++++++++++
Lucio Andrés Illanes Albornoz (arab, vxp) d7f4fb
 src/lua.pc.in                            | 13 ++++
Lucio Andrés Illanes Albornoz (arab, vxp) d7f4fb
 src/{luaconf.h => luaconf.h.template.in} | 14 ++--
Lucio Andrés Illanes Albornoz (arab, vxp) d7f4fb
 7 files changed, 179 insertions(+), 4 deletions(-)
7f55af
 create mode 100644 Makefile.am
7f55af
 create mode 100644 configure.ac
7f55af
 create mode 100644 doc/Makefile.am
7f55af
 create mode 100644 src/.gitignore
7f55af
 create mode 100644 src/Makefile.am
7f55af
 create mode 100644 src/lua.pc.in
7f55af
 rename src/{luaconf.h => luaconf.h.template.in} (98%)
7f55af
7f55af
diff --git a/Makefile.am b/Makefile.am
7f55af
new file mode 100644
Lucio Andrés Illanes Albornoz (arab, vxp) d7f4fb
index 0000000..8d968c4
7f55af
--- /dev/null
7f55af
+++ b/Makefile.am
Lucio Andrés Illanes Albornoz (arab, vxp) d7f4fb
@@ -0,0 +1,3 @@
7f55af
+SUBDIRS = src doc
7f55af
+
7f55af
+EXTRA_DIST = README
7f55af
diff --git a/configure.ac b/configure.ac
7f55af
new file mode 100644
Lucio Andrés Illanes Albornoz (arab, vxp) d7f4fb
index 0000000..61c4dcd
7f55af
--- /dev/null
7f55af
+++ b/configure.ac
Lucio Andrés Illanes Albornoz (arab, vxp) d7f4fb
@@ -0,0 +1,88 @@
7f55af
+AC_PREREQ(2.59)
7f55af
+AC_INIT([lua], [5.3.4], [https://bugzilla.redhat.com/], [lua-at], [http://www.lua.org])
7f55af
+AC_SUBST([MAJOR_VERSION], [5.3])
7f55af
+
7f55af
+AC_CONFIG_HEADERS([config.h])
7f55af
+AC_CONFIG_SRCDIR([src/lapi.c])
7f55af
+
7f55af
+AM_INIT_AUTOMAKE([1.9 foreign])
7f55af
+
7f55af
+AC_PROG_CC
7f55af
+AC_PROG_LIBTOOL
7f55af
+
7f55af
+AC_ARG_WITH(
7f55af
+  [compat-module],
7f55af
+  [AC_HELP_STRING([--with-compat-module], [Enable LUA_COMPAT_MODULE functions [default=no]])],
7f55af
+  [use_compat_module=$withval],
7f55af
+  [use_compat_module=no]
7f55af
+)
7f55af
+
7f55af
+COMPAT_DEFS="#undef LUA_COMPAT_ALL"
7f55af
+if test "x$use_compat_module" == "xyes"; then
7f55af
+  COMPAT_DEFS="#define LUA_COMPAT_5_1
7f55af
+#define LUA_COMPAT_5_2"
7f55af
+fi
7f55af
+AC_SUBST(COMPAT_DEFS)
7f55af
+
7f55af
+AC_ARG_WITH(
7f55af
+  [readline],
7f55af
+  [AC_HELP_STRING([--with-readline], [Use readline for interpreter input [default=yes]])],
7f55af
+  [use_readline=$withval],
7f55af
+  [use_readline=yes]
7f55af
+)
7f55af
+
Lucio Andrés Illanes Albornoz (arab, vxp) 6658d7
+LUA_LIBS="-lm -ldl"
7f55af
+
7f55af
+# Check for readline
7f55af
+READLINE_DEFS="#undef LUA_USE_READLINE"
7f55af
+if test "x$use_readline" == "xyes"; then
7f55af
+  AC_CHECK_LIB([readline], [readline], [:], [use_readline=no], [-lncurses])
7f55af
+  AC_CHECK_HEADERS([readline/readline.h readline/history.h], [], [use_readline=no])
7f55af
+  if test "x$use_readline" == "xno"; then
7f55af
+    AC_MSG_WARN([readline headers could not be found, disabling readline support])
7f55af
+  else
7f55af
+    READLINE_DEFS="#define LUA_USE_READLINE"
7f55af
+    READLINE_LIBS="-lreadline -lncurses"
7f55af
+  fi
7f55af
+fi
7f55af
+AC_SUBST(READLINE_DEFS)
7f55af
+AC_SUBST(READLINE_LIBS)
7f55af
+
7f55af
+case "$host" in
7f55af
+  *-mingw*)  use_os=win32  ;;
7f55af
+  *-darwin*) use_os=macosx ;;
7f55af
+  *-linux*)  use_os=linux  ;;
7f55af
+  *)         use_os=posix  ;;
7f55af
+esac
7f55af
+
7f55af
+POSIX_DEFS="#undef LUA_USE_POSIX"
7f55af
+LUA_DL_DEFS="#undef LUA_USE_DLOPEN"
7f55af
+LUA_BUILD_AS_DLL_DEFS="#undef LUA_BUILD_AS_DLL"
7f55af
+
7f55af
+if test "x$use_os" == "xwin32"; then
7f55af
+  LUA_BUILD_AS_DLL_DEFS="#define LUA_BUILD_AS_DLL"
7f55af
+elif test "x$use_os" == "xmacosx"; then
7f55af
+  POSIX_DEFS="#define LUA_USE_POSIX"
7f55af
+  LUA_DL_DEFS="#define LUA_DL_DYLD"
7f55af
+elif test "x$use_os" == "xlinux"; then
7f55af
+  POSIX_DEFS="#define LUA_USE_LINUX"
7f55af
+  LUA_DL_DEFS="#define LUA_DL_DLOPEN"
7f55af
+  LUA_LIBS="$LUA_LIBS -ldl"
7f55af
+elif test "x$use_os" == "xposix"; then
7f55af
+  POSIX_DEFS="#define LUA_USE_POSIX"
7f55af
+  LUA_DL_DEFS="#define LUA_DL_DLOPEN"
7f55af
+  LUA_LIBS="$LUA_LIBS -ldl"
7f55af
+fi
7f55af
+AC_SUBST(POSIX_DEFS)
7f55af
+AC_SUBST(LUA_DL_DEFS)
7f55af
+AC_SUBST(LUA_BUILD_AS_DLL_DEFS)
7f55af
+
7f55af
+AC_SUBST(LUA_LIBS)
7f55af
+
7f55af
+AC_CONFIG_FILES([Makefile
7f55af
+                 src/Makefile
7f55af
+                 src/lua.pc
7f55af
+                 src/luaconf.h.template
7f55af
+                 doc/Makefile
7f55af
+])
7f55af
+AC_OUTPUT
7f55af
diff --git a/doc/Makefile.am b/doc/Makefile.am
7f55af
new file mode 100644
Lucio Andrés Illanes Albornoz (arab, vxp) d7f4fb
index 0000000..3705696
7f55af
--- /dev/null
7f55af
+++ b/doc/Makefile.am
Lucio Andrés Illanes Albornoz (arab, vxp) d7f4fb
@@ -0,0 +1,4 @@
7f55af
+man1_MANS = lua.1 luac.1
7f55af
+
7f55af
+EXTRA_DIST = \
7f55af
+	contents.html logo.gif lua.1 luac.1 lua.css manual.css manual.html osi-certified-72x60.png readme.html
7f55af
diff --git a/src/.gitignore b/src/.gitignore
7f55af
new file mode 100644
7f55af
index 0000000..44aac47
7f55af
--- /dev/null
7f55af
+++ b/src/.gitignore
7f55af
@@ -0,0 +1,15 @@
7f55af
+lua
7f55af
+lua.pc
7f55af
+luac
7f55af
+luaconf.h
7f55af
+luaconf.h.template
7f55af
+lua
7f55af
+lua.pc
7f55af
+luac
7f55af
+luaconf.h
7f55af
+luaconf.h.template
7f55af
+lua
7f55af
+lua.pc
7f55af
+luac
7f55af
+luaconf.h
7f55af
+luaconf.h.template
7f55af
diff --git a/src/Makefile.am b/src/Makefile.am
7f55af
new file mode 100644
7f55af
index 0000000..33f5b2e
7f55af
--- /dev/null
7f55af
+++ b/src/Makefile.am
7f55af
@@ -0,0 +1,46 @@
7f55af
+AM_CFLAGS = -Wall
7f55af
+
7f55af
+include_HEADERS = lua.h lualib.h lauxlib.h lua.hpp
7f55af
+
7f55af
+nodist_include_HEADERS = luaconf.h
7f55af
+
7f55af
+lib_LTLIBRARIES = liblua.la
7f55af
+liblua_la_LDFLAGS = -release @MAJOR_VERSION@
7f55af
+liblua_la_SOURCES = \
7f55af
+	lapi.c lauxlib.c lbaselib.c lbitlib.c lcode.c lcorolib.c lctype.c ldblib.c \
7f55af
+	ldebug.c ldo.c ldump.c lfunc.c lgc.c linit.c liolib.c llex.c lmathlib.c lmem.c \
7f55af
+	loadlib.c lobject.c lopcodes.c loslib.c lparser.c lstate.c lstring.c lstrlib.c \
7f55af
+	ltable.c ltablib.c ltm.c lundump.c lutf8lib.c lvm.c lzio.c \
7f55af
+	lapi.h lcode.h lctype.h ldebug.h ldo.h lfunc.h lgc.h llex.h llimits.h \
7f55af
+	lmem.h lobject.h lopcodes.h lparser.h lstate.h lstring.h ltable.h ltm.h \
7f55af
+	lundump.h lvm.h lzio.h
7f55af
+
7f55af
+pkgconfigdir = $(libdir)/pkgconfig
7f55af
+pkgconfig_DATA = lua.pc
7f55af
+
7f55af
+bin_PROGRAMS = lua luac
7f55af
+
7f55af
+lua_SOURCES = lua.c
7f55af
+lua_LDADD = liblua.la @LUA_LIBS@ @READLINE_LIBS@
7f55af
+lua_DEPENDENCIES = liblua.la
7f55af
+
7f55af
+luac_SOURCES = luac.c
7f55af
+# Statically link liblua against luac since luac uses symbols not exported in liblua
7f55af
+luac_LDADD = .libs/liblua.a @LUA_LIBS@
7f55af
+luac_DEPENDENCIES = liblua.la
7f55af
+
7f55af
+EXTRA_DIST = luaconf.h.template
7f55af
+BUILT_SOURCES = luaconf.h
7f55af
+CLEANFILES = luaconf.h luaconf.h.template
7f55af
+
7f55af
+readline_defs = @READLINE_DEFS@
7f55af
+
7f55af
+edit = 	sed \
7f55af
+	  -e 's,%prefix%,$(prefix),g' \
7f55af
+	  -e 's,%lua_datadir%,$(datadir),g' \
7f55af
+	  -e 's,%lua_libdir%,$(libdir),g'
7f55af
+
7f55af
+luaconf.h : luaconf.h.template
7f55af
+	rm -f $@ $@.tmp
7f55af
+	$(edit) $< >$@.tmp
7f55af
+	mv $@.tmp $@
7f55af
diff --git a/src/lua.pc.in b/src/lua.pc.in
7f55af
new file mode 100644
7f55af
index 0000000..25faa8d
7f55af
--- /dev/null
7f55af
+++ b/src/lua.pc.in
7f55af
@@ -0,0 +1,13 @@
7f55af
+V= @MAJOR_VERSION@
7f55af
+R= @VERSION@
7f55af
+prefix= @prefix@
7f55af
+exec_prefix=${prefix}
7f55af
+libdir= @libdir@
7f55af
+includedir=${prefix}/include
7f55af
+
7f55af
+Name: Lua
7f55af
+Description: An Extensible Extension Language
7f55af
+Version: ${R}
7f55af
+Requires:
7f55af
+Libs: -llua @LUA_LIBS@
7f55af
+Cflags: -I${includedir}
7f55af
diff --git a/src/luaconf.h b/src/luaconf.h.template.in
7f55af
similarity index 98%
7f55af
rename from src/luaconf.h
7f55af
rename to src/luaconf.h.template.in
7f55af
index f37bea0..c7ff227 100644
7f55af
--- a/src/luaconf.h
7f55af
+++ b/src/luaconf.h.template.in
7f55af
@@ -11,6 +11,12 @@
7f55af
 #include <limits.h>
7f55af
 #include <stddef.h>
7f55af
 
7f55af
+@POSIX_DEFS@
7f55af
+@LUA_DL_DEFS@
7f55af
+@LUA_BUILD_AS_DLL_DEFS@
7f55af
+@READLINE_DEFS@
7f55af
+@COMPAT_DEFS@
7f55af
+
7f55af
 
7f55af
 /*
7f55af
 ** ===================================================================
7f55af
@@ -200,9 +206,9 @@
7f55af
 
7f55af
 #else			/* }{ */
7f55af
 
7f55af
-#define LUA_ROOT	"/usr/local/"
7f55af
-#define LUA_LDIR	LUA_ROOT "share/lua/" LUA_VDIR "/"
7f55af
-#define LUA_CDIR	LUA_ROOT "lib/lua/" LUA_VDIR "/"
7f55af
+#define LUA_ROOT	"@prefix@/"
7f55af
+#define LUA_LDIR	"@datadir@/lua/" LUA_VDIR "/"
7f55af
+#define LUA_CDIR	"@libdir@/lua/" LUA_VDIR "/"
7f55af
 #define LUA_PATH_DEFAULT  \
7f55af
 		LUA_LDIR"?.lua;"  LUA_LDIR"?/init.lua;" \
7f55af
 		LUA_CDIR"?.lua;"  LUA_CDIR"?/init.lua;" \
7f55af
@@ -738,7 +744,7 @@
7f55af
 @@ of a function in debug information.
7f55af
 ** CHANGE it if you want a different size.
7f55af
 */
7f55af
-#define LUA_IDSIZE	60
7f55af
+#define LUA_IDSIZE	512
7f55af
 
7f55af
 
7f55af
 /*
7f55af
-- 
7f55af
2.17.0
7f55af