From 3d7a41b1f49ff66220c37587ca7d88522b18529d Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Fri, 9 Feb 2024 19:53:34 +0100 Subject: [PATCH] added c++ library; pkgconfig files and other improvements [release 5.4.6-2mamba;Fri Feb 09 2024] --- lua-5.1.2-luapc.patch | 11 --- lua-5.1.4-cross_compile.patch | 12 --- lua-5.2.0-dynlib.patch | 53 -------------- lua.spec | 134 ++++++++++++++++++++-------------- 4 files changed, 79 insertions(+), 131 deletions(-) delete mode 100644 lua-5.1.2-luapc.patch delete mode 100644 lua-5.1.4-cross_compile.patch delete mode 100644 lua-5.2.0-dynlib.patch diff --git a/lua-5.1.2-luapc.patch b/lua-5.1.2-luapc.patch deleted file mode 100644 index 0d258d3..0000000 --- a/lua-5.1.2-luapc.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- lua-5.1.2/etc/lua.pc 2007-03-23 20:58:49.000000000 +0100 -+++ lua-5.1.2/etc/lua.pc.prefix 2007-10-25 11:47:35.000000000 +0200 -@@ -8,7 +8,7 @@ - R= 5.1.2 - - # 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 diff --git a/lua-5.1.4-cross_compile.patch b/lua-5.1.4-cross_compile.patch deleted file mode 100644 index cac5d58..0000000 --- a/lua-5.1.4-cross_compile.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -Nru lua-5.1.4.orig//src/Makefile lua-5.1.4/src/Makefile ---- lua-5.1.4.orig//src/Makefile 2010-06-16 20:13:28.242643022 +0200 -+++ lua-5.1.4/src/Makefile 2010-06-16 20:14:12.930892707 +0200 -@@ -53,7 +53,7 @@ - $(RANLIB) $@ - - $(LUA_SO): $(CORE_O) $(LIB_O) -- gcc -Wl,-soname=liblua.so.$(V) -shared -o $@ $(MYLDFLAGS) $? $(LIBS) $(LUA_O) -+ $(CC) -Wl,-soname=liblua.so.$(V) -shared -o $@ $(MYLDFLAGS) $? $(LIBS) $(LUA_O) - rm -f liblua.so - ln -s $@ liblua.so - diff --git a/lua-5.2.0-dynlib.patch b/lua-5.2.0-dynlib.patch deleted file mode 100644 index 1e7f47a..0000000 --- a/lua-5.2.0-dynlib.patch +++ /dev/null @@ -1,53 +0,0 @@ -diff -ru lua-5.1.2/Makefile lua-5.1.2-om/Makefile ---- lua-5.1.2/Makefile 2007-10-24 10:12:17.000000000 +0200 - +++ lua-5.1.2-om/Makefile 2007-10-24 10:16:22.000000000 +0200 -@@ -53,7 +53,7 @@ - all: $(PLAT) - - $(PLATS) clean: -- cd src && $(MAKE) $@ -+ cd src && $(MAKE) V=$(V) $@ - - test: dummy - src/lua test/hello.lua -diff -ru lua-5.1.2/src/Makefile lua-5.1.2-om/src/Makefile ---- lua-5.1.2/src/Makefile 2007-03-25 16:49:23.000000000 +0200 -+++ lua-5.1.2-om/src/Makefile 2007-10-24 10:15:52.000000000 +0200 -@@ -8,7 +8,7 @@ - PLAT= none - - CC= gcc --CFLAGS= -O2 -Wall -DLUA_COMPAT_ALL $(SYSCFLAGS) $(MYCFLAGS) -+CFLAGS= -O2 -Wall -fPIC -DLUA_COMPAT_ALL $(SYSCFLAGS) $(MYCFLAGS) $(RPM_OPT_FLAGS) - LDFLAGS= $(SYSLDFLAGS) $(MYLDFLAGS) - LIBS= -lm $(SYSLIBS) $(MYLIBS) - -@@ -22,6 +22,7 @@ - - PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris - -+LUA_SO= liblua.so.$(V) - LUA_A= liblua.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 \ -@@ -36,7 +37,7 @@ - LUAC_O= luac.o - - ALL_O= $(BASE_O) $(LUA_O) $(LUAC_O) --ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T) -+ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T) $(LUA_SO) - ALL_A= $(LUA_A) - - # Targets start here. -@@ -51,6 +52,11 @@ - $(AR) $@ $? - $(RANLIB) $@ - -+$(LUA_SO): $(CORE_O) $(LIB_O) -+ gcc -Wl,-soname=liblua.so.$(V) -shared -o $@ $(MYLDFLAGS) $? $(LIBS) $(LUA_O) -+ rm -f liblua.so -+ ln -s $@ liblua.so -+ - $(LUA_T): $(LUA_O) $(LUA_A) - $(CC) -o $@ $(MYLDFLAGS) $(LUA_O) $(LUA_A) $(LIBS) - diff --git a/lua.spec b/lua.spec index 60b32b9..babd65b 100644 --- a/lua.spec +++ b/lua.spec @@ -1,26 +1,23 @@ -%define libname liblua %define libmajver %(echo %version | cut -d. -f 1-2) - Name: lua Version: 5.4.6 -Release: 1mamba +Release: 2mamba Summary: A powerful light-weight and embeddable programming language Group: Applications/Development Vendor: openmamba Distribution: openmamba -Packager: Aleph0 -URL: http://www.lua.org +Packager: Silvan Calarco +URL: https://www.lua.org/ Source: http://www.lua.org/ftp/lua-%{version}.tar.gz -Patch0: %{name}-5.2.0-dynlib.patch -Patch1: %{name}-5.1.2-luapc.patch -Patch2: %{name}-5.1.4-cross_compile.patch Patch3: lua-5.4.3-shared_library.patch License: MIT ## AUTOBUILDREQ-BEGIN BuildRequires: glibc-devel +BuildRequires: libgcc BuildRequires: libreadline-devel -BuildRequires: libtermcap-devel +BuildRequires: libstdc++6-devel ## AUTOBUILDREQ-END +Requires: lib%{name} = %{?epoch:%epoch:}%{version}-%{release} %description Lua is a powerful light-weight programming language designed for extending applications. @@ -32,74 +29,69 @@ For example, although Lua is not a pure object-oriented language, it does provid Lua's meta-mechanisms bring an economy of concepts and keep the language small, while allowing the semantics to be extended in unconventional ways. Extensible semantics is a distinguishing feature of Lua. -%package devel -Group: Development/Libraries -Summary: Development files for %{name} -Requires: %{name} = %{?epoch:%epoch:}%{version}-%{release} - -%description devel -Lua is a powerful light-weight programming language designed for extending applications. -Lua 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} +%package -n lib%{name} Summary: Lua is a powerful, light-weight programming language Group: System/Libraries -Provides: liblua.so -#Provides: liblualib.so -%description -n %{libname} +%description -n lib%{name} Lua is a powerful light-weight programming language designed for extending applications. This package contains the dynamic libraries provided by lua scripting language. -%package -n %{libname}-devel +%package -n lib%{name}-devel Summary: Static libraries and headers for lua Group: Development/Libraries -Requires: %{libname} = %{?epoch:%epoch:}%{version}-%{release} +Requires: %{name} = %{?epoch:%epoch:}%{version}-%{release} +Requires: lib%{name} = %{?epoch:%epoch:}%{version}-%{release} Provides: lua-devel = %{?epoch:%epoch:}%{version}-%{release} Obsoletes: lua-devel < 5.4.3 -%description -n %{libname}-devel +%description -n lib%{name}-devel Lua is a powerful light-weight programming language designed for extending applications. -This package contains static libraries and header files need for development. +This package contains static libraries and header files needed for development. %debug_package %prep -%setup -q -#%patch0 -p1 -b .dynlib -#%patch1 -p1 -b .luapc -#%patch2 -p1 +%setup -q -c +cd lua-%{version} %patch 3 -p1 -b .shared_library +cd .. + +cp -r lua-%{version} lua++-%{version} %build -%make MYCFLAGS="$CFLAGS -fPIC -DLUA_COMPAT_5_2 -DLUA_COMPAT_5_1" MYLDFLAGS="$LDFLAGS -ltermcap" linux-readline -#%make -j1 -C src \ -# CC=%{_host}-gcc \ -# MYCFLAGS="$RPM_OPT_FLAGS -fPIC -DLUA_COMPAT_5_2 -DLUA_COMPAT_5_1" -DLUA_USE_LINUX" \ -# make MYCFLAGS="$CFLAGS -fPIC MYLDFLAGS="$LDFLAGS" linux -# MYLIBS="-Wl,-E -ldl -lreadline -lhistory -lncurses" V=%{libmajver} all +cd lua-%{version} +%make MYCFLAGS="%{optflags} -fPIC" MYLDFLAGS="" linux-readline + +cd ../lua++-%{version} +%make MYCFLAGS="%{optflags} -fPIC" MYLDFLAGS="" CC=g++ LUA_A=liblua++.a LUA_SO=liblua++.so linux-readline %install [ "%{buildroot}" != / ] && rm -rf %{buildroot} +cd lua-%{version} + %makeinstall \ + TO_LIB="liblua.so liblua.so.%{libmajver} liblua.so.%{version}" \ + INSTALL_DATA='cp -d' \ INSTALL_TOP=%{buildroot}%{_prefix} \ INSTALL_INC=%{buildroot}%{_includedir}/lua%{libmajver} \ INSTALL_LIB=%{buildroot}%{_libdir} \ INSTALL_MAN=%{buildroot}%{_mandir}/man1 -install -d %{buildroot}%{_datadir}/lua -#install -m 644 test/*.lua %{buildroot}%{_datadir}/lua +ln -sf lua %{buildroot}%{_bindir}/lua-%{libmajver} +ln -sf luac %{buildroot}%{_bindir}/luac-%{libmajver} +ln -sf liblua.so.%{version} %{buildroot}%{_libdir}/liblua%{libmajver}.so +ln -sf liblua.so.%{libmajver} %{buildroot}%{_libdir}/liblua.so -install -d %{buildroot}%{_libdir} -install -m 755 src/liblua.so.%{libmajver} %{buildroot}%{_libdir} -ln -s liblua.so.%{libmajver} %{buildroot}%{_libdir}/liblua.so - -#install -D -m644 etc/lua.pc %{buildroot}%{_libdir}/pkgconfig/lua.pc install -d %{buildroot}%{_libdir}/pkgconfig/ echo "\ prefix=%{_prefix} +INSTALL_BIN=%{_bindir} +INSTALL_INC=%{_includedir} +INSTALL_LIB=%{_libdir} +INSTALL_MAN=%{_mandir}/man1 +INSTALL_LMOD=%{_datadir}/lua/%{libmajver} +INSTALL_CMOD=%{_libdir}/lua/%{libmajver} exec_prefix=%{_exec_prefix} libdir=%{_libdir} includedir=%{_includedir}/lua%{libmajver} @@ -108,40 +100,72 @@ Name: Lua Description: An Extensible Extension Language Version: 5.4.6 Requires: -Libs: -L%{_libdir} -llua -lm -lreadline +Libs: -L%{_libdir} -llua -lm Cflags: -I%{_includedir}/lua%{libmajver}" > \ - %{buildroot}%{_libdir}/pkgconfig/lua.pc + %{buildroot}%{_libdir}/pkgconfig/lua%{libmajver}.pc + +ln -s lua%{libmajver}.pc %{buildroot}%{_libdir}/pkgconfig/lua.pc +ln -s lua%{libmajver}.pc %{buildroot}%{_libdir}/pkgconfig/lua-%{libmajver}.pc + +cd ../lua++-%{version} +%makeinstall \ + TO_LIB="liblua++.so liblua++.so.%{libmajver} liblua++.so.%{version}" \ + INSTALL_DATA='cp -d' \ + INSTALL_BIN=null \ + INSTALL_INC=null \ + INSTALL_MAN=../null \ + INSTALL_TOP=%{buildroot}%{_prefix} \ + INSTALL_LIB=%{buildroot}%{_libdir} \ + +ln -sf liblua++.so.%{version} %{buildroot}%{_libdir}/liblua++%{libmajver}.so + +cp %{buildroot}%{_libdir}/pkgconfig/lua%{libmajver}.pc %{buildroot}%{_libdir}/pkgconfig/lua++%{libmajver}.pc +sed -i "s|-llua|-llua++|g" %{buildroot}%{_libdir}/pkgconfig/lua++%{libmajver}.pc +ln -s lua++%{libmajver}.pc %{buildroot}%{_libdir}/pkgconfig/lua++.pc +ln -s lua++%{libmajver}.pc %{buildroot}%{_libdir}/pkgconfig/lua++-%{libmajver}.pc %clean [ "%{buildroot}" != / ] && rm -rf %{buildroot} -%post -n %{libname} -p /sbin/ldconfig -%postun -n %{libname} -p /sbin/ldconfig +%post -n lib%{name} -p /sbin/ldconfig +%postun -n lib%{name} -p /sbin/ldconfig %files %defattr(-,root,root) %{_bindir}/lua %{_bindir}/luac -%dir %{_datadir}/lua -#%{_datadir}/lua/*.lua +%{_bindir}/lua-%{libmajver} +%{_bindir}/luac-%{libmajver} %{_mandir}/man1/lua.* %{_mandir}/man1/luac.* -%files -n %{libname} +%files -n lib%{name} %defattr(-,root,root) %{_libdir}/liblua.so.* +%{_libdir}/liblua++.so.* -%files -n %{libname}-devel +%files -n lib%{name}-devel %defattr(-,root,root) %dir %{_includedir}/lua%{libmajver} %{_includedir}/lua%{libmajver}/*.h %{_includedir}/lua%{libmajver}/*.hpp -%{_libdir}/liblua.a +#%{_libdir}/liblua.a %{_libdir}/liblua.so +%{_libdir}/liblua%{libmajver}.so +%{_libdir}/liblua++.so +%{_libdir}/liblua++%{libmajver}.so %{_libdir}/pkgconfig/lua.pc -%doc README doc/*.html doc/*.css doc/*.gif doc/*.png +%{_libdir}/pkgconfig/lua-%{libmajver}.pc +%{_libdir}/pkgconfig/lua%{libmajver}.pc +%{_libdir}/pkgconfig/lua++.pc +%{_libdir}/pkgconfig/lua++-%{libmajver}.pc +%{_libdir}/pkgconfig/lua++%{libmajver}.pc +#%doc README doc/*.html doc/*.css doc/*.gif doc/*.png %changelog +* Fri Feb 09 2024 Silvan Calarco 5.4.6-2mamba +- added c++ library; pkgconfig files and other improvements + * Mon May 15 2023 Automatic Build System 5.4.6-1mamba - automatic version update by autodist