Name:           perl-Coro
Version:        6.57
Release:        1%{?_dist_release}
Summary:        The only real threads in perl
Group:          programming
Vendor:         Project Vine
Distribution:   Vine Linux

License:        GPL+ or Artistic
URL:            https://metacpan.org/pod/Coro
Source0:        https://cpan.metacpan.org/authors/id/M/ML/MLEHMANN/Coro-%{version}.tar.gz
Patch0:         %{name}-5.25-ucontext-default.patch

BuildRequires:  perl(Canary::Stability)
BuildRequires:  perl(AnyEvent)
BuildRequires:  perl(common::sense)
BuildRequires:  perl(ExtUtils::MakeMaker)
BuildRequires:  perl(Guard)
BuildRequires:  perl(Scalar::Util)
BuildRequires:  perl(Storable)
BuildRequires:  perl(Time::HiRes)
# Recommended optional modules
BuildRequires:  perl(AnyEvent::AIO)
BuildRequires:  perl(AnyEvent::BDB)
BuildRequires:  perl(BDB)
# perl-EV not packaged
BuildRequires:  perl(EV)
BuildRequires:  perl(Event)
BuildRequires:  perl(IO::AIO)
Requires:       perl
# Export correct required versions
Requires:       perl(AnyEvent)
Requires:       perl(AnyEvent::AIO)
Requires:       perl(AnyEvent::BDB)
Requires:       perl(EV)
Requires:       perl(Event)
Requires:       perl(Guard)
Requires:       perl(Storable)

%{?perl_default_filter}

# Filter underspecified dependencies
%global __requires_exclude %{?__requires_exclude:__requires_exclude|}^perl\\(AnyEvent\\)$
%global __requires_exclude %__requires_exclude|^perl\\(AnyEvent\\) >= 4.800001$
%global __requires_exclude %__requires_exclude|^perl\\(AnyEvent::AIO\\)$
%global __requires_exclude %__requires_exclude|^perl\\(AnyEvent::BDB\\)$
%global __requires_exclude %__requires_exclude|^perl\\(EV\\)$
%global __requires_exclude %__requires_exclude|^perl\\(Event\\)$
%global __requires_exclude %__requires_exclude|^perl\\(Guard\\)$
%global __requires_exclude %__requires_exclude|^perl\\(Storable\\)$
%global __requires_exclude %__requires_exclude|^perl\\(Coro\\)$
%global __provides_exclude %{?__provides_exclude:__provides_exclude|}^perl\\(Coro\\)$

%description
This module collection manages continuations in general, most often in the
form of cooperative threads (also called coros, or simply "coro" in the
documentation). They are similar to kernel threads but don't (in general) run
in parallel at the same time even on SMP machines. The specific flavor of
thread offered by this module also guarantees you that it will not switch
between threads unless necessary, at easily-identified points in your
program, so locking and parallel access are rarely an issue, making thread
programming much safer and easier than using other thread models.


%debug_package


%prep
%setup -q -n Coro-%{version}
# use ucontext backend on non-x86 (setjmp didn't work on s390(x))
%patch0 -p1 -b .ucontext-default

for F in Coro/jit-*.pl; do
    sed -i -e '/^#!/d' "$F"
    chmod -x "$F"
done

%global wrong_shbangs eg/myhttpd
%if %{defined fix_shbang_line}
%fix_shbang_line %wrong_shbangs
%else
# at least EL6 doesn't have the %%fix_shbang_line macro
sed -i -e '/^#!/ s|.*|#!%{__perl}|' %wrong_shbangs
%endif


%build
# Disable FORTIFY_SOURCE on ARM as it breaks setjmp - RHBZ 750805
%ifarch %{arm}
RPM_OPT_FLAGS=$(echo "${RPM_OPT_FLAGS}" | sed -e 's/-Wp,-D_FORTIFY_SOURCE=2/-D_FORTIFY_SOURCE=0/g')
%endif

