[packages/lua-luv] add packages targeting lua51 and luajit

atler atler at pld-linux.org
Tue May 3 12:35:33 CEST 2022


commit e9f13859a9e95b5dd4bd1054239677d08c40463e
Author: Jan Palus <atler at pld-linux.org>
Date:   Tue May 3 01:39:27 2022 +0200

    add packages targeting lua51 and luajit

 lua-luv.spec | 135 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 134 insertions(+), 1 deletion(-)
---
diff --git a/lua-luv.spec b/lua-luv.spec
index 4ea599c..60f5088 100644
--- a/lua-luv.spec
+++ b/lua-luv.spec
@@ -1,5 +1,11 @@
+%bcond_without	lua51		# lua51 package
+%bcond_without	luajit		# lua51 package
+
 %global real_version 1.43.0
 %global extra_version 0
+
+%define		luajit_abi	2.1
+
 Summary:	Bare libuv bindings for lua
 Name:		lua-luv
 Version:	%{real_version}.%{extra_version}
@@ -8,6 +14,12 @@ License:	Apache v2.0
 BuildRequires:	cmake
 BuildRequires:	libuv-devel
 BuildRequires:	lua-devel >= 5.4
+%if %{with lua51}
+BuildRequires:	lua51-devel
+%endif
+%if %{with luajit}
+BuildRequires:	luajit-devel
+%endif
 Source0:	https://github.com/luvit/luv/releases/download/1.43.0-0/luv-1.43.0-0.tar.gz
 # Source0-md5:	294c7ea4d8d2e21414b90f1fb70182e9
 URL:		https://github.com/luvit/luv
@@ -32,11 +44,59 @@ Requires:	lua-luv = %{version}-%{release}
 %description devel
 Files required for lua-luv development
 
+%package -n lua51-luv
+Summary:	Bare libuv bindings for lua
+
+%description -n lua51-luv
+This library makes libuv available to lua scripts. It was made for the
+luvit project but should usable from nearly any lua project.
+
+The library can be used by multiple threads at once. Each thread is
+assumed to load the library from a different lua_State. Luv will
+create a unique uv_loop_t for each state. You can't share uv handles
+between states/loops.
+
+The best docs currently are the libuv docs themselves. Hopefully soon
+we'll have a copy locally tailored for lua.
+
+Package for Lua 5.1.
+
+%package -n lua51-luv-devel
+Summary:	Development files for lua51-luv
+Requires:	lua51-luv = %{version}-%{release}
+
+%description -n lua51-luv-devel
+Files required for lua51-luv development
+
+%package -n luajit-luv
+Summary:	Bare libuv bindings for lua
+
+%description -n luajit-luv
+This library makes libuv available to lua scripts. It was made for the
+luvit project but should usable from nearly any lua project.
+
+The library can be used by multiple threads at once. Each thread is
+assumed to load the library from a different lua_State. Luv will
+create a unique uv_loop_t for each state. You can't share uv handles
+between states/loops.
+
+The best docs currently are the libuv docs themselves. Hopefully soon
+we'll have a copy locally tailored for lua.
+
+Package for LuaJIT.
+
+%package -n luajit-luv-devel
+Summary:	Development files for luajit-luv
+Requires:	luajit-luv = %{version}-%{release}
+
+%description -n luajit-luv-devel
+Files required for luajit-luv development
+
 %prep
 %autosetup -n luv-%{real_version}-%{extra_version}
 
 # Remove bundled dependencies
-rm -r deps
+rm -r deps/{lua.cmake,luajit.cmake,libuv}
 # Remove network sensitive tests gh#luvit/luv#340
 rm -f tests/test-dns.lua
 
@@ -58,8 +118,35 @@ lua tests/run.lua
 rm luv.so
 %endif
 
