10 Commits

Author SHA256 Message Date
955a9b64ac interpreter should only provide, not conflict lua symbol (bsc#1247521) 2025-08-05 18:15:47 +02:00
52cfa7c57b interpreter should not conflict/provide lua symbol (bsc#1247521) 2025-08-04 13:52:48 +02:00
baea974a95 this package also provides devel symlink directly and conflicts other -devel packages 2025-07-25 19:52:52 +02:00
f1e6a75a37 Set up support for using libalternatives for Tumbleweed
update-alternatives are still used for SLE.
Also, fix .gitignore and overall improve the packaging.
2025-07-25 13:45:43 +02:00
bfe9be5be7 Fix running of the test suite 2025-07-19 21:05:05 +02:00
887ffeaab0 Add special config file for luac. 2025-07-19 17:48:11 +02:00
066fd43bb7 Switch from update-alternatives to libalternatives (and
dependency on lua-interpreter)
improve .gitignore and overall improve the packaging.
2025-07-19 11:25:51 +02:00
f86e662ffe Switch from update-alternatives to libalternatives (and dependency on lua-interpreter) 2025-07-19 11:24:32 +02:00
3f15ffa719 improve .gitignore 2025-07-16 11:28:36 +02:00
4c3cd94f0c convert the package from update-alternatives to libalternatives
And overall improve the packaging.
2025-07-16 11:28:03 +02:00
5 changed files with 199 additions and 80 deletions

4
.gitignore vendored
View File

@@ -1 +1,5 @@
.osc .osc
_scmsync.obsinfo
_buildconfig-*
_buildinfo-*.xml
lua51-*-build/

View File

@@ -3,14 +3,16 @@ Date: Sun, 1 Mar 2015 16:13:52 +0100
Subject: build system Subject: build system
--- ---
Makefile | 25 ++++++++++++++----------- Makefile | 26 +++++++++++++++-----------
src/Makefile | 31 +++++++++++++++++++------------ src/Makefile | 28 ++++++++++++++++------------
2 files changed, 33 insertions(+), 23 deletions(-) src/luaconf.h | 8 ++++++--
testes/libs/makefile | 11 +++++++----
4 files changed, 44 insertions(+), 29 deletions(-)
Index: lua-5.1.5/Makefile Index: lua-5.1.5/Makefile
=================================================================== ===================================================================
--- lua-5.1.5.orig/Makefile --- lua-5.1.5.orig/Makefile 2012-02-10 10:50:23.000000000 +0100
+++ lua-5.1.5/Makefile +++ lua-5.1.5/Makefile 2025-07-19 17:02:14.322726003 +0200
@@ -2,6 +2,8 @@ @@ -2,6 +2,8 @@
# see INSTALL for installation instructions # see INSTALL for installation instructions
# see src/Makefile and src/luaconf.h for further customization # see src/Makefile and src/luaconf.h for further customization
@@ -20,7 +22,7 @@ Index: lua-5.1.5/Makefile
# == CHANGE THE SETTINGS BELOW TO SUIT YOUR ENVIRONMENT ======================= # == CHANGE THE SETTINGS BELOW TO SUIT YOUR ENVIRONMENT =======================
# Your platform. See PLATS for possible values. # Your platform. See PLATS for possible values.
@@ -9,22 +11,23 @@ PLAT= none @@ -9,22 +11,23 @@
# Where to install. The installation starts in the src and doc directories, # Where to install. The installation starts in the src and doc directories,
# so take care if INSTALL_TOP is not an absolute path. # so take care if INSTALL_TOP is not an absolute path.
@@ -48,7 +50,7 @@ Index: lua-5.1.5/Makefile
# #
# If you don't have install you can use cp instead. # If you don't have install you can use cp instead.
# INSTALL= cp -p # INSTALL= cp -p
@@ -41,10 +44,10 @@ RANLIB= ranlib @@ -41,10 +44,10 @@
PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris
# What to install. # What to install.
@@ -62,7 +64,7 @@ Index: lua-5.1.5/Makefile
# Lua version and release. # Lua version and release.
V= 5.1 V= 5.1
@@ -53,16 +56,16 @@ R= 5.1.5 @@ -53,16 +56,17 @@
all: $(PLAT) all: $(PLAT)
$(PLATS) clean: $(PLATS) clean:
@@ -75,18 +77,20 @@ Index: lua-5.1.5/Makefile
install: dummy install: dummy
cd src && $(MKDIR) $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB) $(INSTALL_MAN) $(INSTALL_LMOD) $(INSTALL_CMOD) 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_EXEC) $(TO_BIN) $(INSTALL_BIN)
+ cd src && $(LIBTOOL) --mode=install $(INSTALL_EXEC) $(TO_BIN) $(INSTALL_BIN)
cd src && $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC) cd src && $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC)
- cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB) - cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB)
+ cd src && $(INSTALL_LIBTOOL) $(TO_LIB) $(INSTALL_LIB) + cd src && $(INSTALL_LIBTOOL) $(TO_LIB) $(INSTALL_LIB)
+ rm -f $(INSTALL_LIB)/liblua$(V).a
cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN) cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN)
ranlib: ranlib:
Index: lua-5.1.5/src/Makefile Index: lua-5.1.5/src/Makefile
=================================================================== ===================================================================
--- lua-5.1.5.orig/src/Makefile --- lua-5.1.5.orig/src/Makefile 2012-02-13 21:41:22.000000000 +0100
+++ lua-5.1.5/src/Makefile +++ lua-5.1.5/src/Makefile 2025-07-19 17:02:14.323016861 +0200
@@ -8,7 +8,7 @@ @@ -8,32 +8,37 @@
PLAT= none PLAT= none
CC= gcc CC= gcc
@@ -95,7 +99,8 @@ Index: lua-5.1.5/src/Makefile
AR= ar rcu AR= ar rcu
RANLIB= ranlib RANLIB= ranlib
RM= rm -f RM= rm -f
@@ -16,24 +16,28 @@ LIBS= -lm $(MYLIBS) LIBS= -lm $(MYLIBS)
+LIBDIR=/usr/lib
MYCFLAGS= MYCFLAGS=
MYLDFLAGS= MYLDFLAGS=
@@ -110,7 +115,7 @@ Index: lua-5.1.5/src/Makefile
PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris
-LUA_A= liblua.a -LUA_A= liblua.a
+LUA_A= liblua$(V).a +LUA_A= liblua$(V).la
CORE_O= lapi.o lcode.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o \ 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 \ 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
@@ -130,28 +135,29 @@ Index: lua-5.1.5/src/Makefile
ALL_O= $(CORE_O) $(LIB_O) $(LUA_O) $(LUAC_O) ALL_O= $(CORE_O) $(LIB_O) $(LUA_O) $(LUAC_O)
ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T) ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T)
@@ -48,14 +52,13 @@ o: $(ALL_O) @@ -48,14 +53,13 @@
a: $(ALL_A) a: $(ALL_A)
$(LUA_A): $(CORE_O) $(LIB_O) $(LUA_A): $(CORE_O) $(LIB_O)
- $(AR) $@ $(CORE_O) $(LIB_O) # DLL needs all object files - $(AR) $@ $(CORE_O) $(LIB_O) # DLL needs all object files
- $(RANLIB) $@ - $(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 + $(LIBTOOL) --mode=link --tag=CC $(CC) $(LDFLAGS) -lm -ldl $(BASE_O:.o=.lo) -rpath $(LIBDIR) -version-info 6:0:1 -o $(LUA_A)
$(LUA_T): $(LUA_O) $(LUA_A) $(LUA_T): $(LUA_O) $(LUA_A)
- $(CC) -o $@ $(MYLDFLAGS) $(LUA_O) $(LUA_A) $(LIBS) - $(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 $@ + $(LIBTOOL) --mode=link --tag=CC $(CC) $(LDFLAGS) $(LIBS) $(LUA_A) -Wl,-E lua.lo -o $@
$(LUAC_T): $(LUAC_O) $(LUA_A) -$(LUAC_T): $(LUAC_O) $(LUA_A)
- $(CC) -o $@ $(MYLDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS) - $(CC) -o $@ $(MYLDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS)
+ $(LIBTOOL) --mode=link --tag=CC $(CC) $(LDFLAGS) -static liblua$(V).la luac.lo -o $@ +$(LUAC_T): $(LUAC_O) $(BASE_O)
+ $(LIBTOOL) --mode=link --tag=CC $(CC) $(LDFLAGS) -o $@ $(LUAC_O:.o=.lo) $(BASE_O:.o=.lo) $(LIBS)
clean: clean:
$(RM) $(ALL_T) $(ALL_O) $(RM) $(ALL_T) $(ALL_O)
Index: lua-5.1.5/src/luaconf.h Index: lua-5.1.5/src/luaconf.h
=================================================================== ===================================================================
--- lua-5.1.5.orig/src/luaconf.h --- lua-5.1.5.orig/src/luaconf.h 2008-02-11 17:25:08.000000000 +0100
+++ lua-5.1.5/src/luaconf.h +++ lua-5.1.5/src/luaconf.h 2025-07-19 17:02:14.323256121 +0200
@@ -95,13 +95,17 @@ @@ -95,13 +95,17 @@
#else #else
@@ -172,3 +178,31 @@ Index: lua-5.1.5/src/luaconf.h
#endif #endif
Index: lua-5.1.5/testes/libs/makefile
===================================================================
--- lua-5.1.5.orig/testes/libs/makefile 2016-01-18 16:32:17.000000000 +0100
+++ lua-5.1.5/testes/libs/makefile 2025-07-19 19:41:44.657503160 +0200
@@ -1,16 +1,19 @@
+CFLAGS ?= -Wall -O2 -ansi -fPIC
+CC = gcc
+
all: lib1.so lib11.so lib2.so lib21.so -lib2.so
lib1.so: lib1.c
- gcc -Wall -O2 -I../../ -ansi -shared -o lib1.so lib1.c
+ $(CC) $(CFLAGS) -shared -o lib1.so lib1.c
lib11.so: lib11.c
- gcc -Wall -O2 -I../../ -ansi -shared -o lib11.so lib11.c
+ $(CC) $(CFLAGS) -shared -o lib11.so lib11.c
lib2.so: lib2.c
- gcc -Wall -O2 -I../../ -ansi -shared -o lib2.so lib2.c
+ $(CC) $(CFLAGS) -shared -o lib2.so lib2.c
lib21.so: lib21.c
- gcc -Wall -O2 -I../../ -ansi -shared -o lib21.so lib21.c
+ $(CC) $(CFLAGS) -shared -o lib21.so lib21.c
-lib2.so: lib2.so
cp lib2.so ./-lib2.so

BIN
lua5.1-tests.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

View File

@@ -1,3 +1,17 @@
-------------------------------------------------------------------
Tue Aug 5 07:21:48 UTC 2025 - Matej Cepl <mcepl@cepl.eu>
- interpreter should only provide, not conflict lua symbol
(bsc#1247521)
-------------------------------------------------------------------
Sat Jul 19 09:23:33 UTC 2025 - Matej Cepl <mcepl@cepl.eu>
- Switch from update-alternatives to libalternatives (and
dependency on lua-interpreter)
- improve .gitignore and overall improve the packaging.
- this package also provides devel symlink directly and conflicts other -devel packages
------------------------------------------------------------------- -------------------------------------------------------------------
Fri Aug 2 08:12:52 UTC 2019 - Martin Liška <mliska@suse.cz> Fri Aug 2 08:12:52 UTC 2019 - Martin Liška <mliska@suse.cz>
@@ -64,27 +78,27 @@ Thu May 1 06:59:04 UTC 2014 - mailaender@opensuse.org
Mon Apr 14 06:56:18 UTC 2014 - pgajdos@suse.com Mon Apr 14 06:56:18 UTC 2014 - pgajdos@suse.com
- revert last change: breaks builds of dependent packages. - revert last change: breaks builds of dependent packages.
They include lua51-devel and expects rpm macros to be available. They include lua51-devel and expects rpm macros to be available.
rpm macros use the interpreter. rpm macros use the interpreter.
------------------------------------------------------------------- -------------------------------------------------------------------
Tue Mar 18 10:06:55 UTC 2014 - Rene.vanPaassen@gmail.com Tue Mar 18 10:06:55 UTC 2014 - Rene.vanPaassen@gmail.com
- correct dependency of lua51-devel, to be on the lib package, not - correct dependency of lua51-devel, to be on the lib package, not
on the interpreter binary on the interpreter binary
------------------------------------------------------------------- -------------------------------------------------------------------
Tue Oct 22 12:24:49 UTC 2013 - peter.trommler@ohm-hochschule.de Tue Oct 22 12:24:49 UTC 2013 - peter.trommler@ohm-hochschule.de
- fix patch lua51-5.1.5-pkgconfig.patch - fix patch lua51-5.1.5-pkgconfig.patch
* libdl is required not librt * libdl is required not librt
------------------------------------------------------------------- -------------------------------------------------------------------
Mon Oct 21 18:19:08 UTC 2013 - peter.trommler@ohm-hochschule.de Mon Oct 21 18:19:08 UTC 2013 - peter.trommler@ohm-hochschule.de
- refresh patch lua51-5.1.5-module-path.diff - refresh patch lua51-5.1.5-module-path.diff
- new patch lua51-5.1.5-pkgconfig.patch - new patch lua51-5.1.5-pkgconfig.patch
* fix libraries in pkgconfig file * fix libraries in pkgconfig file
------------------------------------------------------------------- -------------------------------------------------------------------
Thu May 16 07:19:10 UTC 2013 - pgajdos@suse.com Thu May 16 07:19:10 UTC 2013 - pgajdos@suse.com
@@ -95,7 +109,7 @@ Thu May 16 07:19:10 UTC 2013 - pgajdos@suse.com
------------------------------------------------------------------- -------------------------------------------------------------------
Sun May 5 21:47:35 UTC 2013 - mrdocs@opensuse.org Sun May 5 21:47:35 UTC 2013 - mrdocs@opensuse.org
- move the lua rpm macros to the devel package to avoid conflict - move the lua rpm macros to the devel package to avoid conflict
with lua 5.2 with lua 5.2
------------------------------------------------------------------- -------------------------------------------------------------------
@@ -115,7 +129,7 @@ Mon Jun 18 12:59:24 UTC 2012 - pgajdos@suse.com
------------------------------------------------------------------- -------------------------------------------------------------------
Sat Mar 31 07:51:59 UTC 2012 - joop.boonen@opensuse.org Sat Mar 31 07:51:59 UTC 2012 - joop.boonen@opensuse.org
- Correction in Provides and Obsolete for lua-libs - Correction in Provides and Obsolete for lua-libs
------------------------------------------------------------------- -------------------------------------------------------------------
Mon Feb 13 10:49:58 UTC 2012 - coolo@suse.com Mon Feb 13 10:49:58 UTC 2012 - coolo@suse.com
@@ -210,18 +224,18 @@ Tue Feb 19 10:37:22 CET 2008 - pgajdos@suse.cz
- created -doc package - created -doc package
- updated to version 5.1.3, bug fix release. Fixed bugs: - updated to version 5.1.3, bug fix release. Fixed bugs:
* wrong error message in some concatenations * wrong error message in some concatenations
* too many variables in an assignment may cause a C stack * too many variables in an assignment may cause a C stack
overflow overflow
* an error in a module loaded through the '-l' option shows no * an error in a module loaded through the '-l' option shows no
traceback traceback
* gsub may go wild when wrongly called without its third * gsub may go wild when wrongly called without its third
argument and with a large subject argument and with a large subject
* table.remove removes last element of a table when given * table.remove removes last element of a table when given
an out-of-bound index an out-of-bound index
* lua_setfenv may crash if called over an invalid object * lua_setfenv may crash if called over an invalid object
* stand-alone interpreter shows incorrect error message when * stand-alone interpreter shows incorrect error message when
the "message" is a coroutine. the "message" is a coroutine.
* debug.sethook/gethook may overflow the thread's stack * debug.sethook/gethook may overflow the thread's stack
------------------------------------------------------------------- -------------------------------------------------------------------
Tue Jul 24 14:31:30 CEST 2007 - pgajdos@suse.cz Tue Jul 24 14:31:30 CEST 2007 - pgajdos@suse.cz

View File

@@ -18,25 +18,41 @@
%define major_version 5.1 %define major_version 5.1
%define libname liblua5_1-5 %define libname liblua5_1-5
%if 0%{?suse_version} > 1500
%bcond_without libalternatives
%else
%bcond_with libalternatives
%endif
Name: lua51 Name: lua51
Version: 5.1.5 Version: 5.1.5
Release: 0 Release: 0
Summary: Small Embeddable Language with Procedural Syntax Summary: Small Embeddable Language with Procedural Syntax
License: MIT License: MIT
Group: Development/Languages/Other Group: Development/Languages/Other
Url: http://www.lua.org URL: https://www.lua.org
Source: http://www.lua.org/ftp/lua-%{version}.tar.gz Source0: https://www.lua.org/ftp/lua-%{version}.tar.gz
Source1: https://www.lua.org/tests/lua%{major_version}-tests.tar.gz
Source99: baselibs.conf Source99: baselibs.conf
# PATCH-FIX-SUSE tweak the buildsystem to produce what is needed for SUSE # PATCH-FIX-SUSE tweak the buildsystem to produce what is needed for SUSE
Patch0: lua-build-system.patch Patch0: lua-build-system.patch
# Yes, Lua is from Brasil, we need pt_BR locale
BuildRequires: glibc-locale
BuildRequires: libtool BuildRequires: libtool
BuildRequires: lua-macros BuildRequires: lua-macros
BuildRequires: pkgconfig BuildRequires: pkgconfig
BuildRequires: readline-devel BuildRequires: readline-devel
Provides: lua = %{version}
Obsoletes: lua < %{version}
Provides: Lua(API) = %{major_version}
%if %{with libalternatives}
BuildRequires: alts
BuildRequires: lua-interpreter
Requires: alts
Requires: lua-interpreter
%else
Requires(post): update-alternatives Requires(post): update-alternatives
Requires(postun): update-alternatives Requires(postun): update-alternatives
Provides: lua = %{version} %endif
Provides: Lua(API) = %{major_version}
%description %description
Lua is a programming language originally designed for extending Lua is a programming language originally designed for extending
@@ -56,8 +72,7 @@ Group: Development/Libraries/C and C++
Requires: %{libname} = %{version} Requires: %{libname} = %{version}
Requires: %{name} = %{version} Requires: %{name} = %{version}
Requires: lua-macros Requires: lua-macros
Requires(post): update-alternatives Conflicts: lua-devel
Requires(postun): update-alternatives
Provides: lua-devel = %{version} Provides: lua-devel = %{version}
Provides: Lua(devel) = %{major_version} Provides: Lua(devel) = %{major_version}
Provides: pkgconfig(lua) = %{version} Provides: pkgconfig(lua) = %{version}
@@ -72,11 +87,17 @@ application.
%package -n %{libname} %package -n %{libname}
Summary: The Lua integration library Summary: The Lua integration library
# Compat as libtool changes the soname
Group: System/Libraries Group: System/Libraries
Provides: %{name}-libs = %{version}
Obsoletes: %{name}-libs < %{version}
Provides: liblua5_1 = %{version}-%{release} Provides: liblua5_1 = %{version}-%{release}
Obsoletes: liblua5_1 < %{version}-%{release} Obsoletes: liblua5_1 < %{version}-%{release}
Provides: %{name}-libs = %{version}
Obsoletes: %{name}-libs < %{version}
%ifarch aarch64 x86_64 ppc64 ppc64le s390x riscv64
Provides: liblua.so.5.1()(64bit)
%else
Provides: liblua.so.5.1
%endif
%description -n %{libname} %description -n %{libname}
Lua is a programming language originally designed for extending Lua is a programming language originally designed for extending
@@ -94,6 +115,9 @@ of C functions, written in ANSI C.
Summary: Documentation for Lua, a small embeddable language Summary: Documentation for Lua, a small embeddable language
Group: Documentation/HTML Group: Documentation/HTML
BuildArch: noarch BuildArch: noarch
%if 0%{?suse_version} > 1315
Supplements: (lua51 and patterns-base-documentation)
%endif
%description doc %description doc
Lua is a programming language originally designed for extending Lua is a programming language originally designed for extending
@@ -108,7 +132,8 @@ scripting, and rapid prototyping. Lua is implemented as a small library
of C functions, written in ANSI C. of C functions, written in ANSI C.
%prep %prep
%setup -q -n lua-%{version} %setup -q -n lua-%{version} -a1
mv lua%{major_version}-tests testes
%autopatch -p1 %autopatch -p1
# manpage # manpage
@@ -116,21 +141,22 @@ cat doc/lua.1 | sed 's/TH LUA 1/TH LUA%{major_version} 1/' > doc/lua%{major_ver
cat doc/luac.1 | sed 's/TH LUAC 1/TH LUAC%{major_version} 1/' > doc/luac%{major_version}.1 cat doc/luac.1 | sed 's/TH LUAC 1/TH LUAC%{major_version} 1/' > doc/luac%{major_version}.1
%build %build
%global _lto_cflags %{_lto_cflags} -ffat-lto-objects %global _lto_cflags %{nil}
sed -i -e "s@lib/lua/@%{_lib}/lua/@g" src/luaconf.h sed -i -e "s@lib/lua/@%{_lib}/lua/@g" src/luaconf.h
export LIBTOOL="libtool --quiet" %make_build all -C src \
make %{?_smp_mflags} -C src \
CC="cc" \ CC="cc" \
MYCFLAGS="%{optflags} -std=gnu99 -D_GNU_SOURCE -fPIC -DLUA_USE_LINUX -DLUA_COMPAT_MODULE" \ MYCFLAGS="%{optflags} -std=gnu99 -D_GNU_SOURCE -fPIC -DLUA_USE_LINUX -DLUA_COMPAT_MODULE" \
MYLIBS="-Wl,-E -ldl -lreadline -lhistory -lncurses" \ MYLIBS="-Wl,-E -ldl -lreadline -lhistory -lncurses" \
V=%{major_version} \ V=%{major_version} \
all LIBTOOL="libtool --quiet"
%install %install
make install \ %make_install \
LIBTOOL="libtool --quiet" \
V=%{major_version} \ V=%{major_version} \
INSTALL_TOP="%{buildroot}%{_prefix}" \ INSTALL_TOP="%{buildroot}%{_prefix}" \
INSTALL_LIB="%{buildroot}%{_libdir}" INSTALL_LIB="%{buildroot}%{_libdir}" \
INSTALL_MAN="%{buildroot}%{_mandir}/man1"
find %{buildroot} -type f -name "*.la" -delete -print find %{buildroot} -type f -name "*.la" -delete -print
@@ -139,18 +165,31 @@ cat > lua%{major_version}.pc <<-EOF
prefix=%{_prefix} prefix=%{_prefix}
exec_prefix=%{_prefix} exec_prefix=%{_prefix}
libdir=%{_libdir} libdir=%{_libdir}
includedir=%{_prefix}/include/lua%{major_version} includedir=%{_includedir}/lua%{major_version}
INSTALL_LMOD=%{_datadir}/lua/%{major_version} INSTALL_LMOD=%{_datadir}/lua/%{major_version}
INSTALL_CMOD=%{_libdir}/lua/%{major_version} INSTALL_CMOD=%{_libdir}/lua/%{major_version}
Name: Lua %{major_version} Name: Lua %{major_version}
Description: An Extensible Extension Language Description: An Extensible Extension Language
Version: %{version} Version: %{version}
Libs: -llua%{major_version} -lm Libs: -llua%{major_version} -lm
Cflags: -I\${includedir} Cflags: -I\${includedir}
EOF EOF
install -D -m 644 lua%{major_version}.pc %{buildroot}/%{_libdir}/pkgconfig/lua%{major_version}.pc install -D -m 644 lua%{major_version}.pc %{buildroot}%{_libdir}/pkgconfig/lua%{major_version}.pc
%if %{with libalternatives}
# alternatives - create configuration file
mkdir -p %{buildroot}%{_datadir}/libalternatives/lua
cat > %{buildroot}%{_datadir}/libalternatives/lua/51.conf <<EOF
binary=%{_bindir}/lua5.1
man=lua5.1
EOF
mkdir -p %{buildroot}%{_datadir}/libalternatives/luac
cat > %{buildroot}%{_datadir}/libalternatives/luac/51.conf <<EOF
binary=%{_bindir}/luac5.1
man=luac5.1
EOF
%else
# update-alternatives # update-alternatives
mkdir -p %{buildroot}%{_sysconfdir}/alternatives mkdir -p %{buildroot}%{_sysconfdir}/alternatives
for file in lua luac ; do for file in lua luac ; do
@@ -159,24 +198,57 @@ for file in lua luac ; do
touch "%{buildroot}%{_sysconfdir}/alternatives/${file}.1%{ext_man}" touch "%{buildroot}%{_sysconfdir}/alternatives/${file}.1%{ext_man}"
ln -sf "%{_sysconfdir}/alternatives/${file}.1%{ext_man}" "%{buildroot}%{_mandir}/man1/${file}.1%{ext_man}" ln -sf "%{_sysconfdir}/alternatives/${file}.1%{ext_man}" "%{buildroot}%{_mandir}/man1/${file}.1%{ext_man}"
done done
%endif
# Compat link with older unprefixed library and with soname 0 from deb/etc # Compat link with older unprefixed library and with soname 0 from deb/etc
chmod +x %{buildroot}%{_libdir}/*
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.%{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%{major_version}.so.0
ln -s %{_libdir}/liblua%{major_version}.so.%{major_version}.0 %{buildroot}%{_libdir}/liblua.so.%{major_version} 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 # We dont create alternatives for -devel content, just conflict those
ln -sf %{_sysconfdir}/alternatives/liblua.so %{buildroot}%{_libdir}/liblua.so ln -s %{_libdir}/liblua%{major_version}.so %{buildroot}%{_libdir}/liblua.so
touch %{buildroot}%{_sysconfdir}/alternatives/lua.pc ln -s %{_libdir}/pkgconfig/lua%{major_version}.pc %{buildroot}%{_libdir}/pkgconfig/lua.pc
ln -sf %{_sysconfdir}/alternatives/lua.pc %{buildroot}%{_libdir}/pkgconfig/lua.pc
%check %check
cd src # WARNING: this whole check section is incredibly interdependent and brittle, don't change anything
LD_LIBRARY_PATH=`pwd` ./lua%{major_version} -e 'print(0)' > /dev/null # unless you really thought through what you would be doing.
# The distributed binary of the Lua interpreter is (correctly) build without LUA_USE_APICHECK option,
# we have to build a special interpreter just for the testing.
mkdir -p build-test
cp -r src build-test/
cp Makefile build-test/
pushd build-test
%make_build clean -C src
%make_build all -C src \
CC="cc" \
MYCFLAGS="%{optflags} -std=gnu99 -D_GNU_SOURCE -fPIC -DLUA_USE_LINUX -DLUA_COMPAT_MODULE -DLUA_USE_APICHECK" \
MYLIBS="-Wl,-E -ldl -lreadline -lhistory -lncurses" \
V=%{major_version} \
LIBTOOL="libtool --quiet"
popd
cd testes
pushd libs
%make_build all CFLAGS="-fPIC -std=gnu99 -D_GNU_SOURCE -I../../build-test/src"
cp -- *.so ..
popd
# Yes, Lua is from Brasil
export LANG=pt_BR.utf8
export LD_LIBRARY_PATH=../build-test/src/.libs
# I haven't found a way how to run FULL all.lua test suite, so we are just running
# what we can for checking the sanity of the build.
for testFile in api.lua attrib.lua calls.lua closure.lua \
code.lua constructs.lua db.lua errors.lua events.lua files.lua \
gc.lua checktable.lua literals.lua locals.lua math.lua nextvar.lua \
pm.lua sort.lua strings.lua vararg.lua verybig.lua
do
../build-test/src/.libs/lua%{major_version} $testFile
done
%post -n %{libname} -p /sbin/ldconfig %post -n %{libname} -p /sbin/ldconfig
%postun -n %{libname} -p /sbin/ldconfig %postun -n %{libname} -p /sbin/ldconfig
%if %{without libalternatives}
%post %post
%{_sbindir}/update-alternatives --install \ %{_sbindir}/update-alternatives --install \
%{_bindir}/lua lua %{_bindir}/lua%{major_version} 51 \ %{_bindir}/lua lua %{_bindir}/lua%{major_version} 51 \
@@ -188,16 +260,7 @@ LD_LIBRARY_PATH=`pwd` ./lua%{major_version} -e 'print(0)' > /dev/null
if [ "$1" = 0 ] ; then if [ "$1" = 0 ] ; then
%{_sbindir}/update-alternatives --remove lua %{_bindir}/lua%{major_version} %{_sbindir}/update-alternatives --remove lua %{_bindir}/lua%{major_version}
fi fi
%endif
%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 %files
%doc README %doc README
@@ -207,17 +270,22 @@ fi
%dir %{_datadir}/lua/%{major_version} %dir %{_datadir}/lua/%{major_version}
%{_bindir}/lua%{major_version} %{_bindir}/lua%{major_version}
%{_bindir}/luac%{major_version} %{_bindir}/luac%{major_version}
%{_mandir}/man1/lua%{major_version}.1%{ext_man} %{_mandir}/man1/lua%{major_version}.1%{?ext_man}
%{_mandir}/man1/luac%{major_version}.1%{ext_man} %{_mandir}/man1/luac%{major_version}.1%{?ext_man}
%if %{with libalternatives}
%{_datadir}/libalternatives/lua/51.conf
%{_datadir}/libalternatives/luac/51.conf
%else
# alternatives # alternatives
%{_bindir}/lua %{_bindir}/lua
%{_bindir}/luac %{_bindir}/luac
%{_mandir}/man1/lua.1%{ext_man} %{_mandir}/man1/lua.1%{?ext_man}
%{_mandir}/man1/luac.1%{ext_man} %{_mandir}/man1/luac.1%{?ext_man}
%ghost %{_sysconfdir}/alternatives/lua %ghost %{_sysconfdir}/alternatives/lua
%ghost %{_sysconfdir}/alternatives/luac %ghost %{_sysconfdir}/alternatives/luac
%ghost %{_sysconfdir}/alternatives/lua.1%{ext_man} %ghost %{_sysconfdir}/alternatives/lua.1%{ext_man}
%ghost %{_sysconfdir}/alternatives/luac.1%{ext_man} %ghost %{_sysconfdir}/alternatives/luac.1%{ext_man}
%endif
%files -n %{libname} %files -n %{libname}
%{_libdir}/liblua%{major_version}.so.* %{_libdir}/liblua%{major_version}.so.*
@@ -230,14 +298,10 @@ fi
%{_includedir}/lua%{major_version}/lua.hpp %{_includedir}/lua%{major_version}/lua.hpp
%{_includedir}/lua%{major_version}/luaconf.h %{_includedir}/lua%{major_version}/luaconf.h
%{_includedir}/lua%{major_version}/lualib.h %{_includedir}/lua%{major_version}/lualib.h
%{_libdir}/liblua%{major_version}.a
%{_libdir}/liblua%{major_version}.so %{_libdir}/liblua%{major_version}.so
%{_libdir}/pkgconfig/lua%{major_version}.pc %{_libdir}/pkgconfig/lua%{major_version}.pc
# alternatives
%{_libdir}/liblua.so %{_libdir}/liblua.so
%{_libdir}/pkgconfig/lua.pc %{_libdir}/pkgconfig/lua.pc
%ghost %{_sysconfdir}/alternatives/liblua.so
%ghost %{_sysconfdir}/alternatives/lua.pc
%files doc %files doc
%doc doc/* %doc doc/*