# TODO:
# - separate perl-things from apache libs and configs (needed for some buildings)
+# - separate devel things from runtime things (apache-mod_perl-2.0.2-2 marks perl-ExtUtils-MakeMaker-6.25_08-1 (cap perl(ExtUtils::Install)))
+%bcond_with internal_test # use internal Apache-Test
+#
%include /usr/lib/rpm/macros.perl
%define apxs /usr/sbin/apxs
+%define apache_test_version 1.27-2
Summary: A Perl interpreter for the Apache Web server
Summary(cs): Vestavìný interpret Perlu pro WWW server Apache
Summary(da): En indbygget Perl-fortolker for webtjeneren Apache
Summary(zh_CN): ÓÃÓÚ Apache web ·þÎñ³ÌÐòµÄ Perl ½âÊͳÌÐò¡£
Name: apache-mod_perl
Version: 2.0.2
-Release: 1
+Release: 5
Epoch: 1
License: Apache
Group: Networking/Daemons
BuildRequires: apr-util-devel >= 1:1.0.0
BuildRequires: expat-devel
BuildRequires: gdbm-devel
-BuildRequires: openldap-devel
+BuildRequires: openldap-devel >= 2.3.0
+%{!?internal_test:BuildRequires: perl-Apache-Test = %{apache_test_version}}
BuildRequires: perl-devel >= 1:5.8.2
BuildRequires: rpm-perlprov >= 3.0.3-16
%requires_eq_to apache apache-devel
+Requires: apache(modules-api) = %apache_modules_api
Requires: perl(DynaLoader) = %(%{__perl} -MDynaLoader -e 'print DynaLoader->VERSION')
-# What's this for?
+Provides: apache(mod_perl)
+# What's this mod_perl_hooks for?
Provides: perl(mod_perl_hooks)
-Provides: mod_perl
-Provides: perl-Apache-Test
-BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+# not sure is this neccessary
+%{!?internal_test:Requires: perl-Apache-Test = %{apache_test_version}}
Obsoletes: mod_perl
Obsoletes: mod_perl-common
Conflicts: perl-modules < 1:5.8.6-6
+BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
# TODO: separate -devel with ExtUtils::Embed and friends?
%define _noautoreq 'perl(Apache::.*)' 'perl(mod_perl)' 'perl(ModPerl::.*)' 'perl(ExtUtils::Embed)' 'perl(Module::Build)'
-%define _sysconfdir %(%{apxs} -q SYSCONFDIR)
-%define _pkglibdir %(%{apxs} -q LIBEXECDIR)
+%define _sysconfdir %(%{apxs} -q SYSCONFDIR 2>/dev/null)
+%define _pkglibdir %(%{apxs} -q LIBEXECDIR 2>/dev/null)
%description
Mod_perl incorporates a Perl interpreter into the Apache web server,
½Ó¿Ú¡£ ÓÉÓÚ²»±ØÆô¶¯ÈκÎÍⲿ Perl ½âÊͳÌÐò£¬Òò´Ë»áʹ CGI
½Å±¾»Øת¹ý³Ì¸üΪ¿ìËÙ¡£
+%package devel
+Summary: Files needed for building XS modules that use mod_perl
+Group: Development/Libraries
+Requires: %{name} = %{version}-%{release}
+Requires: apache-devel >= 2.0
+
+%description devel
+The apache-mod_perl-devel package contains the files needed for
+building XS modules that use mod_perl.
+
%prep
%setup -q -n mod_perl-%{version}
%patch0 -p1
+if %{without internal_test}
+system=$(%{__perl} -MApache::Test -e 'print Apache::Test->VERSION')
+bundled=$(%{__perl} -IApache-Test/lib -MApache::Test -e 'print Apache::Test->VERSION')
+if [ "$system" != "$bundled" ]; then
+ : Need Apache::Test version $bundled installed in system. please fix.
+ exit 1
+fi
+rm -rf Apache-Test
+%endif
+
%build
%{__perl} Makefile.PL \
MP_APXS=%{apxs} \
%post
if [ -f /var/lock/subsys/httpd ]; then
/etc/rc.d/init.d/httpd restart 1>&2
-else
- echo "Run \"/etc/rc.d/init.d/httpd start\" to start apache HTTP daemon."
fi
%preun
%files
%defattr(644,root,root,755)
%doc Changes INSTALL README STATUS
-%attr(755,root,root) %{_pkglibdir}/*.so
%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/httpd.conf/*.conf
+%attr(755,root,root) %{_pkglibdir}/*.so
%{perl_vendorarch}/*.pm
%{perl_vendorarch}/APR
-%{perl_vendorarch}/Apache
%{perl_vendorarch}/Apache2
%{perl_vendorarch}/ModPerl
%attr(755,root,root) %{perl_vendorarch}/auto/*/*/*.so
%{perl_vendorarch}/auto/Apache2/typemap
-# to -devel? directory ownership problem...
-%{_includedir}/apache/*.h
%{_mandir}/man?/*
+
+%files devel
+%defattr(644,root,root,755)
+%{_includedir}/apache/*.h