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

#
# spec file for module Path::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
%endif

%if %{?centos_version:1}0
%define init                    1
%if 0%{?centos_version} == 700
BuildRequires:  perl-ExtUtils-MakeMaker perl-ExtUtils-CBuilder perl-Test-Simple
Requires:       perl-Test-Simple perl-ExtUtils-CBuilder
%else
BuildRequires:  perl-ExtUtils-MakeMaker perl-ExtUtils-CBuilder perl-Test-Simple perl-version-new
Requires:       perl-Test-Simple perl-ExtUtils-CBuilder perl-version-new
%endif
%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

#Fedora specific Part
%if %{?fedora_version:1}0
%endif

#all Distros
%define module_name	Path-Tiny
%define	module_version	0.104
Name:           perl-%{module_name}
Version:        %{module_version}
Release:	0
License:	other	
Summary:	This module provide a small, fast utility for working with file paths	
Url:		https://metacpan.org/pod/Nagios::Plugin
Group:		perl/modules
Source:         %{module_name}-%{module_version}.tar.gz
BuildRequires:	perl
Requires:	perl perl-Math-Calc-Units perl-Config-Tiny perl-Class-Accessor
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description

%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
make %{?_smp_mflags}

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

perl -i -pe "s{%{buildroot}}{}g" %{buildroot}%{auto_dir}Path/Tiny/.packlist
find %{buildroot} -type f -name ".packlist" -exec rm -f {} \;
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}Path
%dir %{auto_dir}/Path
%dir %{auto_dir}/Path/Tiny

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