File perl-Capture-Tiny.spec of Package perl-Capture-Tiny

#
# spec file for module Capture::Tiny
#

#SuSe specific Part
%if %{?sles_version:1}0
%define module_dir      /usr/lib/perl5/
%define man3_dir        /usr/share/man/man3/

%if 0%{?suse_version} >= 1315
%define auto_dir        /usr/lib/perl5/vendor_perl/5.18.2/x86_64-linux-thread-multi/auto
%define sub_dir         /5.18.2/
%else
%define auto_dir        /usr/lib/perl5/vendor_perl/5.10.0/x86_64-linux-thread-multi/auto/
#suse prefers to install additional modules in a subdir (below module_dir)
%define sub_dir         /5.10.0/
%endif
%endif

#RedHat specific Part
%if %{?rhel_version:1}0
%define module_dir      /usr/share/perl5/
%define man3_dir        /usr/share/man/man3/
%define auto_dir        /usr/lib64/perl5/vendor_perl/auto/
#no subdir for redhat
%define sub_dir         /
BuildRequires:		perl-ExtUtils-MakeMaker perl-version-new
requires:		perl-version-new
%endif

%if %{?centos_version:1}0
%define init                    1
BuildRequires:  perl-ExtUtils-MakeMaker perl-version-new
Requires:       perl-Test-Simple perl-version-new
%define module_dir      /usr/share/perl5
%define sub_dir         /
%define man3_dir        /usr/share/man/man3
%define auto_dir        /usr/lib64/perl5/vendor_perl/auto/
%endif


#all Distros
%define module_name	Capture-Tiny
%define	module_version	0.28
Name:           perl-%{module_name}
Version:        %{module_version}
Release:	0
License:	other
Summary:	Capture STDOUT and STDERR from Perl, XS or external programs
Url:		https://metacpan.org/pod/Capture::Tiny	
Group:		perl/modules
Source:         %{module_name}-%{module_version}.tar.gz
BuildRequires:	perl
Requires:	perl
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
Capture::Tiny provides a simple, portable way to capture almost anything sent to STDOUT or STDERR, regardless of whether it comes from Perl, from XS code or from an external program. Optionally, output can be teed so that it is captured while being passed through to the original filehandles. Yes, it even works on Windows (usually). Stop guessing which of a dozen capturing modules to use in any particular situation and just use this one.

%prep
cd %{_builddir}
tar -xf %{_sourcedir}/%{module_name}-%{module_version}.tar.gz

%build
cd %{_builddir}/%{module_name}-%{module_version}
perl Makefile.PL INSTALLMAN3DIR=%{man3_dir}
#osc prevents using site_perl
perl -i -pe 's{/site_perl/}{/vendor_perl/}g' Makefile
make %{?_smp_mflags}

%install
cd %{_builddir}/%{module_name}-%{module_version}
make DESTDIR=%{buildroot} pure_vendor_install

find %{buildroot} -type f -name ".packlist" -exec rm -f {} \;
perl -i -pe "s{%{buildroot}}{}g" %{buildroot}%{auto_dir}Capture/Tiny/.packlist
					

find %{buildroot} -type f -name "perllocal.pod" -exec rm -f {} \;
#if [ -f %{buildroot}/usr/lib/perl5/5.10.0/x86_64-linux-thread-multi/perllocal.pod ]; then
#	rm -rf %{buildroot}/usr/lib/perl5/5.10.0/x86_64-linux-thread-multi/perllocal.pod
#fi

#if [ -f %{buildroot}/usr/lib64/perl5/perllocal.pod ]; then
#	rm -rf %{buildroot}/usr/lib64/perl5/perllocal.pod
#fi

%changelog

%files
%defattr(-,root,root)
%dir %{module_dir}/vendor_perl/%{sub_dir}/Capture/
%dir %{auto_dir}/Capture/
%dir %{auto_dir}/Capture/Tiny/

%{module_dir}/vendor_perl/%{sub_dir}/Capture/Tiny.pm
#%{auto_dir}/Capture/Tiny/.packlist
%{man3_dir}/Capture::Tiny.3pm.gz


openSUSE Build Service is sponsored by