Sync from SUSE:SLFO:Main lua51 revision 60d63752127d30cd87b135e0309bdc86

This commit is contained in:
Adrian Schröter 2024-05-03 16:25:58 +02:00
commit 551e50263d
6 changed files with 769 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
baselibs.conf Normal file
View File

@ -0,0 +1 @@
liblua5_1-5

BIN
lua-5.1.5.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

174
lua-build-system.patch Normal file
View File

@ -0,0 +1,174 @@
From: Enrico Tassi <gareuselesinge@debian.org>
Date: Sun, 1 Mar 2015 16:13:52 +0100
Subject: build system
---
Makefile | 25 ++++++++++++++-----------
src/Makefile | 31 +++++++++++++++++++------------
2 files changed, 33 insertions(+), 23 deletions(-)
Index: lua-5.1.5/Makefile
===================================================================
--- lua-5.1.5.orig/Makefile
+++ lua-5.1.5/Makefile
@@ -2,6 +2,8 @@
# see INSTALL for installation instructions
# see src/Makefile and src/luaconf.h for further customization
+export LIBTOOL=libtool --quiet
+
# == CHANGE THE SETTINGS BELOW TO SUIT YOUR ENVIRONMENT =======================
# Your platform. See PLATS for possible values.
@@ -9,22 +11,23 @@ PLAT= none
# Where to install. The installation starts in the src and doc directories,
# so take care if INSTALL_TOP is not an absolute path.
-INSTALL_TOP= /usr/local
+INSTALL_TOP= /usr/
INSTALL_BIN= $(INSTALL_TOP)/bin
-INSTALL_INC= $(INSTALL_TOP)/include
+INSTALL_INC= $(INSTALL_TOP)/include/lua$(V)/
INSTALL_LIB= $(INSTALL_TOP)/lib
-INSTALL_MAN= $(INSTALL_TOP)/man/man1
+INSTALL_MAN= $(INSTALL_TOP)/share/man/man1
#
# You probably want to make INSTALL_LMOD and INSTALL_CMOD consistent with
# LUA_ROOT, LUA_LDIR, and LUA_CDIR in luaconf.h (and also with etc/lua.pc).
INSTALL_LMOD= $(INSTALL_TOP)/share/lua/$V
-INSTALL_CMOD= $(INSTALL_TOP)/lib/lua/$V
+INSTALL_CMOD= $(INSTALL_LIB)/lua/$V
# How to install. If your install program does not support "-p", then you
# may have to run ranlib on the installed liblua.a (do "make ranlib").
INSTALL= install -p
INSTALL_EXEC= $(INSTALL) -m 0755
INSTALL_DATA= $(INSTALL) -m 0644
+INSTALL_LIBTOOL= $(LIBTOOL) --mode=install install -m 0644
#
# If you don't have install you can use cp instead.
# INSTALL= cp -p
@@ -41,10 +44,10 @@ RANLIB= ranlib
PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris
# What to install.
-TO_BIN= lua luac
+TO_BIN= lua$(V) luac$(V)
TO_INC= lua.h luaconf.h lualib.h lauxlib.h ../etc/lua.hpp
-TO_LIB= liblua.a
-TO_MAN= lua.1 luac.1
+TO_LIB= liblua$(V).la
+TO_MAN= lua$(V).1 luac$(V).1
# Lua version and release.
V= 5.1
@@ -53,16 +56,16 @@ R= 5.1.5
all: $(PLAT)
$(PLATS) clean:
- cd src && $(MAKE) $@
+ cd src && $(MAKE) $@ V=$(V)
test: dummy
- src/lua test/hello.lua
+ $(LIBTOOL) --mode=execute -dlopen src/liblua$(V).la src/lua$(V) -v
install: dummy
cd src && $(MKDIR) $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB) $(INSTALL_MAN) $(INSTALL_LMOD) $(INSTALL_CMOD)
cd src && $(INSTALL_EXEC) $(TO_BIN) $(INSTALL_BIN)
cd src && $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC)
- cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB)
+ cd src && $(INSTALL_LIBTOOL) $(TO_LIB) $(INSTALL_LIB)
cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN)
ranlib:
Index: lua-5.1.5/src/Makefile
===================================================================
--- lua-5.1.5.orig/src/Makefile
+++ lua-5.1.5/src/Makefile
@@ -8,7 +8,7 @@
PLAT= none
CC= gcc
-CFLAGS= -O2 -Wall $(MYCFLAGS)
+CFLAGS= -Wall $(MYCFLAGS)
AR= ar rcu
RANLIB= ranlib
RM= rm -f
@@ -16,24 +16,28 @@ LIBS= -lm $(MYLIBS)
MYCFLAGS=
MYLDFLAGS=
-MYLIBS=
+MYLIBS=-ldl
+
+%.o : %.c
+ $(LIBTOOL) --mode=compile --tag=CC $(CC) $(CFLAGS) -c $< -o $@
# == END OF USER SETTINGS. NO NEED TO CHANGE ANYTHING BELOW THIS LINE =========
PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris
-LUA_A= liblua.a
+LUA_A= liblua$(V).a
CORE_O= lapi.o lcode.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o \
lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o ltm.o \
- lundump.o lvm.o lzio.o
+ lundump.o lvm.o lzio.o print.o
LIB_O= lauxlib.o lbaselib.o ldblib.o liolib.o lmathlib.o loslib.o ltablib.o \
lstrlib.o loadlib.o linit.o
+BASE_O= $(CORE_O) $(LIB_O)
-LUA_T= lua
+LUA_T= lua$(V)
LUA_O= lua.o
-LUAC_T= luac
-LUAC_O= luac.o print.o
+LUAC_T= luac$(V)
+LUAC_O= luac.o
ALL_O= $(CORE_O) $(LIB_O) $(LUA_O) $(LUAC_O)
ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T)
@@ -48,14 +52,13 @@ o: $(ALL_O)
a: $(ALL_A)
$(LUA_A): $(CORE_O) $(LIB_O)
- $(AR) $@ $(CORE_O) $(LIB_O) # DLL needs all object files
- $(RANLIB) $@
+ $(LIBTOOL) --mode=link --tag=CC $(CC) $(LDFLAGS) -lm -ldl $(BASE_O:.o=.lo) -rpath /usr/lib -version-info 6:0:1 -o liblua$(V).la
$(LUA_T): $(LUA_O) $(LUA_A)
- $(CC) -o $@ $(MYLDFLAGS) $(LUA_O) $(LUA_A) $(LIBS)
+ $(LIBTOOL) --mode=link --tag=CC $(CC) $(LDFLAGS) $(LIBS) -static liblua$(V).la -Wl,-E lua.lo -o $@
$(LUAC_T): $(LUAC_O) $(LUA_A)
- $(CC) -o $@ $(MYLDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS)
+ $(LIBTOOL) --mode=link --tag=CC $(CC) $(LDFLAGS) -static liblua$(V).la luac.lo -o $@
clean:
$(RM) $(ALL_T) $(ALL_O)
Index: lua-5.1.5/src/luaconf.h
===================================================================
--- lua-5.1.5.orig/src/luaconf.h
+++ lua-5.1.5/src/luaconf.h
@@ -95,13 +95,17 @@
#else
#define LUA_ROOT "/usr/local/"
+#define LUA_ROOT2 "/usr/"
#define LUA_LDIR LUA_ROOT "share/lua/5.1/"
+#define LUA_LDIR2 LUA_ROOT2 "share/lua/5.1/"
#define LUA_CDIR LUA_ROOT "lib/lua/5.1/"
+#define LUA_CDIR2 LUA_ROOT2 "lib/lua/5.1/"
#define LUA_PATH_DEFAULT \
"./?.lua;" LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \
- LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua"
+ LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua;" \
+ LUA_LDIR2"?.lua;" LUA_LDIR2"?/init.lua"
#define LUA_CPATH_DEFAULT \
- "./?.so;" LUA_CDIR"?.so;" LUA_CDIR"loadall.so"
+ "./?.so;" LUA_CDIR"?.so;" LUA_CDIR2"?.so;" LUA_CDIR"loadall.so"
#endif

