22bf4e0
%{!?luaver: %global luaver %(lua -e "print(string.sub(_VERSION, 5))" || echo 0)}
22bf4e0
%global lualibdir %{_libdir}/lua/%{luaver}
22bf4e0
%global luapkgdir %{_datadir}/lua/%{luaver}
22bf4e0
22bf4e0
%global luacompatver 5.1
22bf4e0
%global luacompatlibdir %{_libdir}/lua/%{luacompatver}
22bf4e0
%global luacompatpkgdir %{_datadir}/lua/%{luacompatver}
22bf4e0
b2233c6
%global luapkgname cqueues
b2233c6
b2233c6
Name:           lua-%{luapkgname}
5d7117c
Version:        20200603
f0e9a09
Release:        2%{?dist}
22bf4e0
Summary:        Stackable Continuation Queues for the Lua Programming Language
22bf4e0
22bf4e0
License:        MIT
39265da
URL:            https://github.com/wahern/%{luapkgname}
39265da
Source0:        https://github.com/wahern/%{luapkgname}/archive/rel-%{version}/%{name}-%{version}.tar.gz
5d7117c
Patch0:         lua-cqueues-20200603-lua-5.4.patch
98fdd07
BuildRequires:  gcc
98fdd07
BuildRequires:  m4
98fdd07
BuildRequires:  make
98fdd07
BuildRequires:  openssl-devel
7f38b77
BuildRequires:  lua
22bf4e0
BuildRequires:  lua-devel >= %{luaver}
98fdd07
7f38b77
%if 0%{?fedora} || 0%{?rhel} > 7
5d7117c
# BuildRequires:  compat-lua
7f38b77
BuildRequires:  compat-lua-devel
22bf4e0
%endif
22bf4e0
7f38b77
Requires:       lua(abi) = %{luaver}
7f38b77
22bf4e0
%description
22bf4e0
cqueues is a type of event loop for Lua. It doesn't use callbacks but instead
22bf4e0
you communicate with an event controller by the yielding and resumption of
22bf4e0
Lua coroutines using objects.
22bf4e0
22bf4e0
cqueues are stackable. Each instantiated cqueue is a poll-able object which
22bf4e0
can be polled from another cqueue, or another event loop system entirely.
22bf4e0
The design is meant to be non-intrusive, composable, and embeddable within
22bf4e0
existing applications.
22bf4e0
22bf4e0
cqueues includes a sockets library with DNS, buffering, end-of-line
22bf4e0
translation, SSL/TLS, and descriptor passing support builtin.
22bf4e0
Domain querying, connection establishment, and SSL negotiation are handled
22bf4e0
transparently as part of a state machine entered with every I/O operation,
22bf4e0
so users can read and write immediately upon instantiating the object,
22bf4e0
as if opening a regular file.
22bf4e0
22bf4e0
cqueues also includes modules for handling signals, threads, and file change
22bf4e0
notifications using native kernel facilities and accessible through easy
22bf4e0
to use interfaces which abstract the different kernel facilities.
22bf4e0
39265da
%if 0%{?fedora} || 0%{?rhel} > 7
b2233c6
%package -n lua%{luacompatver}-%{luapkgname}
22bf4e0
Summary:        Stackable Continuation Queues for the Lua Programming Language %{luacompatver}
39265da
Requires:       compat-lua-libs
39265da
39265da
# NOTE: remove Provides after F31 end of life
39265da
%if 0%{?fedora} < 32 && "x%{?rhel}" == "x"
b2233c6
Provides:       lua-%{luapkgname}-compat
b2233c6
Provides:       compat-lua-%{luapkgname}
39265da
%endif
22bf4e0
b2233c6
%description -n lua%{luacompatver}-%{luapkgname}
22bf4e0
Compatibility package for Lua %{luacompatver}
22bf4e0
%endif
22bf4e0
22bf4e0
%package doc
22bf4e0
Summary:        Documentation for the Stackable Continuation Queues library
22bf4e0
BuildArch:      noarch
22bf4e0
# Conflicts: {name} != {version} + compat-{name} != {version} would have been better
22bf4e0
# but I'm trying to avoid Conflicts
22bf4e0
Requires:       %{name} == %{version}
22bf4e0
22bf4e0
%description doc
22bf4e0
Documentation for the Stackable Continuation Queues library
22bf4e0
for the Lua Programming Language
22bf4e0
22bf4e0
%prep
39265da
%setup -q -n %{luapkgname}-rel-%{version}
5d7117c
%patch0 -p1 -b .lua54
22bf4e0
22bf4e0
%build
39265da
export CFLAGS="%{?optflags} -fPIC"
39265da
export LDFLAGS="%{?build_ldflags}"
7f38b77
make LUA_APIS="%{luaver}" %{?_smp_mflags} prefix=%{_prefix} libdir=%{_libdir}
22bf4e0
39265da
%if 0%{?fedora} || 0%{?rhel} > 7
7f38b77
make LUA_APIS="%{luacompatver}" %{?_smp_mflags} prefix=%{_prefix} libdir=%{_libdir} CFLAGS="$CFLAGS -I%{_includedir}/lua-%{luacompatver}"
22bf4e0
%endif
22bf4e0
22bf4e0
%install
22bf4e0
make install LUA_APIS="%{luaver}" DESTDIR=%{buildroot} prefix=%{_prefix} libdir=%{_libdir}
22bf4e0
39265da
%if 0%{?fedora} || 0%{?rhel} > 7
22bf4e0
make install LUA_APIS="%{luacompatver}" DESTDIR=%{buildroot} prefix=%{_prefix} libdir=%{_libdir}
22bf4e0
%endif
22bf4e0
22bf4e0
# documentation
22bf4e0
mkdir -p %{buildroot}%{_pkgdocdir}
22bf4e0
cp -r -t %{buildroot}%{_pkgdocdir} doc/cqueues.pdf examples
22bf4e0
sed -i '1 s|^#!/.*$|#!/usr/bin/lua|' %{buildroot}%{_pkgdocdir}/examples/*
22bf4e0
22bf4e0
#% check
22bf4e0
## Lua openssl package is missing
22bf4e0
#make check -j1
22bf4e0
22bf4e0
%files
22bf4e0
%{luapkgdir}/*
22bf4e0
%{lualibdir}/*
22bf4e0
%license LICENSE
22bf4e0
39265da
%if 0%{?fedora} || 0%{?rhel} > 7
b2233c6
%files -n lua%{luacompatver}-%{luapkgname}
22bf4e0
%{luacompatpkgdir}/*
22bf4e0
%{luacompatlibdir}/*
22bf4e0
%license LICENSE
22bf4e0
%endif
22bf4e0
22bf4e0
%files doc
22bf4e0
# force examples to be non-executable to avoid potential mess in autogenerated deps
22bf4e0
%defattr(644,root,root,755)
98fdd07
%doc %{_pkgdocdir}/*
22bf4e0
%license LICENSE
22bf4e0
22bf4e0
%changelog
f0e9a09
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 20200603-2
f0e9a09
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
f0e9a09
5d7117c
* Tue Jun 30 2020 Tom Callaway <spot@fedoraproject.org> - 20200603-1
5d7117c
- update to 20200603
5d7117c
- add support for lua 5.4
5d7117c
f36bc13
* Tue Jun 30 2020 Björn Esser <besser82@fedoraproject.org> - 20190813-4
f36bc13
- Rebuilt for Lua 5.4
f36bc13
0af59af
* Wed Feb 05 2020 Tomas Krizek <tomas.krizek@nic.cz> - 20190813-3
0af59af
- Add patch to mark cqueues__poll as extern
0af59af
96270c4
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 20190813-2
96270c4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
96270c4
39265da
* Mon Oct 21 2019 Tomas Krizek <tomas.krizek@nic.cz> - 20190813-1
39265da
- Make spec EPEL8 compatible
39265da
- Update to latest upstream version, BZ#1735765
39265da
34d966a
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 20171014-7
34d966a
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
34d966a
b2233c6
* Tue Apr 16 2019 Tomas Krizek <tomas.krizek@nic.cz> - 20171014-6
b2233c6
- Use lua5.1-cqueues for Lua 5.1 package name
b2233c6
  https://pagure.io/packaging-committee/issue/878
b2233c6
7f38b77
* Wed Apr 10 2019 Tomas Krizek <tomas.krizek@nic.cz> - 20171014-5
7f38b77
- Re-add compat-lua-devel needed for 5.1 build
7f38b77
98fdd07
* Thu Apr 04 2019 Tomas Krizek <tomas.krizek@nic.cz> - 20171014-4
98fdd07
- Compatibility patch for GCC 9, fixes BZ#1675333
98fdd07
- Clean up BuildRequires/Requires
98fdd07
35e42b0
* Thu Apr 04 2019 Tomas Krizek <tomas.krizek@nic.cz> - 20171014-3
35e42b0
- Change compat package name to compat-lua-cqueues
35e42b0
0e7ee3e
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 20171014-2
0e7ee3e
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
0e7ee3e
e0d3466
* Fri Jan 11 2019 Petr Špaček <petr.spacek@nic.cz> - 20171014-1
e0d3466
- Rebuild for released Fedora/CentOS versions (fedpkg update was missing)
e0d3466
22bf4e0
* Thu Sep 13 2018 Petr Špaček <petr.spacek@nic.cz> - 20171014-0
22bf4e0
- Initial package for Fedora 28+ and EPEL 7