File ack.spec of Package ack

#
# spec file for package ack
#
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


%define	run_tests 0%{?suse_version} >= 1210
%if 0%{?suse_version} >= 1100 || 0%{?fedora} >= 13
%define with_pod 1
%else
%define with_pod 0
%endif
Name:           ack
Version:        2.15_01
Release:        0
Summary:        Grep-Like Text Finder
License:        Artistic-2.0
Group:          Productivity/Text/Utilities
Url:            http://beyondgrep.com/
Source:         http://cpan.metacpan.org/authors/id/P/PE/PETDANCE/ack-%{version}.tar.gz
Patch1:         ack-ignore-osc.patch
Patch3:         ack-add_spec.patch
BuildRequires:  make
BuildRequires:  perl >= 5.8.8
BuildRequires:  perl(File::Next) >= 1.10
Requires:       perl
Requires:       perl-App-Ack = %{version}-%{release}
Requires:       perl-base = %{perl_version}
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch
%{!?perl_make_install:  %global perl_make_install make DESTDIR=%{buildroot} install_vendor}
%if %{run_tests}
BuildRequires:  perl(File::Temp) >= 0.19
BuildRequires:  perl(IO::Pty)
%endif
%if %{with_pod}
BuildRequires:  perl(Test::Pod) >= 1.14
%endif

%description
ack is a grep-like tool tailored to working with large trees of source code.

%package -n perl-App-Ack
Summary:        Grep-Like Text Finder Perl Module
Group:          Development/Libraries/Perl
Requires:       perl(File::Next) >= 1.10
Requires:       perl-base = %{perl_version}

%description -n perl-App-Ack
App::Ack is a grep-like tool tailored to working with large trees of source
code.

%prep
%setup -q
%patch1 -p1
%patch3 -p1

%build
perl Makefile.PL
make %{?_smp_mflags}

%install
%perl_make_install

%if 0%{?perl_process_packlist:1}
%perl_process_packlist
%else
rm "%{buildroot}%{perl_archlib}/perllocal.pod"
%endif

# remove .packlist file
rm -rf "%{buildroot}%{perl_vendorarch}/auto/ack"

rm -f "%{buildroot}%{_localstatedir}/adm/perl-modules/ack"

install -d rpmdoc_ack
for f in Changes README.md LICENSE.md; do
    ln -s ../ack/"$f" rpmdoc_ack/"$f"
done

%check
%if %{run_tests}
make test %{?_smp_mflags}
%endif

%files
%defattr(-,root,root)
%doc rpmdoc_ack/*
%{_bindir}/ack
%doc %{_mandir}/man1/ack.1%{ext_man}

%files -n perl-App-Ack
%defattr(-,root,root)
%doc Changes README.md LICENSE.md
%dir %{perl_vendorlib}/App
%{perl_vendorlib}/App/Ack.pm
%{perl_vendorlib}/App/Ack
%if 0%{?perl_process_packlist:1}
%endif

%changelog