This commit is contained in:
Tom Callaway 2013-05-14 16:40:40 -04:00
parent 8e864b6dbb
commit 44f7aeefd6
8 changed files with 412 additions and 29 deletions

1
.gitignore vendored
View File

@ -4,3 +4,4 @@ lua-5.1.4/
*.src.rpm
/x86_64/
/i386/
/lua-5.2.2.tar.gz

204
lua-5.2.2-autotoolize.patch Normal file
View File

@ -0,0 +1,204 @@
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..3af6625
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,69 @@
+AC_PREREQ(2.59)
+AC_INIT([lua], [5.2.2], [https://bugzilla.redhat.com/], [lua-at], [http://www.lua.org])
+AC_SUBST([MAJOR_VERSION], [5.2])
+
+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(
+ [readline],
+ [AC_HELP_STRING([--with-readline], [Use readline for interpreter input [default=yes]])],
+ [use_readline=$withval],
+ [use_readline=yes]
+)
+
+LUA_LIBS="-lm"
+
+# 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 ;;
+ *) 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" == "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..0abd9dd
--- /dev/null
+++ b/src/.gitignore
@@ -0,0 +1,5 @@
+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..6c7c79f
--- /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 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
--- a/src/luaconf.h.template.in
+++ b/src/luaconf.h.template.in
@@ -11,6 +11,11 @@
#include <limits.h>
#include <stddef.h>
+@POSIX_DEFS@
+@LUA_DL_DEFS@
+@LUA_BUILD_AS_DLL_DEFS@
+@READLINE_DEFS@
+
/*
** ==================================================================
@@ -100,9 +105,9 @@
#else /* }{ */
#define LUA_VDIR LUA_VERSION_MAJOR "." LUA_VERSION_MINOR "/"
-#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 "@pkgdatadir@/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;" "./?.lua"

View File

@ -0,0 +1,34 @@
diff -up lua-5.2.2/configure.ac.compat-module lua-5.2.2/configure.ac
--- lua-5.2.2/configure.ac.compat-module 2013-05-10 10:16:05.344137597 -0400
+++ lua-5.2.2/configure.ac 2013-05-10 10:16:05.357137596 -0400
@@ -11,6 +11,19 @@ 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_MODULE"
+if test "x$use_compat_module" == "xyes"; then
+ COMPAT_DEFS="#define LUA_COMPAT_MODULE"
+fi
+AC_SUBST(COMPAT_DEFS)
+
+AC_ARG_WITH(
[readline],
[AC_HELP_STRING([--with-readline], [Use readline for interpreter input [default=yes]])],
[use_readline=$withval],
diff -up lua-5.2.2/src/luaconf.h.template.in.compat-module lua-5.2.2/src/luaconf.h.template.in
--- lua-5.2.2/src/luaconf.h.template.in.compat-module 2013-05-10 10:25:42.586116963 -0400
+++ lua-5.2.2/src/luaconf.h.template.in 2013-05-10 10:26:29.957115269 -0400
@@ -15,6 +15,7 @@
@LUA_DL_DEFS@
@LUA_BUILD_AS_DLL_DEFS@
@READLINE_DEFS@
+@COMPAT_DEFS@
/*

View File

@ -0,0 +1,22 @@
diff -up lua-5.2.2/configure.ac.linux lua-5.2.2/configure.ac
--- lua-5.2.2/configure.ac.linux 2013-05-10 15:42:27.269437631 -0400
+++ lua-5.2.2/configure.ac 2013-05-10 15:43:23.530435620 -0400
@@ -50,6 +50,7 @@ AC_SUBST(READLINE_LIBS)
case "$host" in
*-mingw*) use_os=win32 ;;
*-darwin*) use_os=macosx ;;
+ *-linux*) use_os=linux ;;
*) use_os=posix ;;
esac
@@ -62,6 +63,10 @@ if test "x$use_os" == "xwin32"; then
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"

13
lua-5.2.2-idsize.patch Normal file
View File

@ -0,0 +1,13 @@
diff --git a/src/luaconf.h.template.in b/src/luaconf.h.template.in
index a427c53..6f1d567 100644
--- a/src/luaconf.h.template.in
+++ b/src/luaconf.h.template.in
@@ -206,7 +206,7 @@
@* of a function in debug information.
** CHANGE it if you want a different size.
*/
-#define LUA_IDSIZE 60
+#define LUA_IDSIZE 512
/*

View File

@ -0,0 +1,54 @@
diff -up lua-5.2.2/src/lopcodes.c.luac-shared lua-5.2.2/src/lopcodes.c
--- lua-5.2.2/src/lopcodes.c.luac-shared 2012-05-14 09:34:18.000000000 -0400
+++ lua-5.2.2/src/lopcodes.c 2013-05-09 14:36:30.874581104 -0400
@@ -14,7 +14,7 @@
/* ORDER OP */
-LUAI_DDEF const char *const luaP_opnames[NUM_OPCODES+1] = {
+LUA_API const char *const luaP_opnames[NUM_OPCODES+1] = {
"MOVE",
"LOADK",
"LOADKX",
@@ -61,7 +61,7 @@ LUAI_DDEF const char *const luaP_opnames
#define opmode(t,a,b,c,m) (((t)<<7) | ((a)<<6) | ((b)<<4) | ((c)<<2) | (m))
-LUAI_DDEF const lu_byte luaP_opmodes[NUM_OPCODES] = {
+LUA_API const lu_byte luaP_opmodes[NUM_OPCODES] = {
/* T A B C mode opcode */
opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_MOVE */
,opmode(0, 1, OpArgK, OpArgN, iABx) /* OP_LOADK */
diff -up lua-5.2.2/src/lopcodes.h.luac-shared lua-5.2.2/src/lopcodes.h
--- lua-5.2.2/src/lopcodes.h.luac-shared 2013-05-09 14:37:14.718581762 -0400
+++ lua-5.2.2/src/lopcodes.h 2013-05-09 14:37:40.998582156 -0400
@@ -269,7 +269,7 @@ enum OpArgMask {
OpArgK /* argument is a constant or register/constant */
};
-LUAI_DDEC const lu_byte luaP_opmodes[NUM_OPCODES];
+LUA_API const lu_byte luaP_opmodes[NUM_OPCODES];
#define getOpMode(m) (cast(enum OpMode, luaP_opmodes[m] & 3))
#define getBMode(m) (cast(enum OpArgMask, (luaP_opmodes[m] >> 4) & 3))
@@ -278,7 +278,7 @@ LUAI_DDEC const lu_byte luaP_opmodes[NUM
#define testTMode(m) (luaP_opmodes[m] & (1 << 7))
-LUAI_DDEC const char *const luaP_opnames[NUM_OPCODES+1]; /* opcode names */
+LUA_API const char *const luaP_opnames[NUM_OPCODES+1]; /* opcode names */
/* number of list items to accumulate before a SETLIST instruction */
diff -up lua-5.2.2/src/lundump.h.luac-shared lua-5.2.2/src/lundump.h
--- lua-5.2.2/src/lundump.h.luac-shared 2012-05-08 09:53:33.000000000 -0400
+++ lua-5.2.2/src/lundump.h 2013-05-09 14:36:30.874581104 -0400
@@ -17,7 +17,7 @@ LUAI_FUNC Closure* luaU_undump (lua_Stat
LUAI_FUNC void luaU_header (lu_byte* 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);
+LUA_API int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip);
/* data to catch conversion errors */
#define LUAC_TAIL "\x19\x93\r\n\x1a\n"

112
lua.spec
View File

@ -1,19 +1,29 @@
%global legacy_major_version 5.1
%global legacy_version %{legacy_major_version}.4
%global major_version 5.2
Name: lua
Version: 5.1.4
Release: 12%{?dist}
Version: %{major_version}.2
Release: 1%{?dist}
Summary: Powerful light-weight programming language
Group: Development/Languages
License: MIT
URL: http://www.lua.org/
Source0: http://www.lua.org/ftp/lua-%{version}.tar.gz
Patch0: lua-5.1.4-autotoolize.patch
Patch1: lua-5.1.4-lunatic.patch
Patch2: lua-5.1.4-idsize.patch
Patch3: lua-5.1.4-2.patch
Source1: http://www.lua.org/ftp/lua-%{legacy_version}.tar.gz
Patch0: %{name}-%{version}-autotoolize.patch
Patch1: %{name}-%{version}-idsize.patch
Patch2: %{name}-%{version}-luac-shared-link-fix.patch
Patch3: %{name}-%{version}-configure-compat-module.patch
Patch4: %{name}-%{version}-configure-linux.patch
# Legacy patches for compat-lua-libs
Patch10: lua-5.1.4-autotoolize.patch
Patch11: lua-5.1.4-lunatic.patch
Patch12: lua-5.1.4-idsize.patch
Patch13: lua-5.1.4-2.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: readline-devel ncurses-devel
Provides: lua = 5.1
Provides: lua(abi) = 5.1
BuildRequires: automake autoconf libtool readline-devel ncurses-devel
Provides: lua(abi) = %{major_version}
%description
Lua is a powerful light-weight programming language designed for
@ -25,11 +35,10 @@ is dynamically typed, interpreted from bytecodes, and has automatic
memory management with garbage collection, making it ideal for
configuration, scripting, and rapid prototyping.
%package devel
Summary: Development files for %{name}
Group: System Environment/Libraries
Requires: %{name} = %{version}-%{release}
Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: pkgconfig
%description devel
@ -38,56 +47,89 @@ This package contains development files for %{name}.
%package static
Summary: Static library for %{name}
Group: System Environment/Libraries
Requires: %{name} = %{version}-%{release}
Requires: %{name}%{?_isa} = %{version}-%{release}
%description static
This package contains the static version of liblua for %{name}.
%package -n compat-lua-libs
Version: %{legacy_version}
Summary: Powerful light-weight programming language (compat version)
Provides: lua(abi) = %{legacy_version}
Provides: lua = %{legacy_version}
%description -n compat-lua-libs
This package contains a compatibility version of lua (%{legacy_version}).
%prep
%setup -q
%setup -q -a 1
mv src/luaconf.h src/luaconf.h.template.in
%patch0 -p1 -E -z .autoxxx
%patch1 -p0 -z .lunatic
%patch2 -p1 -z .idsize
%patch3 -p0 -d src -z .bugfix2
%patch1 -p1 -z .idsize
%patch2 -p1 -z .luac-shared
%patch3 -p1 -z .compat-module
%patch4 -p1 -z .configure-linux
autoreconf -i
# legacy
pushd lua-%{legacy_version}
%patch10 -p1 -E -z .legacy-autoxxx
%patch11 -p0 -z .legacy-lunatic
%patch12 -p1 -z .legacy-idsize
%patch13 -p0 -d src -z .legacy-bugfix2
# fix perms on auto files
chmod u+x autogen.sh config.guess config.sub configure depcomp install-sh missing
popd
%build
%configure --with-readline --with-compat-module
sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool
# Autotools give me a headache sometimes.
sed -i 's|@pkgdatadir@|%{_datadir}|g' src/luaconf.h.template
# hack so that only /usr/bin/lua gets linked with readline as it is the
# only one which needs this and otherwise we get License troubles
make %{?_smp_mflags} LIBS="-lm -ldl" luac_LDADD="liblua.la -lm -ldl"
# legacy
pushd lua-%{legacy_version}
%configure --with-readline
sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool
# hack so that only /usr/bin/lua gets linked with readline as it is the
# only one which needs this and otherwise we get License troubles
make %{?_smp_mflags} LIBS="-lm -ldl" luac_LDADD="liblua.la -lm -ldl"
# also remove readline from lua.pc
sed -i 's/-lreadline -lncurses //g' etc/lua.pc
popd
%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT
rm $RPM_BUILD_ROOT%{_libdir}/*.la
mkdir -p $RPM_BUILD_ROOT%{_libdir}/lua/5.1
mkdir -p $RPM_BUILD_ROOT%{_datadir}/lua/5.1
mkdir -p $RPM_BUILD_ROOT%{_libdir}/lua/%{major_version}
mkdir -p $RPM_BUILD_ROOT%{_datadir}/lua/%{major_version}
# legacy
pushd lua-%{legacy_version}
cp -a ./src/.libs/liblua-%{legacy_major_version}.so $RPM_BUILD_ROOT%{_libdir}/
mkdir -p $RPM_BUILD_ROOT%{_libdir}/lua/%{legacy_major_version}
mkdir -p $RPM_BUILD_ROOT%{_datadir}/lua/%{legacy_major_version}
popd
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root,-)
%doc COPYRIGHT HISTORY README doc/*.html doc/*.css doc/*.gif doc/*.png
%{_bindir}/lua*
%{_libdir}/liblua-*.so
%doc README doc/*.html doc/*.css doc/*.gif doc/*.png
%{_bindir}/lua
%{_bindir}/luac
%{_libdir}/liblua-5.2.so
%{_mandir}/man1/lua*.1*
%dir %{_libdir}/lua
%dir %{_libdir}/lua/5.1
%dir %{_libdir}/lua/%{major_version}
%dir %{_datadir}/lua
%dir %{_datadir}/lua/5.1
%dir %{_datadir}/lua/%{major_version}
%files devel
%defattr(-,root,root,-)
@ -100,7 +142,19 @@ rm -rf $RPM_BUILD_ROOT
%defattr(-,root,root,-)
%{_libdir}/*.a
%files -n compat-lua-libs
%doc lua-%{legacy_version}/README
%{_libdir}/liblua-5.1.so
%dir %{_libdir}/lua
%dir %{_libdir}/lua/%{legacy_major_version}
%dir %{_datadir}/lua
%dir %{_datadir}/lua/%{legacy_major_version}
%changelog
* Thu Apr 11 2013 Tom Callaway <spot@fedoraproject.org> - 5.2.2-1
- update to 5.2.2
- incorporate Aaron Faanes's changes
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 5.1.4-12
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild

View File

@ -1 +1,2 @@
d0870f2de55d59c1c8419f36e8fac150 lua-5.1.4.tar.gz
efbb645e897eae37cad4344ce8b0a614 lua-5.2.2.tar.gz