323
lua51.changes Normal file
View File

@ -0,0 +1,323 @@
-------------------------------------------------------------------
Fri Aug 2 08:12:52 UTC 2019 - Martin Liška <mliska@suse.cz>
- Use FAT LTO objects in order to provide proper static library.
-------------------------------------------------------------------
Tue Jul 25 10:03:59 UTC 2017 - tchvatal@suse.com
- Provide symbol for pkgconfig
-------------------------------------------------------------------
Mon Jul 24 12:08:05 UTC 2017 - dimstar@opensuse.org
- Add INSTALL_LMOD and INSTALL_CMOD variables to lua51.pc: this is
queried for example by rrdtool's buildsystem.
-------------------------------------------------------------------
Thu Jul 20 12:36:41 UTC 2017 - tchvatal@suse.com
- Properly set includedir in the .pc file
-------------------------------------------------------------------
Mon Jul 10 14:29:15 UTC 2017 - tchvatal@suse.com
- Remove lua macros to favor split package
- Sync with lua53 package to have exactly same approach of deployment
- Add patch fixing the build using libtool:
* lua-build-system.patch
- Remove patches that are obsolete by above:
* lua51-5.1.5-libdir.diff
* lua51-5.1.5-module-path.diff
* lua51-5.1.5-pkgconfig.patch
* lua51-5.1.5-shared.diff
-------------------------------------------------------------------
Sat Sep 5 05:22:42 UTC 2015 - i@marguerite.su
- provides Lua(API) and Lua(devel)
- adjust update-alternative weight
- macros installs to -devel
-------------------------------------------------------------------
Fri Jul 31 18:12:35 UTC 2015 - jengelh@inai.de
- Update RPM group classification
-------------------------------------------------------------------
Fri Sep 12 09:18:50 UTC 2014 - pgajdos@suse.com
- fix update-alternatives
-------------------------------------------------------------------
Wed Sep 10 10:20:31 UTC 2014 - pgajdos@suse.com
- fix /etc/rpm/macros.lua51 perms
-------------------------------------------------------------------
Thu May 1 06:59:04 UTC 2014 - mailaender@opensuse.org
- Added a softlink to retain compatibility with .so naming from
the DEB world which is the quasi standard in gaming nowadays.
-------------------------------------------------------------------
Mon Apr 14 06:56:18 UTC 2014 - pgajdos@suse.com
- revert last change: breaks builds of dependent packages.
They include lua51-devel and expects rpm macros to be available.
rpm macros use the interpreter.
-------------------------------------------------------------------
Tue Mar 18 10:06:55 UTC 2014 - Rene.vanPaassen@gmail.com
- correct dependency of lua51-devel, to be on the lib package, not
on the interpreter binary
-------------------------------------------------------------------
Tue Oct 22 12:24:49 UTC 2013 - peter.trommler@ohm-hochschule.de
- fix patch lua51-5.1.5-pkgconfig.patch
* libdl is required not librt
-------------------------------------------------------------------
Mon Oct 21 18:19:08 UTC 2013 - peter.trommler@ohm-hochschule.de
- refresh patch lua51-5.1.5-module-path.diff
- new patch lua51-5.1.5-pkgconfig.patch
* fix libraries in pkgconfig file
-------------------------------------------------------------------
Thu May 16 07:19:10 UTC 2013 - pgajdos@suse.com
- move rpm macros back, but install it in /etc/rpm/macros.lua51
and call lua5.1 in %lua_version definition
-------------------------------------------------------------------
Sun May 5 21:47:35 UTC 2013 - mrdocs@opensuse.org
- move the lua rpm macros to the devel package to avoid conflict
with lua 5.2
-------------------------------------------------------------------
Tue Apr 16 11:39:11 UTC 2013 - mmeister@suse.com
- Added url as source.
Please see http://en.opensuse.org/SourceUrls
-------------------------------------------------------------------
Mon Jun 18 12:59:24 UTC 2012 - pgajdos@suse.com
- updated to 5.1.5:
* bug-fix release, see http://www.lua.org/bugs.html for
more details
-> removed upstream-bugfix.patch
-------------------------------------------------------------------
Sat Mar 31 07:51:59 UTC 2012 - joop.boonen@opensuse.org
- Correction in Provides and Obsolete for lua-libs
-------------------------------------------------------------------
Mon Feb 13 10:49:58 UTC 2012 - coolo@suse.com
- patch license to follow spdx.org standard
-------------------------------------------------------------------
Wed Dec 21 13:48:10 UTC 2011 - pgajdos@suse.com
- lua51 branched from lua package
-------------------------------------------------------------------
Tue Oct 4 11:44:08 UTC 2011 - uli@suse.com
- cross-build fix: use %__cc macro
-------------------------------------------------------------------
Mon Jun 28 06:38:35 UTC 2010 - jengelh@medozas.de
- use %_smp_mflags
-------------------------------------------------------------------
Mon Jun 14 15:55:32 CEST 2010 - pgajdos@suse.cz
- removed -L/usr/lib from Libs: in etc/lua.pc [bnc#613497]
- used upstream bugfix patch from http://www.lua.org/download.html
-------------------------------------------------------------------
Sat Apr 24 11:38:23 UTC 2010 - coolo@novell.com
- buildrequire pkg-config to fix provides
-------------------------------------------------------------------
Tue Mar 23 11:16:23 CET 2010 - pgajdos@suse.cz
- modified LUA_PATH_DEFAULT [bnc#589441]: search modules under
/usr/%{_lib}/lua/%{major_version} too
-------------------------------------------------------------------
Sat Dec 12 18:28:44 CET 2009 - jengelh@medozas.de
- add baselibs.conf as a source
- package documentation as noarch
-------------------------------------------------------------------
Sun Dec 6 16:02:17 CET 2009 - jengelh@medozas.de
- enable parallel building
-------------------------------------------------------------------
Tue Nov 3 19:09:29 UTC 2009 - coolo@novell.com
- updated patches to apply with fuzz=0
-------------------------------------------------------------------
Wed Sep 16 23:25:13 CEST 2009 - dmueller@suse.de
- add baselibs.conf
-------------------------------------------------------------------
Mon Jun 8 15:57:11 CEST 2009 - pgajdos@suse.cz
- package owns /usr/{lib,share}/lua directories from now
- emoved unneeded root.patch
-------------------------------------------------------------------
Thu Sep 11 16:00:41 CEST 2008 - pgajdos@suse.cz
- updated to 5.1.4: bugfix release
-------------------------------------------------------------------
Wed Jun 11 10:56:51 ADT 2008 - jfunk@funktronics.ca
- Set LUA_ROOT to /usr and fix INSTALL_CMOD for lib64
- Add RPM macros file
- Allows for lua-<modulename> packages like python, perl, and ruby
-------------------------------------------------------------------
Fri Mar 28 07:57:37 CET 2008 - coolo@suse.de
- hint the solver about the package rename
-------------------------------------------------------------------
Wed Mar 26 21:29:35 CET 2008 - coolo@suse.de
- do not package/provide the shared lib twice / follow shared lib
policy
-------------------------------------------------------------------
Tue Feb 19 10:37:22 CET 2008 - pgajdos@suse.cz
- created -doc package
- updated to version 5.1.3, bug fix release. Fixed bugs:
* wrong error message in some concatenations
* too many variables in an assignment may cause a C stack
overflow
* an error in a module loaded through the '-l' option shows no
traceback
* gsub may go wild when wrongly called without its third
argument and with a large subject
* table.remove removes last element of a table when given
an out-of-bound index
* lua_setfenv may crash if called over an invalid object
* stand-alone interpreter shows incorrect error message when
the "message" is a coroutine.
* debug.sethook/gethook may overflow the thread's stack
-------------------------------------------------------------------
Tue Jul 24 14:31:30 CEST 2007 - pgajdos@suse.cz
- using /sbin/ldconfig in specfile
- updated to version 5.1.2, fixes some bugs:
* count hook may be called without being set
* code generated for "-nil", "-true", and "-false" is wrong
* recursive coroutines may overflow C stack
* wrong error message in some concatenations
* very small numbers all collide in the hash function
-------------------------------------------------------------------
Mon Nov 27 17:42:31 CET 2006 - mrueckert@suse.de
- package liblua.so as symlink.
-------------------------------------------------------------------
Thu Nov 16 21:29:32 CET 2006 - mrueckert@suse.de
- the core package now uses update alternatives to allow installation
of 5.0.x and 5.1.x
- devel packages will conflict now
-------------------------------------------------------------------
Tue Nov 14 21:29:31 CET 2006 - mrueckert@suse.de
- ARGH dont copy and paste!:
lua-libs should not depend on lua. another run on (#217875)
-------------------------------------------------------------------
Tue Nov 14 11:42:44 CET 2006 - mrueckert@suse.de
- really fix the file pattern (#217875)
-------------------------------------------------------------------
Thu Nov 9 15:08:50 CET 2006 - mrueckert@suse.de
- splitted out lua-libs so we can install at least both libs
in parallel. (#217875)
-------------------------------------------------------------------
Thu Oct 19 22:44:09 CEST 2006 - dmueller@suse.de
- fix wrong prefix in lua.pc
- link liblua with -lm to satisfy unresolved symbols
-------------------------------------------------------------------
Thu Oct 19 16:44:39 CEST 2006 - mjancar@suse.cz
- include lua.pc
-------------------------------------------------------------------
Wed Oct 18 19:17:00 CEST 2006 - mjancar@suse.cz
- update to 5.1.1
Language:
* new module system.
* new semantics for control variables of fors.
* new semantics for setn/getn.
* new syntax/semantics for varargs.
* new long strings and comments.
* new `mod' operator (`%')
* new length operator #t
* metatables for all types
API:
* new functions: lua_createtable, lua_get(set)field, lua_push(to)integer.
* user supplies memory allocator (lua_open becomes lua_newstate).
* luaopen_* functionst must be called through Lua.
Implementation:
* new configuration scheme via luaconf.h.
* incremental garbage collection.
* better handling of end-of-line in the lexer.
* fully reentrant parser (new Lua function `load')
* better support for 64-bit machines.
* native loadlib support for Mac OS X.
* standard distribution in only one library (lualib.a merged into lua.a)
-------------------------------------------------------------------
Wed Jan 25 21:38:05 CET 2006 - mls@suse.de
- converted neededforbuild to BuildRequires
-------------------------------------------------------------------
Sat Jan 14 01:36:17 CET 2006 - schwab@suse.de
- Don't strip binaries.
- Fix shared library linking.
-------------------------------------------------------------------
Thu Sep 8 15:17:49 CEST 2005 - anicka@suse.cz
- enable dynamic loading capability (#106845)
-------------------------------------------------------------------
Fri Apr 23 16:17:31 CEST 2004 - mcihar@suse.cz
- initial packaging

245
lua51.spec Normal file
View File

@ -0,0 +1,245 @@
#
# spec file for package lua51
#
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%define major_version 5.1
%define libname liblua5_1-5
Name: lua51
Version: 5.1.5
Release: 0
Summary: Small Embeddable Language with Procedural Syntax
License: MIT
Group: Development/Languages/Other
Url: http://www.lua.org
Source: http://www.lua.org/ftp/lua-%{version}.tar.gz
Source99: baselibs.conf
# PATCH-FIX-SUSE tweak the buildsystem to produce what is needed for SUSE
Patch0: lua-build-system.patch
BuildRequires: libtool
BuildRequires: lua-macros
BuildRequires: pkgconfig
BuildRequires: readline-devel
Requires(post): update-alternatives
Requires(postun): update-alternatives
Provides: lua = %{version}
Provides: Lua(API) = %{major_version}
%description
Lua is a programming language originally designed for extending
applications, but is also frequently used as a general-purpose,
stand-alone language.
Lua combines procedural syntax (similar to Pascal) with
data description constructs based on associative arrays and extensible
semantics. Lua is dynamically typed, interpreted from byte codes, and
has automatic memory management, making it suitable for configuration,
scripting, and rapid prototyping. Lua is implemented as a small library
of C functions, written in ANSI C.
%package devel
Summary: Development files for lua
Group: Development/Libraries/C and C++
Requires: %{libname} = %{version}
Requires: %{name} = %{version}
Requires: lua-macros
Requires(post): update-alternatives
Requires(postun): update-alternatives
Provides: lua-devel = %{version}
Provides: Lua(devel) = %{major_version}
Provides: pkgconfig(lua) = %{version}
%description devel
Lua is a programming language originally designed for extending
applications, but is also frequently used as a general-purpose,
stand-alone language.
This package contains files needed for embedding lua into your
application.
%package -n %{libname}
Summary: The Lua integration library
Group: System/Libraries
Provides: %{name}-libs = %{version}
Obsoletes: %{name}-libs < %{version}
Provides: liblua5_1 = %{version}-%{release}
Obsoletes: liblua5_1 < %{version}-%{release}
%description -n %{libname}
Lua is a programming language originally designed for extending
applications, but is also frequently used as a general-purpose,
stand-alone language.
Lua combines procedural syntax (similar to Pascal) with
data description constructs based on associative arrays and extensible
semantics. Lua is dynamically typed, interpreted from byte codes, and
has automatic memory management, making it suitable for configuration,
scripting, and rapid prototyping. Lua is implemented as a small library
of C functions, written in ANSI C.
%package doc
Summary: Documentation for Lua, a small embeddable language
Group: Documentation/HTML
BuildArch: noarch
%description doc
Lua is a programming language originally designed for extending
applications, but is also frequently used as a general-purpose,
stand-alone language.
Lua combines procedural syntax (similar to Pascal) with
data description constructs based on associative arrays and extensible
semantics. Lua is dynamically typed, interpreted from byte codes, and
has automatic memory management, making it suitable for configuration,
scripting, and rapid prototyping. Lua is implemented as a small library
of C functions, written in ANSI C.
%prep
%setup -q -n lua-%{version}
%autopatch -p1
# manpage
cat doc/lua.1 | sed 's/TH LUA 1/TH LUA%{major_version} 1/' > doc/lua%{major_version}.1
cat doc/luac.1 | sed 's/TH LUAC 1/TH LUAC%{major_version} 1/' > doc/luac%{major_version}.1
%build
%global _lto_cflags %{_lto_cflags} -ffat-lto-objects
sed -i -e "s@lib/lua/@%{_lib}/lua/@g" src/luaconf.h
export LIBTOOL="libtool --quiet"
make %{?_smp_mflags} -C src \
CC="cc" \
MYCFLAGS="%{optflags} -std=gnu99 -D_GNU_SOURCE -fPIC -DLUA_USE_LINUX -DLUA_COMPAT_MODULE" \
MYLIBS="-Wl,-E -ldl -lreadline -lhistory -lncurses" \
V=%{major_version} \
all
%install
make install \
V=%{major_version} \
INSTALL_TOP="%{buildroot}%{_prefix}" \
INSTALL_LIB="%{buildroot}%{_libdir}"
find %{buildroot} -type f -name "*.la" -delete -print
# create pkg-config file
cat > lua%{major_version}.pc <<-EOF
prefix=%{_prefix}
exec_prefix=%{_prefix}
libdir=%{_libdir}
includedir=%{_prefix}/include/lua%{major_version}
INSTALL_LMOD=%{_datadir}/lua/%{major_version}
INSTALL_CMOD=%{_libdir}/lua/%{major_version}
Name: Lua %{major_version}
Description: An Extensible Extension Language
Version: %{version}
Libs: -llua%{major_version} -lm
Cflags: -I\${includedir}
EOF
install -D -m 644 lua%{major_version}.pc %{buildroot}/%{_libdir}/pkgconfig/lua%{major_version}.pc
# update-alternatives
mkdir -p %{buildroot}%{_sysconfdir}/alternatives
for file in lua luac ; do
touch "%{buildroot}%{_sysconfdir}/alternatives/${file}"
ln -sf "%{_sysconfdir}/alternatives/${file}" "%{buildroot}%{_bindir}/${file}"
touch "%{buildroot}%{_sysconfdir}/alternatives/${file}.1%{ext_man}"
ln -sf "%{_sysconfdir}/alternatives/${file}.1%{ext_man}" "%{buildroot}%{_mandir}/man1/${file}.1%{ext_man}"
done
# Compat link with older unprefixed library and with soname 0 from deb/etc
ln -s %{_libdir}/liblua%{major_version}.so.%{major_version}.0 %{buildroot}%{_libdir}/liblua%{major_version}.so.%{major_version}
ln -s %{_libdir}/liblua%{major_version}.so.%{major_version}.0 %{buildroot}%{_libdir}/liblua%{major_version}.so.0
ln -s %{_libdir}/liblua%{major_version}.so.%{major_version}.0 %{buildroot}%{_libdir}/liblua.so.%{major_version}
# Library devel alternatives
touch %{buildroot}%{_sysconfdir}/alternatives/liblua.so
ln -sf %{_sysconfdir}/alternatives/liblua.so %{buildroot}%{_libdir}/liblua.so
touch %{buildroot}%{_sysconfdir}/alternatives/lua.pc
ln -sf %{_sysconfdir}/alternatives/lua.pc %{buildroot}%{_libdir}/pkgconfig/lua.pc
%check
cd src
LD_LIBRARY_PATH=`pwd` ./lua%{major_version} -e 'print(0)' > /dev/null
%post -n %{libname} -p /sbin/ldconfig
%postun -n %{libname} -p /sbin/ldconfig
%post
%{_sbindir}/update-alternatives --install \
%{_bindir}/lua lua %{_bindir}/lua%{major_version} 51 \
--slave %{_bindir}/luac luac %{_bindir}/luac%{major_version} \
--slave %{_mandir}/man1/lua.1%{ext_man} lua.1%{ext_man} %{_mandir}/man1/lua%{major_version}.1%{ext_man} \
--slave %{_mandir}/man1/luac.1%{ext_man} luac.1%{ext_man} %{_mandir}/man1/luac%{major_version}.1%{ext_man}
%postun
if [ "$1" = 0 ] ; then
%{_sbindir}/update-alternatives --remove lua %{_bindir}/lua%{major_version}
fi
%post devel
%{_sbindir}/update-alternatives --install \
%{_libdir}/liblua.so liblua.so %{_libdir}/liblua%{major_version}.so 51 \
--slave %{_libdir}/pkgconfig/lua.pc lua.pc %{_libdir}/pkgconfig/lua%{major_version}.pc
%postun devel
if [ "$1" = 0 ] ; then
%{_sbindir}/update-alternatives --remove liblua.so %{_libdir}/liblua%{major_version}.so
fi
%files
%doc README
%dir %{_libdir}/lua
%dir %{_libdir}/lua/%{major_version}
%dir %{_datadir}/lua
%dir %{_datadir}/lua/%{major_version}
%{_bindir}/lua%{major_version}
%{_bindir}/luac%{major_version}
%{_mandir}/man1/lua%{major_version}.1%{ext_man}
%{_mandir}/man1/luac%{major_version}.1%{ext_man}
# alternatives
%{_bindir}/lua
%{_bindir}/luac
%{_mandir}/man1/lua.1%{ext_man}
%{_mandir}/man1/luac.1%{ext_man}
%ghost %{_sysconfdir}/alternatives/lua
%ghost %{_sysconfdir}/alternatives/luac
%ghost %{_sysconfdir}/alternatives/lua.1%{ext_man}
%ghost %{_sysconfdir}/alternatives/luac.1%{ext_man}
%files -n %{libname}
%{_libdir}/liblua%{major_version}.so.*
%{_libdir}/liblua.so.*
%files devel
%dir %{_includedir}/lua%{major_version}
%{_includedir}/lua%{major_version}/lauxlib.h
%{_includedir}/lua%{major_version}/lua.h
%{_includedir}/lua%{major_version}/lua.hpp
%{_includedir}/lua%{major_version}/luaconf.h
%{_includedir}/lua%{major_version}/lualib.h
%{_libdir}/liblua%{major_version}.a
%{_libdir}/liblua%{major_version}.so
%{_libdir}/pkgconfig/lua%{major_version}.pc
# alternatives
%{_libdir}/liblua.so
%{_libdir}/pkgconfig/lua.pc
%ghost %{_sysconfdir}/alternatives/liblua.so
%ghost %{_sysconfdir}/alternatives/lua.pc
%files doc
%doc doc/*
%changelog