Blob Blame History Raw
%{!?luaver: %global luaver %(lua -e "print(string.sub(_VERSION, 5))" || echo 0)}
%global lualibdir %{_libdir}/lua/%{luaver}
%global luapkgdir %{_datadir}/lua/%{luaver}

%global luacompatver 5.1
%global luacompatlibdir %{_libdir}/lua/%{luacompatver}
%global luacompatpkgdir %{_datadir}/lua/%{luacompatver}

%global luapkgname cqueues

Name:           lua-%{luapkgname}
Version:        20200603
Release:        11%{?dist}
Summary:        Stackable Continuation Queues for the Lua Programming Language

License:        MIT
URL:            https://github.com/wahern/%{luapkgname}
Source0:        https://github.com/wahern/%{luapkgname}/archive/rel-%{version}/%{name}-%{version}.tar.gz
Patch0:         lua-cqueues-20200603-lua-5.4.patch
BuildRequires:  gcc
BuildRequires:  m4
BuildRequires:  make
BuildRequires:  openssl-devel
BuildRequires:  lua
BuildRequires:  lua-devel >= %{luaver}

%if 0%{?fedora} || 0%{?rhel} > 7
# BuildRequires:  compat-lua
BuildRequires:  compat-lua-devel
%endif

Requires:       lua(abi) = %{luaver}

%description
cqueues is a type of event loop for Lua. It doesn't use callbacks but instead
you communicate with an event controller by the yielding and resumption of
Lua coroutines using objects.

cqueues are stackable. Each instantiated cqueue is a poll-able object which
can be polled from another cqueue, or another event loop system entirely.
The design is meant to be non-intrusive, composable, and embeddable within
existing applications.

cqueues includes a sockets library with DNS, buffering, end-of-line
translation, SSL/TLS, and descriptor passing support builtin.
Domain querying, connection establishment, and SSL negotiation are handled
transparently as part of a state machine entered with every I/O operation,
so users can read and write immediately upon instantiating the object,
as if opening a regular file.

cqueues also includes modules for handling signals, threads, and file change
notifications using native kernel facilities and accessible through easy
to use interfaces which abstract the different kernel facilities.

%if 0%{?fedora} || 0%{?rhel} > 7
%package -n lua%{luacompatver}-%{luapkgname}
Summary:        Stackable Continuation Queues for the Lua Programming Language %{luacompatver}
Requires:       compat-lua-libs

# NOTE: remove Provides after F31 end of life
%if 0%{?fedora} < 32 && "x%{?rhel}" == "x"
Provides:       lua-%{luapkgname}-compat
Provides:       compat-lua-%{luapkgname}
%endif

%description -n lua%{luacompatver}-%{luapkgname}
Compatibility package for Lua %{luacompatver}
%endif

%package doc
Summary:        Documentation for the Stackable Continuation Queues library
BuildArch:      noarch
# Conflicts: {name} != {version} + compat-{name} != {version} would have been better
# but I'm trying to avoid Conflicts
Requires:       %{name} == %{version}

%description doc
Documentation for the Stackable Continuation Queues library
for the Lua Programming Language

%prep
%setup -q -n %{luapkgname}-rel-%{version}
%patch0 -p1 -b .lua54

%build
export CFLAGS="%{?optflags} -fPIC"
export LDFLAGS="%{?build_ldflags}"
make LUA_APIS="%{luaver}" %{?_smp_mflags} prefix=%{_prefix} libdir=%{_libdir}

%if 0%{?fedora} || 0%{?rhel} > 7
make LUA_APIS="%{luacompatver}" %{?_smp_mflags} prefix=%{_prefix} libdir=%{_libdir} CFLAGS="$CFLAGS -I%{_includedir}/lua-%{luacompatver}"
%endif

%install
make install LUA_APIS="%{luaver}" DESTDIR=%{buildroot} prefix=%{_prefix} libdir=%{_libdir}

%if 0%{?fedora} || 0%{?rhel} > 7
make install LUA_APIS="%{luacompatver}" DESTDIR=%{buildroot} prefix=%{_prefix} libdir=%{_libdir}
%endif

# documentation
mkdir -p %{buildroot}%{_pkgdocdir}
cp -r -t %{buildroot}%{_pkgdocdir} doc/cqueues.pdf examples
sed -i '1 s|^#!/.*$|#!/usr/bin/lua|' %{buildroot}%{_pkgdocdir}/examples/*

#% check
## Lua openssl package is missing
#make check -j1

%files
%{luapkgdir}/*
%{lualibdir}/*
%license LICENSE

%if 0%{?fedora} || 0%{?rhel} > 7
%files -n lua%{luacompatver}-%{luapkgname}
%{luacompatpkgdir}/*
%{luacompatlibdir}/*
%license LICENSE
%endif

%files doc
# force examples to be non-executable to avoid potential mess in autogenerated deps
%defattr(644,root,root,755)
%doc %{_pkgdocdir}/*
%license LICENSE

%changelog
* Thu Jan 25 2024 Fedora Release Engineering <releng@fedoraproject.org> - 20200603-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Sun Jan 21 2024 Fedora Release Engineering <releng@fedoraproject.org> - 20200603-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Thu Jul 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 20200603-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild

* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 20200603-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild

* Thu Jul 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 20200603-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild

* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 20200603-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild

* Tue Sep 14 2021 Sahana Prasad <sahana@redhat.com> - 20200603-5
- Rebuilt with OpenSSL 3.0.0

* Thu Jul 22 2021 Fedora Release Engineering <releng@fedoraproject.org> - 20200603-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild

* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 20200603-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild

* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 20200603-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild

* Tue Jun 30 2020 Tom Callaway <spot@fedoraproject.org> - 20200603-1
- update to 20200603
- add support for lua 5.4

* Tue Jun 30 2020 Björn Esser <besser82@fedoraproject.org> - 20190813-4
- Rebuilt for Lua 5.4

* Wed Feb 05 2020 Tomas Krizek <tomas.krizek@nic.cz> - 20190813-3
- Add patch to mark cqueues__poll as extern

* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 20190813-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild

* Mon Oct 21 2019 Tomas Krizek <tomas.krizek@nic.cz> - 20190813-1
- Make spec EPEL8 compatible
- Update to latest upstream version, BZ#1735765

* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 20171014-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild

* Tue Apr 16 2019 Tomas Krizek <tomas.krizek@nic.cz> - 20171014-6
- Use lua5.1-cqueues for Lua 5.1 package name
  https://pagure.io/packaging-committee/issue/878

* Wed Apr 10 2019 Tomas Krizek <tomas.krizek@nic.cz> - 20171014-5
- Re-add compat-lua-devel needed for 5.1 build

* Thu Apr 04 2019 Tomas Krizek <tomas.krizek@nic.cz> - 20171014-4
- Compatibility patch for GCC 9, fixes BZ#1675333
- Clean up BuildRequires/Requires

* Thu Apr 04 2019 Tomas Krizek <tomas.krizek@nic.cz> - 20171014-3
- Change compat package name to compat-lua-cqueues

* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 20171014-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild

* Fri Jan 11 2019 Petr Špaček <petr.spacek@nic.cz> - 20171014-1
- Rebuild for released Fedora/CentOS versions (fedpkg update was missing)

* Thu Sep 13 2018 Petr Špaček <petr.spacek@nic.cz> - 20171014-0
- Initial package for Fedora 28+ and EPEL 7