# Interractive configuration. Use default values.
%{__perl} Makefile.PL INSTALLDIRS=perl NO_PACKLIST=1 NO_PERLLOCAL=1 \
	OPTIMIZE="$RPM_OPT_FLAGS" </dev/null
make %{?_smp_mflags}


%install
make pure_install PERL_INSTALL_ROOT=%{buildroot}
find %{buildroot} -type f -name '*.bs' -size 0 -delete
%{_fixperms} %{buildroot}/*


%check
make test


%files
%defattr(-,root,root,-)
%license COPYING
%doc Changes README README.linux-glibc
%doc doc/* eg
%{perl_archlib}/auto/*
%{perl_archlib}/Coro*
%{_mandir}/man3/*


%changelog
* Thu Nov 18 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 6.57-1
- new upstream release.
- rebuilt with perl-5.34.0.

* Fri May 17 2019 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 6.54-1
- new upstream release.
- rebuilt with perl-5.26.

* Mon Dec  1 2014 Ryoichi INAGAKI <ryo1@toki.waseda.jp> 6.41-1
- updated to 6.41

* Fri Jun 27 2014 IWAI, Masaharu <iwaim.sub@gmail.com> 6.07-2
- build with Perl 5.16

* Fri Mar 02 2012 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 6.07-1
- initial build for Vine Linux

* Tue Feb 21 2012 Peter Robinson <pbrobinson@fedoraproject.org> - 6.07-3
- Add patch to fix build on ARM. RHBZ 750805

* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 6.07-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild

* Fri Dec 09 2011 Petr Pisar <ppisar@redhat.com> - 6.07-1
- 6.07 bump

* Thu Nov 03 2011 Nicolas Chauvet <kwizart@gmail.com> - 6.06-2
- Fix ucontext on ARM - rhbz750805

* Fri Aug 12 2011 Petr Sabata <contyk@redhat.com> - 6.06-1
- 6.06 bump

* Fri Aug 05 2011 Petr Sabata <contyk@redhat.com> - 6.05-1
- 6.05 bump

* Thu Aug 04 2011 Petr Sabata <contyk@redhat.com> - 6.04-1
- 6.04 bump

* Fri Jul 29 2011 Petr Pisar <ppisar@redhat.com> - 6.02-1
- 6.02 bump
- Major version 6 breaks compatibility: Unreferenced coro objects will now be
  destroyed and cleaned up automatically (e.g. async { schedule }).

* Tue Jun 21 2011 Marcela Mašláňová <mmaslano@redhat.com> - 5.372-4
- Perl mass rebuild

* Fri Apr 08 2011 Mathieu Bridon <bochecha@fedoraproject.org> - 5.372-3
- Added explicit versionned Requires: on perl(EV)
- Removed automatically added unversionned Requires: on perl(EV)

* Thu Apr 07 2011 Mathieu Bridon <bochecha@fedoraproject.org> - 5.372-2
- Rebuild with EV support.

* Mon Mar 07 2011 Petr Pisar <ppisar@redhat.com> - 5.372-1
- 5.372 bump

* Mon Feb 21 2011 Petr Pisar <ppisar@redhat.com> - 5.37-1
- 5.37 bump
- Fix State.xs syntax (RT#65991)
- Version unversioned Provides

* Mon Feb 14 2011 Petr Pisar <ppisar@redhat.com> - 5.26-1
- 5.26 bump

* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 5.25-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild

* Fri Jan 21 2011 Mathieu Bridon <bochecha@fedoraproject.org> 5.25-3
- Allow building on systems without %%fix_shbang_line macro (needed for EL6)

* Mon Jan 10 2011 Dan Horák <dan[at]danny.cz> 5.25-2
- use ucontext backend on non-x86

* Tue Jan 04 2011 Petr Pisar <ppisar@redhat.com> 5.25-1
- 5.25 import
- Disable perl(EV) support as it's not packaged yet
