summaryrefslogtreecommitdiffhomepage
path: root/patches/lua-5.3.4_pre.local.patch
blob: 0f3858f2553e449000a75b38c50e65d6ebb32f7e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
From 8a848c7ada873efa2b0878cee7f6871478fb47e5 Mon Sep 17 00:00:00 2001
From: Neal Gompa <ngompa13@gmail.com>
Date: Sat, 28 Apr 2018 09:22:35 -0400
Subject: [PATCH] Autotoolize Lua 5.3.4

This is a super-patch of the Red Hat/Fedora patches for building Lua
using Autotools.

It is made up of the following patches:
* lua-5.3.0-autotoolize.patch
* lua-5.3.0-idsize.patch
* lua-5.2.2-configure-linux.patch
* lua-5.3.0-configure-compat-module.patch

The canonical source of these patches is: https://src.fedoraproject.org/rpms/lua

Note that on minor version bumps, the full version must be replaced
in configure.ac to match.

That is, all instances of "5.3.4" must be replaced with the new 5.3.x
version. This can be accomplished with sed on this patch.

Cf. https://src.fedoraproject.org/rpms/lua/blob/ed24e54f3b10a67e141af985ff63b49337667b5d/f/lua.spec#_103-104

Before bumping Lua, check to see if the Fedora patch set for autotoolizing
has changed and use those to rebase this super-patch.
---
 Makefile.am                              |  3 +
 configure.ac                             | 88 ++++++++++++++++++++++++
 doc/Makefile.am                          |  4 ++
 src/.gitignore                           | 15 ++++
 src/Makefile.am                          | 46 +++++++++++++
 src/lua.pc.in                            | 13 ++++
 src/{luaconf.h => luaconf.h.template.in} | 14 ++--
 7 files changed, 179 insertions(+), 4 deletions(-)
 create mode 100644 Makefile.am
 create mode 100644 configure.ac
 create mode 100644 doc/Makefile.am
 create mode 100644 src/.gitignore
 create mode 100644 src/Makefile.am
 create mode 100644 src/lua.pc.in
 rename src/{luaconf.h => luaconf.h.template.in} (98%)

diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..8d968c4
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,3 @@
+SUBDIRS = src doc
+
+EXTRA_DIST = README
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..61c4dcd
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,88 @@
+AC_PREREQ(2.59)
+AC_INIT([lua], [5.3.4], [https://bugzilla.redhat.com/], [lua-at], [http://www.lua.org])
+AC_SUBST([MAJOR_VERSION], [5.3])
+
+AC_CONFIG_HEADERS([config.h])
+AC_CONFIG_SRCDIR([src/lapi.c])
+
+AM_INIT_AUTOMAKE([1.9 foreign])
+
+AC_PROG_CC
+AC_PROG_LIBTOOL
+
+AC_ARG_WITH(
+  [compat-module],
+  [AC_HELP_STRING([--with-compat-module], [Enable LUA_COMPAT_MODULE functions [default=no]])],
+  [use_compat_module=$withval],
+  [use_compat_module=no]
+)
+
+COMPAT_DEFS="#undef LUA_COMPAT_ALL"
+if test "x$use_compat_module" == "xyes"; then
+  COMPAT_DEFS="#define LUA_COMPAT_5_1
+#define LUA_COMPAT_5_2"
+fi
+AC_SUBST(COMPAT_DEFS)
+
+AC_ARG_WITH(
+  [readline],
+  [AC_HELP_STRING([--with-readline], [Use readline for interpreter input [default=yes]])],
+  [use_readline=$withval],
+  [use_readline=yes]
+)
+
+LUA_LIBS="-lm -ldl"
+
+# Check for readline
+READLINE_DEFS="#undef LUA_USE_READLINE"
+if test "x$use_readline" == "xyes"; then
+  AC_CHECK_LIB([readline], [readline], [:], [use_readline=no], [-lncurses])
+  AC_CHECK_HEADERS([readline/readline.h readline/history.h], [], [use_readline=no])
+  if test "x$use_readline" == "xno"; then
+    AC_MSG_WARN([readline headers could not be found, disabling readline support])
+  else
+    READLINE_DEFS="#define LUA_USE_READLINE"
+    READLINE_LIBS="-lreadline -lncurses"
+  fi
+fi
+AC_SUBST(READLINE_DEFS)
+AC_SUBST(READLINE_LIBS)
+
+case "$host" in
+  *-mingw*)  use_os=win32  ;;
+  *-darwin*) use_os=macosx ;;
+  *-linux*)  use_os=linux  ;;
+  *)         use_os=posix  ;;
+esac
+
+POSIX_DEFS="#undef LUA_USE_POSIX"
+LUA_DL_DEFS="#undef LUA_USE_DLOPEN"
+LUA_BUILD_AS_DLL_DEFS="#undef LUA_BUILD_AS_DLL"
+
+if test "x$use_os" == "xwin32"; then
+  LUA_BUILD_AS_DLL_DEFS="#define LUA_BUILD_AS_DLL"
+elif test "x$use_os" == "xmacosx"; then
+  POSIX_DEFS="#define LUA_USE_POSIX"
+  LUA_DL_DEFS="#define LUA_DL_DYLD"
+elif test "x$use_os" == "xlinux"; then
+  POSIX_DEFS="#define LUA_USE_LINUX"
+  LUA_DL_DEFS="#define LUA_DL_DLOPEN"
+  LUA_LIBS="$LUA_LIBS -ldl"
+elif test "x$use_os" == "xposix"; then
+  POSIX_DEFS="#define LUA_USE_POSIX"
+  LUA_DL_DEFS="#define LUA_DL_DLOPEN"
+  LUA_LIBS="$LUA_LIBS -ldl"
+fi
+AC_SUBST(POSIX_DEFS)
+AC_SUBST(LUA_DL_DEFS)
+AC_SUBST(LUA_BUILD_AS_DLL_DEFS)
+
+AC_SUBST(LUA_LIBS)
+
+AC_CONFIG_FILES([Makefile
+                 src/Makefile
+                 src/lua.pc
+                 src/luaconf.h.template
+                 doc/Makefile
+])
+AC_OUTPUT
diff --git a/doc/Makefile.am b/doc/Makefile.am
new file mode 100644
index 0000000..3705696
--- /dev/null
+++ b/doc/Makefile.am
@@ -0,0 +1,4 @@
+man1_MANS = lua.1 luac.1
+
+EXTRA_DIST = \
+	contents.html logo.gif lua.1 luac.1 lua.css manual.css manual.html osi-certified-72x60.png readme.html
diff --git a/src/.gitignore b/src/.gitignore
new file mode 100644
index 0000000..44aac47
--- /dev/null
+++ b/src/.gitignore
@@ -0,0 +1,15 @@
+lua
+lua.pc
+luac
+luaconf.h
+luaconf.h.template
+lua
+lua.pc
+luac
+luaconf.h
+luaconf.h.template
+lua
+lua.pc
+luac
+luaconf.h
+luaconf.h.template
diff --git a/src/Makefile.am b/src/Makefile.am
new file mode 100644
index 0000000..33f5b2e
--- /dev/null
+++ b/src/Makefile.am
@@ -0,0 +1,46 @@
+AM_CFLAGS = -Wall
+
+include_HEADERS = lua.h lualib.h lauxlib.h lua.hpp
+
+nodist_include_HEADERS = luaconf.h
+
+lib_LTLIBRARIES = liblua.la
+liblua_la_LDFLAGS = -release @MAJOR_VERSION@
+liblua_la_SOURCES = \
+	lapi.c lauxlib.c lbaselib.c lbitlib.c lcode.c lcorolib.c lctype.c ldblib.c \
+	ldebug.c ldo.c ldump.c lfunc.c lgc.c linit.c liolib.c llex.c lmathlib.c lmem.c \
+	loadlib.c lobject.c lopcodes.c loslib.c lparser.c lstate.c lstring.c lstrlib.c \
+	ltable.c ltablib.c ltm.c lundump.c lutf8lib.c lvm.c lzio.c \
+	lapi.h lcode.h lctype.h ldebug.h ldo.h lfunc.h lgc.h llex.h llimits.h \
+	lmem.h lobject.h lopcodes.h lparser.h lstate.h lstring.h ltable.h ltm.h \
+	lundump.h lvm.h lzio.h
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = lua.pc
+
+bin_PROGRAMS = lua luac
+
+lua_SOURCES = lua.c
+lua_LDADD = liblua.la @LUA_LIBS@ @READLINE_LIBS@
+lua_DEPENDENCIES = liblua.la
+
+luac_SOURCES = luac.c
+# Statically link liblua against luac since luac uses symbols not exported in liblua
+luac_LDADD = .libs/liblua.a @LUA_LIBS@
+luac_DEPENDENCIES = liblua.la
+
+EXTRA_DIST = luaconf.h.template
+BUILT_SOURCES = luaconf.h
+CLEANFILES = luaconf.h luaconf.h.template
+
+readline_defs = @READLINE_DEFS@
+
+edit = 	sed \
+	  -e 's,%prefix%,$(prefix),g' \
+	  -e 's,%lua_datadir%,$(datadir),g' \
+	  -e 's,%lua_libdir%,$(libdir),g'
+
+luaconf.h : luaconf.h.template
+	rm -f $@ $@.tmp
+	$(edit) $< >$@.tmp
+	mv $@.tmp $@
diff --git a/src/lua.pc.in b/src/lua.pc.in
new file mode 100644
index 0000000..25faa8d
--- /dev/null
+++ b/src/lua.pc.in
@@ -0,0 +1,13 @@
+V= @MAJOR_VERSION@
+R= @VERSION@
+prefix= @prefix@
+exec_prefix=${prefix}
+libdir= @libdir@
+includedir=${prefix}/include
+
+Name: Lua
+Description: An Extensible Extension Language
+Version: ${R}
+Requires:
+Libs: -llua @LUA_LIBS@
+Cflags: -I${includedir}
diff --git a/src/luaconf.h b/src/luaconf.h.template.in
similarity index 98%
rename from src/luaconf.h
rename to src/luaconf.h.template.in
index f37bea0..c7ff227 100644
--- a/src/luaconf.h
+++ b/src/luaconf.h.template.in
@@ -11,6 +11,12 @@
 #include <limits.h>
 #include <stddef.h>
 
+@POSIX_DEFS@
+@LUA_DL_DEFS@
+@LUA_BUILD_AS_DLL_DEFS@
+@READLINE_DEFS@
+@COMPAT_DEFS@
+
 
 /*
 ** ===================================================================
@@ -200,9 +206,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 "/"
 #define LUA_PATH_DEFAULT  \
 		LUA_LDIR"?.lua;"  LUA_LDIR"?/init.lua;" \
 		LUA_CDIR"?.lua;"  LUA_CDIR"?/init.lua;" \
@@ -738,7 +744,7 @@
 @@ of a function in debug information.
 ** CHANGE it if you want a different size.
 */
-#define LUA_IDSIZE	60
+#define LUA_IDSIZE	512
 
 
 /*
-- 
2.17.0