# Detect the distribution in use
%global __despace head -n 1 | tr -d '[:space:]' | sed -e 's/[(].*[)]//g'
%global __lower4 cut -c 1-4 | tr '[:upper:]' '[:lower:]'
%global __distfile %([ -f /etc/SuSE-release ] && echo /etc/SuSE-release || echo /etc/redhat-release)
%global __distinit %(sed -e 's/ release .*//' -e 's/\\([A-Za-z]\\)[^ ]*/\\1/g' %{__distfile} | %{__despace} | %{__lower4})
%global __distvers %(sed -e 's/.* release \\([^. ]*\\).*/\\1/' %{__distfile} | %{__despace})
# Identify Alma, CentOS, CentOS Stream and Rocky Linux as rhel
%if "%{__distinit}" == "a" || "%{__distinit}" == "c" || "%{__distinit}" == "cl" || "%{__distinit}" == "cs" || "%{__distinit}" == "rl"
%global __distinit rhel
%endif
# Dist tag for Fedora is still "fc"
%if "%{__distinit}" == "f"
%global __distinit fc
%endif

Name:		perl-PerlIO-gzip
Version:	0.20
Release:	26.%{__distinit}%{__distvers}
Summary:	Perl extension to provide a PerlIO layer to gzip/gunzip
License:	GPL-1.0-or-later OR Artistic-1.0-Perl
URL:		https://metacpan.org/release/PerlIO-gzip
Source0:	https://cpan.metacpan.org/modules/by-module/PerlIO/PerlIO-gzip-%{version}.tar.gz
# Module Build
BuildRequires:	coreutils
BuildRequires:	findutils
BuildRequires:	gcc
BuildRequires:	make
BuildRequires:	perl-devel
BuildRequires:	perl-generators
BuildRequires:	perl-interpreter
BuildRequires:	perl(Config)
BuildRequires:	perl(ExtUtils::MakeMaker)
BuildRequires:	zlib-devel
# Module Runtime
BuildRequires:	perl(strict)
BuildRequires:	perl(warnings)
BuildRequires:	perl(XSLoader)
# Test Suite
BuildRequires:	perl(File::Compare)
BuildRequires:	perl(File::Spec)
BuildRequires:	perl(Test::More)
# Dependencies
%if 0%{?fedora} < 38 && 0%{?rhel} < 10
Requires:	perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version))
%endif
Requires:	perl(:WITH_PERLIO)

# Avoid provides from private perl objects
%{?perl_default_filter}

%description
PerlIO::gzip provides a PerlIO layer that manipulates files in the format
used by the gzip program. Compression and decompression are implemented.

This is akin to Compress::Zlib, except that it operates at the lower PerlIO
layer.

%prep
%setup -q -n PerlIO-gzip-%{version}

%build
perl Makefile.PL INSTALLDIRS=vendor OPTIMIZE="%{optflags}"
make %{?_smp_mflags}

%install
make pure_install DESTDIR=%{buildroot}
find %{buildroot} -type f -name .packlist -delete
find %{buildroot} -type f -name '*.bs' -empty -delete
%{_fixperms} -c %{buildroot}

%check
make test

%files
%doc Changes README
%{perl_vendorarch}/auto/PerlIO/
%{perl_vendorarch}/PerlIO/
%{_mandir}/man3/PerlIO::gzip.3*

%changelog
* Wed Jun 12 2024 Paul Howarth <paul@city-fan.org> - 0.20-26
- Perl 5.40 rebuild

* Tue Jul 11 2023 Paul Howarth <paul@city-fan.org> - 0.20-22
- Perl 5.38 rebuild

* Tue May  9 2023 Paul Howarth <paul@city-fan.org> - 0.20-21
- Use SPDX-format license tag

* Tue May 31 2022 Paul Howarth <paul@city-fan.org> - 0.20-18
- Perl 5.36 rebuild

* Fri May 21 2021 Paul Howarth <paul@city-fan.org> - 0.20-15
- Perl 5.34 rebuild

* Wed Jun 24 2020 Paul Howarth <paul@city-fan.org> - 0.20-12
- Perl 5.32 rebuild

* Thu May 30 2019 Paul Howarth <paul@city-fan.org> - 0.20-8
- Perl 5.30 rebuild

* Wed Jun 27 2018 Paul Howarth <paul@city-fan.org> - 0.20-5
- Perl 5.28 rebuild

* Mon Aug  7 2017 Paul Howarth <paul@city-fan.org> - 0.20-3
- BR: perl-generators unconditionally
- BR: perl-interpreter rather than perl

* Thu Jun 22 2017 Paul Howarth <paul@city-fan.org> - 0.20-1
- Update to 0.20
  - Fix test skip count on Win32 (CPAN RT#76335)
- Drop UTF8 docs patch; issue fixed upstream
- Drop support for EOL distributions prior to F-13
  - Drop BuildRoot: and Group: tags
  - Drop explicit buildroot cleaning in %%install section
  - Drop explicit %%clean section
  - BR: perl-devel unconditionally

* Tue Sep 20 2016 Paul Howarth <paul@city-fan.org> - 0.19-6
- BR: perl-devel and perl-generators where available
- Simplify find commands using -empty and -delete

* Mon Jun 15 2015 Paul Howarth <paul@city-fan.org> - 0.19-2
- Perl 5.22 rebuild

* Sun Mar  1 2015 Paul Howarth <paul@city-fan.org> - 0.19-1
- Update to 0.19
  - usesfio config removal (CPAN RT#92412)
  - printf format mismatch (CPAN RT#92031)
- Drop upstreamed fix for CPAN RT#92412

* Tue Feb 10 2015 Paul Howarth <paul@city-fan.org> - 0.18-22
- Import from Fedora

* Wed Aug 27 2014 Jitka Plesnikova <jplesnik@redhat.com> - 0.18-21
- Perl 5.20 rebuild

* Sun Aug 17 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.18-20
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild

* Fri Aug 01 2014 Jitka Plesnikova <jplesnik@redhat.com> - 0.18-19
- Fix RT#92412

* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.18-18
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.18-17
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

* Wed Jul 17 2013 Petr Pisar <ppisar@redhat.com> - 0.18-16
- Perl 5.18 rebuild

* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.18-15
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild

* Fri Jul 20 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.18-14
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild

* Fri Jun 08 2012 Petr Pisar <ppisar@redhat.com> - 0.18-13
- Perl 5.16 rebuild

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

* Wed Jun 15 2011 Marcela Mašláňová <mmaslano@redhat.com> - 0.18-11
- Perl mass rebuild

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

* Tue Dec 21 2010 Marcela Maslanova <mmaslano@redhat.com> - 0.18-9
- Rebuild to fix problems with vendorarch/lib (#661697)

* Tue May 04 2010 Marcela Maslanova <mmaslano@redhat.com> - 0.18-8
- Mass rebuild with perl-5.12.0

* Mon Dec  7 2009 Stepan Kasal <skasal@redhat.com> - 0.18-7
- Rebuild against perl 5.10.1

* Fri Aug 28 2009 Chris Weyl <cweyl@alumni.drew.edu> - 0.18-6
- Bump

* Thu Aug 27 2009 Chris Weyl <cweyl@alumni.drew.edu> - 0.18-5
- Update filtering

* Sun Jul 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.18-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

* Sat Feb 28 2009 Chris Weyl <cweyl@alumni.drew.edu> - 0.18-3
- Strip private Perl libs from autoprov output

* Thu Feb 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.18-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild

* Wed Jul 16 2008 Chris Weyl <cweyl@alumni.drew.edu> - 0.18-1
- Specfile autogenerated by cpanspec 1.74