+%if %{with lua51}
+%cmake -B build-lua51 \
+	-DWITH_SHARED_LIBUV=ON \
+	-DBUILD_MODULE=ON \
+	-DBUILD_SHARED_LIBS=ON \
+	-DWITH_LUA_ENGINE=Lua \
+	-DLUA_BUILD_TYPE=System \
+	-DINSTALL_LIB_DIR=%{_libdir} \
+	-DLUA_INCLUDE_DIR=%{_includedir}/lua5.1
+
+%{__make} -C build-lua51
+%endif
+
+%if %{with luajit}
+%cmake -B build-luajit \
+	-DWITH_SHARED_LIBUV=ON \
+	-DBUILD_MODULE=ON \
+	-DBUILD_SHARED_LIBS=ON \
+	-DWITH_LUA_ENGINE=LuaJIT \
+	-DLUA_BUILD_TYPE=System \
+	-DINSTALL_LIB_DIR=%{_libdir} \
+	-DLUA_INCLUDE_DIR=%{_includedir}/luajit-%{luajit_abi}
+
+%{__make} -C build-luajit
+%endif
+
 %install
 rm -rf $RPM_BUILD_ROOT
+
 install -d $RPM_BUILD_ROOT%{_libdir}/lua/5.4
 install -p build/luv.so $RPM_BUILD_ROOT%{_libdir}/lua/5.4/luv.so
 
@@ -68,6 +155,26 @@ for f in lhandle.h lreq.h luv.h util.h; do
 	install -m 0644 -p src/$f $RPM_BUILD_ROOT%{_includedir}/lua5.4/luv/$f
 done
 
+%if %{with lua51}
+install -d $RPM_BUILD_ROOT%{_libdir}/lua/5.1
+install -p build-lua51/luv.so $RPM_BUILD_ROOT%{_libdir}/lua/5.1/luv.so
+
+install -d $RPM_BUILD_ROOT%{_includedir}/lua5.1/luv
+for f in lhandle.h lreq.h luv.h util.h; do
+	install -m 0644 -p src/$f $RPM_BUILD_ROOT%{_includedir}/lua5.1/luv/$f
+done
+%endif
+
+%if %{with luajit}
+install -d $RPM_BUILD_ROOT%{_libdir}/luajit/%{luajit_abi}
+install -p build-luajit/luv.so $RPM_BUILD_ROOT%{_libdir}/luajit/%{luajit_abi}/luv.so
+
+install -d $RPM_BUILD_ROOT%{_includedir}/luajit-%{luajit_abi}/luv
+for f in lhandle.h lreq.h luv.h util.h; do
+	install -m 0644 -p src/$f $RPM_BUILD_ROOT%{_includedir}/luajit-%{luajit_abi}/luv/$f
+done
+%endif
+
 %clean
 rm -rf $RPM_BUILD_ROOT
 
@@ -83,3 +190,29 @@ rm -rf $RPM_BUILD_ROOT
 %{_includedir}/lua5.4/luv/lreq.h
 %{_includedir}/lua5.4/luv/luv.h
 %{_includedir}/lua5.4/luv/util.h
+
+%files -n lua51-luv
+%defattr(644,root,root,755)
+%doc README.md
+%attr(755,root,root) %{_libdir}/lua/5.1/luv.so
+
+%files -n lua51-luv-devel
+%defattr(644,root,root,755)
+%dir %{_includedir}/lua5.1/luv
+%{_includedir}/lua5.1/luv/lhandle.h
+%{_includedir}/lua5.1/luv/lreq.h
+%{_includedir}/lua5.1/luv/luv.h
+%{_includedir}/lua5.1/luv/util.h
+
+%files -n luajit-luv
+%defattr(644,root,root,755)
+%doc README.md
+%attr(755,root,root) %{_libdir}/luajit/%{luajit_abi}/luv.so
+
+%files -n luajit-luv-devel
+%defattr(644,root,root,755)
+%dir %{_includedir}/luajit-%{luajit_abi}/luv
+%{_includedir}/luajit-%{luajit_abi}/luv/lhandle.h
+%{_includedir}/luajit-%{luajit_abi}/luv/lreq.h
+%{_includedir}/luajit-%{luajit_abi}/luv/luv.h
+%{_includedir}/luajit-%{luajit_abi}/luv/util.h
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/lua-luv.git/commitdiff/818534641d73e5d98b5b6a65ed2c12c6ba0a147c



More information about the pld-cvs-commit mailing list