diff --git a/baselibs.conf b/baselibs.conf index 3a1066c..bdb1ee6 100644 --- a/baselibs.conf +++ b/baselibs.conf @@ -1 +1 @@ -liblua5_1 +liblua5_1-5 diff --git a/lua-build-system.patch b/lua-build-system.patch new file mode 100644 index 0000000..f8ba261 --- /dev/null +++ b/lua-build-system.patch @@ -0,0 +1,150 @@ +From: Enrico Tassi +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) diff --git a/lua51-5.1.5-libdir.diff b/lua51-5.1.5-libdir.diff deleted file mode 100644 index 3f94fbd..0000000 --- a/lua51-5.1.5-libdir.diff +++ /dev/null @@ -1,13 +0,0 @@ -Index: lua-5.1.4/etc/lua.pc -=================================================================== ---- lua-5.1.4.orig/etc/lua.pc -+++ lua-5.1.4/etc/lua.pc -@@ -25,7 +25,7 @@ Name: Lua - Description: An Extensible Extension Language - Version: ${R} - Requires: --Libs: -L${libdir} -llua -lm -+Libs: -llua -lm - Cflags: -I${includedir} - - # (end of lua.pc) diff --git a/lua51-5.1.5-module-path.diff b/lua51-5.1.5-module-path.diff deleted file mode 100644 index 8e7e4a8..0000000 --- a/lua51-5.1.5-module-path.diff +++ /dev/null @@ -1,24 +0,0 @@ -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 "LIBDIR/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 - - diff --git a/lua51-5.1.5-pkgconfig.patch b/lua51-5.1.5-pkgconfig.patch deleted file mode 100644 index 263b78d..0000000 --- a/lua51-5.1.5-pkgconfig.patch +++ /dev/null @@ -1,13 +0,0 @@ -Index: lua-5.1.5/etc/lua.pc -=================================================================== ---- lua-5.1.5.orig/etc/lua.pc -+++ lua-5.1.5/etc/lua.pc -@@ -25,7 +25,7 @@ Name: Lua - Description: An Extensible Extension Language - Version: ${R} - Requires: --Libs: -llua -lm -+Libs: -llua -lm -ldl - Cflags: -I${includedir} - - # (end of lua.pc) diff --git a/lua51-5.1.5-shared.diff b/lua51-5.1.5-shared.diff deleted file mode 100644 index 5c6e43a..0000000 --- a/lua51-5.1.5-shared.diff +++ /dev/null @@ -1,91 +0,0 @@ -Index: etc/lua.pc -=================================================================== ---- etc/lua.pc.orig -+++ etc/lua.pc -@@ -8,7 +8,7 @@ V= 5.1 - R= 5.1.5 - - # grep '^INSTALL_.*=' ../Makefile | sed 's/INSTALL_TOP/prefix/' --prefix= /usr/local -+prefix= /usr - INSTALL_BIN= ${prefix}/bin - INSTALL_INC= ${prefix}/include - INSTALL_LIB= ${prefix}/lib -Index: src/luaconf.h -=================================================================== ---- src/luaconf.h.orig -+++ src/luaconf.h -@@ -184,7 +184,7 @@ - - #elif defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \ - defined(__ELF__) --#define LUAI_FUNC __attribute__((visibility("hidden"))) extern -+#define LUAI_FUNC extern - #define LUAI_DATA LUAI_FUNC - - #else -Index: src/Makefile -=================================================================== ---- src/Makefile.orig -+++ src/Makefile -@@ -23,6 +23,7 @@ MYLIBS= - PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris - - LUA_A= liblua.a -+LUA_SO= liblua.so - 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 -@@ -36,7 +37,7 @@ LUAC_T= luac - LUAC_O= luac.o print.o - - ALL_O= $(CORE_O) $(LIB_O) $(LUA_O) $(LUAC_O) --ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T) -+ALL_T= $(LUA_SO) $(LUA_A) $(LUA_T) $(LUAC_T) - ALL_A= $(LUA_A) - - default: $(PLAT) -@@ -47,15 +48,20 @@ o: $(ALL_O) - - a: $(ALL_A) - -+# shared libraries (for Linux) -+$(LUA_SO): $(CORE_O) $(LIB_O) -+ $(CC) -o $(LUA_SO).$V -shared -Wl,-soname,$(LUA_SO).$V $(CORE_O) $(LIB_O) -lm -ldl -+ ln -fs $(LUA_SO).$(V) $(LUA_SO) -+ - $(LUA_A): $(CORE_O) $(LIB_O) - $(AR) $@ $(CORE_O) $(LIB_O) # DLL needs all object files - $(RANLIB) $@ - - $(LUA_T): $(LUA_O) $(LUA_A) -- $(CC) -o $@ $(MYLDFLAGS) $(LUA_O) $(LUA_A) $(LIBS) -+ $(CC) -o $@ $(MYLDFLAGS) $(LUA_O) -L. -llua $(LIBS) - - $(LUAC_T): $(LUAC_O) $(LUA_A) -- $(CC) -o $@ $(MYLDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS) -+ $(CC) -o $@ $(MYLDFLAGS) $(LUAC_O) -L. -llua $(LIBS) - - clean: - $(RM) $(ALL_T) $(ALL_O) -Index: Makefile -=================================================================== ---- Makefile.orig -+++ Makefile -@@ -43,7 +43,7 @@ PLATS= aix ansi bsd freebsd generic linu - # What to install. - TO_BIN= lua luac - TO_INC= lua.h luaconf.h lualib.h lauxlib.h ../etc/lua.hpp --TO_LIB= liblua.a -+TO_LIB= liblua.a liblua.so.$(V) - TO_MAN= lua.1 luac.1 - - # Lua version and release. -@@ -62,6 +62,7 @@ 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) -+ ln -s liblua.so.$(V) $(INSTALL_LIB)/liblua.so - cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB) - cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN) - diff --git a/lua51.changes b/lua51.changes index 3e2db22..e3f9e8b 100644 --- a/lua51.changes +++ b/lua51.changes @@ -1,3 +1,16 @@ +------------------------------------------------------------------- +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 diff --git a/lua51.spec b/lua51.spec index 9b23874..242cf78 100644 --- a/lua51.spec +++ b/lua51.spec @@ -1,7 +1,7 @@ # # spec file for package lua51 # -# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2017 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 @@ -17,184 +17,219 @@ %define major_version 5.1 -%define lib_suffix 5_1 +%define libname liblua5_1-5 Name: lua51 Version: 5.1.5 Release: 0 -Summary: Small Embeddable Language with Simple Procedural Syntax +Summary: Small Embeddable Language with Procedural Syntax License: MIT -Group: Development/Languages/Lua +Group: Development/Languages/Other Url: http://www.lua.org Source: http://www.lua.org/ftp/lua-%{version}.tar.gz -Source1: macros.lua -Source2: baselibs.conf -Patch0: %{name}-%{version}-shared.diff -Patch1: %{name}-%{version}-module-path.diff -Patch3: %{name}-%{version}-libdir.diff -Patch4: %{name}-%{version}-pkgconfig.patch -BuildRequires: pkg-config +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(preun): update-alternatives +Provides: lua = %{version} Provides: Lua(API) = %{major_version} -BuildRoot: %{_tmppath}/%{name}-%{version}-build %description Lua is a programming language originally designed for extending -applications, but also frequently used as a general-purpose, +applications, but is also frequently used as a general-purpose, stand-alone language. -Lua combines simple procedural syntax (similar to Pascal) with powerful +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 ideal for configuration, +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, and the implementation goals are -simplicity, efficiency, portability, and low embedding cost. +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: liblua%{lib_suffix} = %{version} +Requires: lua-macros +Provides: lua-devel = %{version} Provides: Lua(devel) = %{major_version} -Obsoletes: otherproviders(Lua(devel)) %description devel Lua is a programming language originally designed for extending -applications, but also frequently used as a general-purpose, +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 liblua%{lib_suffix} +%package -n %{libname} Summary: The Lua integration library Group: System/Libraries Provides: %{name}-libs = %{version} -Obsoletes: %{name}-libs <= %{version} +Obsoletes: %{name}-libs < %{version} -%description -n liblua%{lib_suffix} +%description -n %{libname} Lua is a programming language originally designed for extending -applications, but also frequently used as a general-purpose, +applications, but is also frequently used as a general-purpose, stand-alone language. -Lua combines simple procedural syntax (similar to Pascal) with powerful +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 ideal for configuration, +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, and the implementation goals are -simplicity, efficiency, portability, and low embedding cost. +of C functions, written in ANSI C. %package doc Summary: Documentation for Lua, a small embeddable language Group: Documentation/HTML -%if 0%{?suse_version} >= 1120 BuildArch: noarch -%endif %description doc Lua is a programming language originally designed for extending -applications, but also frequently used as a general-purpose, +applications, but is also frequently used as a general-purpose, stand-alone language. -Lua combines simple procedural syntax (similar to Pascal) with powerful +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 ideal for configuration, +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, and the implementation goals are -simplicity, efficiency, portability, and low embedding cost. +of C functions, written in ANSI C. %prep %setup -q -n lua-%{version} -%patch0 -b .shared -%patch1 -p1 -%patch3 -p1 -%patch4 -p1 +%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 -sed -i 's:LUA_ROOT2 "LIBDIR/lua/%{major_version}/":LUA_ROOT2 \"%{_lib}/lua/%{major_version}/":' src/luaconf.h -make %{?_smp_mflags} -C src CC="gcc" MYCFLAGS="%{optflags} -fPIC -DLUA_USE_LINUX" MYLIBS="-Wl,-E -ldl -lreadline -lhistory -lncurses" V=%{major_version} all +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 INSTALL_TOP="%{buildroot}%{_prefix}" INSTALL_LIB="%{buildroot}%{_libdir}" INSTALL_CMOD=%{buildroot}%{_libdir}/lua/%{major_version} INSTALL_MAN="%{buildroot}%{_mandir}/man1" -find %{buildroot} -name "*.a" -delete -print -install -D -m644 etc/lua.pc %{buildroot}%{_libdir}/pkgconfig/lua-%{major_version}.pc +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%{major_version} + +Name: Lua %{major_version} +Description: An Extensible Extension Language +Version: %{version} +Libs: -llua%{major_version} -lm +Cflags: +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 - mv "%{buildroot}%{_bindir}/${file}" "%{buildroot}%{_bindir}/${file}%{major_version}" touch "%{buildroot}%{_sysconfdir}/alternatives/${file}" ln -sf "%{_sysconfdir}/alternatives/${file}" "%{buildroot}%{_bindir}/${file}" - mv "%{buildroot}%{_mandir}/man1/${file}.1" "%{buildroot}%{_mandir}/man1/${file}%{major_version}.1" - touch "%{buildroot}%{_sysconfdir}/alternatives/${file}.1.gz" - ln -sf "%{_sysconfdir}/alternatives/${file}.1.gz" "%{buildroot}%{_mandir}/man1/${file}.1.gz" + touch "%{buildroot}%{_sysconfdir}/alternatives/${file}.1%{ext_man}" + ln -sf "%{_sysconfdir}/alternatives/${file}.1%{ext_man}" "%{buildroot}%{_mandir}/man1/${file}.1%{ext_man}" done -install -d -m 0755 %{buildroot}%{_libdir}/lua/%{major_version} -install -d -m 0755 %{buildroot}%{_datadir}/lua/%{major_version} -install -D -m 644 %{SOURCE1} %{buildroot}%{_sysconfdir}/rpm/macros.lua-%{major_version} -# Debian/Ubuntu/SteamOS/Arch Linux compatibility -ln -s %{_libdir}/liblua.so.%{major_version} %{buildroot}%{_libdir}/liblua%{major_version}.so.0 -ln -s %{_libdir}/liblua.so %{buildroot}%{_libdir}/liblua5.1.so +# 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} 30 \ +%{_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.gz lua.1.gz %{_mandir}/man1/lua%{major_version}.1.gz \ - --slave %{_mandir}/man1/luac.1.gz luac.1.gz %{_mandir}/man1/luac%{major_version}.1.gz + --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} -%preun +%postun if [ "$1" = 0 ] ; then %{_sbindir}/update-alternatives --remove lua %{_bindir}/lua%{major_version} fi -%post -n liblua%{lib_suffix} -p /sbin/ldconfig +%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 -n liblua%{lib_suffix} -p /sbin/ldconfig +%postun devel +if [ "$1" = 0 ] ; then + %{_sbindir}/update-alternatives --remove liblua.so %{_libdir}/liblua%{major_version}.so +fi %files -%defattr(-,root,root) -%doc COPYRIGHT HISTORY README -%{_bindir}/lua%{major_version} -%{_bindir}/luac%{major_version} -%{_mandir}/man1/lua%{major_version}.1.gz -%{_mandir}/man1/luac%{major_version}.1.gz -%{_bindir}/lua -%{_bindir}/luac -%{_mandir}/man1/lua.1.gz -%{_mandir}/man1/luac.1.gz -%ghost %{_sysconfdir}/alternatives/lua -%ghost %{_sysconfdir}/alternatives/luac -%ghost %{_sysconfdir}/alternatives/lua.1.gz -%ghost %{_sysconfdir}/alternatives/luac.1.gz +%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 liblua%{lib_suffix} -%defattr(-,root,root) -%{_libdir}/liblua.so.%{major_version} -%{_libdir}/liblua%{major_version}.so.0 +%files -n %{libname} +%{_libdir}/liblua%{major_version}.so.* +%{_libdir}/liblua.so.* %files devel -%defattr(-,root,root) -%{_sysconfdir}/rpm/macros.lua-%{major_version} -%{_includedir}/lauxlib.h -%{_includedir}/lua.h -%{_includedir}/lua.hpp -%{_includedir}/luaconf.h -%{_includedir}/lualib.h -%{_libdir}/pkgconfig/lua-%{major_version}.pc +%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}/liblua5.1.so +%{_libdir}/pkgconfig/lua.pc +%ghost %{_sysconfdir}/alternatives/liblua.so +%ghost %{_sysconfdir}/alternatives/lua.pc %files doc -%defattr(-,root,root) %doc doc/* %changelog diff --git a/macros.lua b/macros.lua deleted file mode 100644 index 225f8a9..0000000 --- a/macros.lua +++ /dev/null @@ -1,10 +0,0 @@ -# RPM macros for Lua - -# The major.minor version of Lua -%lua_version %(lua5.1 -e 'print(_VERSION)' | cut -d ' ' -f 2) - -# compiled modules should go here -%lua_archdir %{_libdir}/lua/%{lua_version} - -# pure Lua modules should go here -%lua_noarchdir %{_datadir}/lua/%{lua_version}