From 884fd3fe71adaeb578f2850023ceb7b0538c5040a31c99310f8da45a5c899a9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= Date: Mon, 10 Jul 2017 11:03:59 +0000 Subject: [PATCH] OBS-URL: https://build.opensuse.org/package/show/devel:languages:lua/lua53?expand=0&rev=6 --- lua-build-system.patch | 61 ++++++++----------- lua53.spec | 131 +++++++++++++++++++++++++++++------------ 2 files changed, 120 insertions(+), 72 deletions(-) diff --git a/lua-build-system.patch b/lua-build-system.patch index 6436cdc..19bc210 100644 --- a/lua-build-system.patch +++ b/lua-build-system.patch @@ -7,10 +7,10 @@ Subject: build system src/Makefile | 31 +++++++++++++++++++------------ 2 files changed, 33 insertions(+), 23 deletions(-) -diff --git a/Makefile b/Makefile -index c795dd7..87cdddc 100644 ---- a/Makefile -+++ b/Makefile +Index: lua-5.3.4/Makefile +=================================================================== +--- lua-5.3.4.orig/Makefile ++++ lua-5.3.4/Makefile @@ -1,6 +1,8 @@ # Makefile for installing Lua # See doc/readme.html for installation and customization instructions. @@ -25,17 +25,17 @@ index c795dd7..87cdddc 100644 # You may want to make INSTALL_LMOD and INSTALL_CMOD consistent with # LUA_ROOT, LUA_LDIR, and LUA_CDIR in luaconf.h. -INSTALL_TOP= /usr/local -+INSTALL_TOP= $(shell pwd)/debian/tmp/usr ++INSTALL_TOP= /usr INSTALL_BIN= $(INSTALL_TOP)/bin -INSTALL_INC= $(INSTALL_TOP)/include -INSTALL_LIB= $(INSTALL_TOP)/lib -INSTALL_MAN= $(INSTALL_TOP)/man/man1 -+INSTALL_INC= $(INSTALL_TOP)/include/lua5.3/ -+INSTALL_LIB= $(INSTALL_TOP)/lib/$(DEB_HOST_MULTIARCH)/ ++INSTALL_INC= $(INSTALL_TOP)/include/lua$(V)/ ++INSTALL_LIB= $(INSTALL_TOP)/lib/ +INSTALL_MAN= $(INSTALL_TOP)/share/man/man1 INSTALL_LMOD= $(INSTALL_TOP)/share/lua/$V -INSTALL_CMOD= $(INSTALL_TOP)/lib/lua/$V -+INSTALL_CMOD= $(INSTALL_TOP)/lib/$(DEB_HOST_MULTIARCH)/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. @@ -55,12 +55,12 @@ index c795dd7..87cdddc 100644 TO_INC= lua.h luaconf.h lualib.h lauxlib.h lua.hpp -TO_LIB= liblua.a -TO_MAN= lua.1 luac.1 -+TO_LIB= liblua$(V).la liblua$(V)-c++.la ++TO_LIB= liblua$(V).la +TO_MAN= lua$(V).1 luac$(V).1 # Lua version and release. V= 5.3 -@@ -52,16 +55,16 @@ R= $V.3 +@@ -52,16 +55,16 @@ R= $V.4 all: $(PLAT) $(PLATS) clean: @@ -80,50 +80,42 @@ index c795dd7..87cdddc 100644 cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN) uninstall: -diff --git a/src/Makefile b/src/Makefile -index d71c75c..3123942 100644 ---- a/src/Makefile -+++ b/src/Makefile -@@ -6,8 +6,10 @@ - # Your platform. See PLATS for possible values. +Index: lua-5.3.4/src/Makefile +=================================================================== +--- lua-5.3.4.orig/src/Makefile ++++ lua-5.3.4/src/Makefile +@@ -7,7 +7,7 @@ PLAT= none --CC= gcc -std=gnu99 + CC= gcc -std=gnu99 -CFLAGS= -O2 -Wall -Wextra -DLUA_COMPAT_5_2 $(SYSCFLAGS) $(MYCFLAGS) -+CC= $(CCACHE)gcc -std=gnu99 -+CXX= $(CCACHE)g++ +CFLAGS= -Wall -Wextra -DLUA_COMPAT_5_2 $(SYSCFLAGS) $(MYCFLAGS) -+CXXFLAGS= -Wall -Wextra -DLUA_COMPAT_5_2 $(SYSCFLAGS) $(MYCXXFLAGS) LDFLAGS= $(SYSLDFLAGS) $(MYLDFLAGS) LIBS= -lm $(SYSLIBS) $(MYLIBS) -@@ -19,16 +21,21 @@ SYSCFLAGS= - SYSLDFLAGS= +@@ -20,15 +20,19 @@ SYSLDFLAGS= SYSLIBS= --MYCFLAGS= --MYLDFLAGS= + MYCFLAGS= ++MYCXXFLAGS= + MYLDFLAGS= -MYLIBS= -+MYCFLAGS=$(shell dpkg-buildflags --get CFLAGS) $(shell dpkg-buildflags --get CPPFLAGS) -+MYCXXFLAGS=$(shell dpkg-buildflags --get CXXFLAGS) $(shell dpkg-buildflags --get CPPFLAGS) -+MYLDFLAGS=$(shell dpkg-buildflags --get LDFLAGS) +MYLIBS=-ldl MYOBJS= +%.o : %.c + $(LIBTOOL) --mode=compile --tag=CC $(CC) $(CFLAGS) -c $< -o $@ -+ $(LIBTOOL) --mode=compile --tag=CXX $(CXX) $(CFLAGS) -c $< -o $*-c++.o + # == END OF USER SETTINGS -- NO NEED TO CHANGE ANYTHING BELOW THIS LINE ======= PLATS= aix bsd c89 freebsd generic linux macosx mingw posix solaris -LUA_A= liblua.a -+LUA_A= liblua$(V).la liblua$(V)-c++.la ++LUA_A= liblua$(V).la CORE_O= lapi.o lcode.o lctype.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 -@@ -36,10 +43,10 @@ LIB_O= lauxlib.o lbaselib.o lbitlib.o lcorolib.o ldblib.o liolib.o \ +@@ -36,10 +40,10 @@ LIB_O= lauxlib.o lbaselib.o lbitlib.o lc lmathlib.o loslib.o lstrlib.o ltablib.o lutf8lib.o loadlib.o linit.o BASE_O= $(CORE_O) $(LIB_O) $(MYOBJS) @@ -136,22 +128,21 @@ index d71c75c..3123942 100644 LUAC_O= luac.o ALL_O= $(BASE_O) $(LUA_O) $(LUAC_O) -@@ -56,14 +63,14 @@ o: $(ALL_O) +@@ -56,14 +60,13 @@ o: $(ALL_O) a: $(ALL_A) $(LUA_A): $(BASE_O) - $(AR) $@ $(BASE_O) - $(RANLIB) $@ -+ $(LIBTOOL) --mode=link --tag=CC $(CC) $(LDFLAGS) -lm -ldl $(BASE_O:.o=.lo) -rpath /usr/lib/$(DEB_HOST_MULTIARCH) -version-info 0:0:0 -Wl,--version-script,../debian/version-script -o liblua$(V).la -+ $(LIBTOOL) --mode=link --tag=CXX $(CXX) $(LDFLAGS) -lm -ldl $(BASE_O:.o=-c++.lo) -rpath /usr/lib/$(DEB_HOST_MULTIARCH) -version-info 0:0:0 -Wl,--version-script,../debian/version-script -o liblua$(V)-c++.la ++ $(LIBTOOL) --mode=link --tag=CC $(CC) $(LDFLAGS) -lm -ldl $(BASE_O:.o=.lo) -rpath /usr/lib -version-info 8:0:3 -o liblua$(V).la $(LUA_T): $(LUA_O) $(LUA_A) - $(CC) -o $@ $(LDFLAGS) $(LUA_O) $(LUA_A) $(LIBS) -+ $(LIBTOOL) --mode=link --tag=CC $(CC) $(LDFLAGS) $(LIBS) -Wl,--version-script,../debian/version-script -static liblua$(V).la -Wl,-E lua.lo -o $@ ++ $(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 $@ $(LDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS) -+ $(LIBTOOL) --mode=link --tag=CC $(CC) $(LDFLAGS) -Wl,--version-script,../debian/version-script -static liblua$(V).la luac.lo -o $@ ++ $(LIBTOOL) --mode=link --tag=CC $(CC) $(LDFLAGS) -static liblua$(V).la luac.lo -o $@ clean: $(RM) $(ALL_T) $(ALL_O) diff --git a/lua53.spec b/lua53.spec index 3304bf0..0e379da 100644 --- a/lua53.spec +++ b/lua53.spec @@ -1,5 +1,5 @@ # -# spec file for package lua +# spec file for package lua53 # # Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. # @@ -17,8 +17,8 @@ %define major_version 5.3 -%define libname liblua5_3 -Name: lua +%define libname liblua5_3-5 +Name: lua53 Version: 5.3.4 Release: 0 Summary: Small Embeddable Language with Procedural Syntax @@ -30,8 +30,10 @@ Source1: macros.lua Source2: baselibs.conf # PATCH-FIX-SUSE tweak the buildsystem to produce what is needed for SUSE Patch0: lua-build-system.patch -BuildRequires: pkg-config +BuildRequires: libtool +BuildRequires: pkgconfig BuildRequires: readline-devel +Provides: lua = %{version} Provides: Lua(API) = %{major_version} %description @@ -49,10 +51,10 @@ 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: %libname = %{version} +Provides: lua-devel = %{version} Provides: Lua(devel) = %{major_version} -Conflicts: otherproviders(Lua(devel)) %description devel Lua is a programming language originally designed for extending @@ -62,13 +64,13 @@ stand-alone language. This package contains files needed for embedding lua into your application. -%package -n %libname +%package -n %{libname} Summary: The Lua integration library Group: System/Libraries Provides: %{name}-libs = %{version} Obsoletes: %{name}-libs < %{version} -%description -n %libname +%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. @@ -98,51 +100,97 @@ scripting, and rapid prototyping. Lua is implemented as a small library of C functions, written in ANSI C. %prep -%setup -q +%setup -q -n lua-%{version} %autopatch -p1 +# manpage +cat doc/lua.1 | sed 's/TH LUA 1/TH LUA5.3 1/' > doc/lua5.3.1 +cat doc/luac.1 | sed 's/TH LUAC 1/TH LUAC5.3 1/' > doc/luac5.3.1 + %build 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} + V=%{major_version} \ all %install make install \ + V=%{major_version} \ INSTALL_TOP="%{buildroot}%{_prefix}" \ - INSTALL_LIB="%{buildroot}%{_libdir}" \ - INSTALL_CMOD=%{buildroot}%{_libdir}/lua/%{major_version} \ - INSTALL_MAN="%{buildroot}%{_mandir}/man1" + INSTALL_LIB="%{buildroot}%{_libdir}" install -D -m 644 %{SOURCE1} %{buildroot}%{_sysconfdir}/rpm/macros.lua +find %{buildroot} -type f -name "*.la" -delete -print + # create pkg-config file -cat > lua.pc <<-EOF +cat > lua%{major_version}.pc <<-EOF prefix=%{_prefix} exec_prefix=%{_prefix} libdir=%{_libdir} -includedir=%{_prefix}}/include +includedir=%{_prefix}}/include%{major_version} -Name: Lua +Name: Lua %{major_version} Description: An Extensible Extension Language Version: %{version} -Libs: -llua -lm +Libs: -llua%{major_version} -lm Cflags: EOF -install -D -m 644 lua.pc %{buildroot}/%{_libdir}/pkgconfig/lua.pc +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 -e 'print(0)' > /dev/null +LD_LIBRARY_PATH=`pwd` ./lua%{major_version} -e 'print(0)' > /dev/null -%post -n %libname -p /sbin/ldconfig +%post -n %{libname} -p /sbin/ldconfig +%postun -n %{libname} -p /sbin/ldconfig -%postun -n %libname -p /sbin/ldconfig +%post +%{_sbindir}/update-alternatives --install \ + %{_bindir}/lua lua %{_bindir}/lua%{major_version} 53 \ + --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 53 \ + --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 -%defattr(-,root,root) %doc README %dir %{_libdir}/lua %dir %{_libdir}/lua/%{major_version} @@ -150,31 +198,40 @@ LD_LIBRARY_PATH=`pwd` ./lua -e 'print(0)' > /dev/null %dir %{_datadir}/lua/%{major_version} %{_bindir}/lua%{major_version} %{_bindir}/luac%{major_version} -%{_mandir}/man1/lua%{major_version}.1.gz -%{_mandir}/man1/luac%{major_version}.1.gz +%{_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.gz -%ghost %{_sysconfdir}/alternatives/luac.1.gz +%ghost %{_sysconfdir}/alternatives/lua.1%{ext_man} +%ghost %{_sysconfdir}/alternatives/luac.1%{ext_man} -%files -n %libname -%defattr(-,root,root) -%{_libdir}/liblua.so.%{major_version} +%files -n %{libname} +%{_libdir}/liblua%{major_version}.so.* +%{_libdir}/liblua.so.* %files devel -%defattr(-,root,root) %config %{_sysconfdir}/rpm/macros.lua -%{_includedir}/lauxlib.h -%{_includedir}/lua.h -%{_includedir}/lua.hpp -%{_includedir}/luaconf.h -%{_includedir}/lualib.h -%{_libdir}/liblua.a +%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 -%defattr(-,root,root) %doc doc/* %changelog