File ack.spec of Package ack

# vim: set ts=4 sw=4 et:

%{!?perl_make_install:  %global perl_make_install make DESTDIR=$RPM_BUILD_ROOT install_vendor}

%if 0%{?suse_version} >= 1100 || 0%{?fedora} >= 13
%define with_pod 1
%else
%define with_pod 0
%endif

Name:           ack
Version:        1.96
Release:		0
Summary:        Grep-Like Text Finder
Source:         http://search.cpan.org/CPAN/authors/id/P/PE/PETDANCE/ack-%{version}.tar.gz
Patch1:         ack-ignore-osc.patch
Patch2:         ack-fix_smartcase_test_for_old_perl.patch
Patch3:         ack-add_spec.patch
URL:            http://petdance.com/ack/
Group:          Productivity/Text/Utilities
License:        Perl License
BuildRoot:      %{_tmppath}/build-%{name}-%{version}
Requires:       perl
BuildRequires:  make perl perl-File-Next
%if %with_pod
BuildRequires:  perl(Test::Pod)
%endif
BuildArch:      noarch
Requires:       perl-App-Ack = %{version}-%{release}
Requires:       perl-base = %{perl_version}

%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-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 -n "ack-%{version}"
%patch1
%if 0%{?suse_version} > 0 && 0%{?suse_version} < 1000 || 0%{?rhel_version} > 0 && 0%{?rhel_version} < 500
%patch2
%endif
%patch3

%build
%__perl Makefile.PL PREFIX="%{_prefix}"
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}/var/adm/perl-modules/ack"

#%__install -D -m0644 etc/ack.bash_completion.sh \
#    "%{buildroot}/%{_sysconfdir}/bash_completion.d/%{name}.sh"

%__install -d rpmdoc_ack
for f in Changes README.markdown TODO; do
    %__ln_s ../ack/"$f" rpmdoc_ack/"$f"
done

%check
%__make test

%files
%defattr(-,root,root)
%doc rpmdoc_ack/*
#config(noreplace) %{_sysconfdir}/bash_completion.d/%{name}.sh
%{_bindir}/ack
%doc %{_mandir}/man1/ack.1%{ext_man}

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

openSUSE Build Service is sponsored by