Sophie

Sophie

distrib > * > 2008.0 > x86_64 > by-pkgid > f498df1baeb9d434decbc16b5de2f1bc > files > 5

perl-PersistentPerl-2.22-15mdv2008.0.src.rpm

%define	rname PersistentPerl

#Apache2 Module-Specific definitions
%define mod_name mod_persistentperl
%define mod_conf 99_%{mod_name}.conf
%define mod_so %{mod_name}.so

Summary:	Speed up perl scripts by running them persistently
Name:		perl-%{rname}
Version:	2.22
Release:	%mkrel 15
Group:		Development/Perl
License:	GPL
URL:		http://daemoninc.com/PersistentPerl/
Source0:	http://www.cpan.org/modules/by-authors/id/H/HO/HORROCKS/%{rname}-%{version}.tar.bz2
Source1:	%{mod_conf}
Source2:	test.perperl
Patch0:		PersistentPerl-2.22-apr1.x.diff
Patch1:		mod_persistentperl2-apr1.patch
BuildRequires:	perl-devel
BuildRequires:	perl-CGI >= 1:3.11
BuildRequires:	apache-devel >= 2.2.0
BuildRequires:	file
BuildRoot:	%{_tmppath}/%{rname}-%{version}-root

%description
PersistentPerl is a way to run perl scripts persistently, which 
can make them run much more quickly. A script can be made to to 
run persistently by changing the interpreter line at the top of 
the script from:

  "#!/usr/bin/perl"

to

  "#!/usr/bin/perperl"

After the script is initially run, instead of exiting, the perl 
interpreter is kept running. During subsequent runs, this 
interpreter is used to handle new executions instead of starting a
new perl interpreter each time. A very fast frontend program, 
written in C, is executed for each request. This fast frontend 
then contacts the persistent Perl process, which is usually 
already running, to do the work and return the results.

By default each perl script runs in its own Unix process, so one
perl script can't interfere with another. Command line options
can also be used to deal with programs that have memory leaks or
other problems that might keep them from otherwise running
persistently.

PersistentPerl can be used to speed up perl CGI scripts. It
conforms to the CGI specification, and does not run perl code
inside the web server. Since the perl interpreter runs outside
the web server, it can't cause problems for the web server itself.

PersistentPerl also provides an Apache module so that under the
Apache web server, scripts can be run without the overhead of
doing a fork/exec for each request. With this module a small
amount of frontend code is run within the web server - the perl
interpreters still run outside the server.

SpeedyCGI and PersistentPerl are currently both names for the same
code. SpeedyCGI was the original name, but because people weren't
sure what it did, the name PersistentPerl was picked as an alias.
At some point SpeedyCGI will probably be replaced by
PersistentPerl, or become a sub-class of PersistentPerl to avoid
always having two distributions.

%package -n	apache-%{mod_name}
Summary:	Mod_persistentperl is a DSO module for the apache Web server
Group:		System/Servers
Requires(pre,postun): rpm-helper
Requires(pre):	apache-conf >= 2.2.0
Requires(pre):	apache >= 2.2.0
Requires:	perl-%{rname} = %{version}

%description -n	apache-%{mod_name}
Mod_persistentperl is a DSO module for the apache Web server.

%prep

%setup -q -n %{rname}-%{version}
%patch0 -p0 -b .apr1.x
%patch1 -p0 -b .mpp2-apr1.x

# perl path hack
find . -type f | xargs %{__perl} -p -i -e "s|^#\!/usr/local/bin/perl|#\!/usr/bin/perl|g"

cp %{SOURCE1} %{mod_conf}
cp %{SOURCE2} test.perperl

# strip away annoying ^M
find . -type f|xargs file|grep 'CRLF'|cut -d: -f1|xargs perl -p -i -e 's/\r//'
find . -type f|xargs file|grep 'text'|cut -d: -f1|xargs perl -p -i -e 's/\r//'

%build
%{__perl} Makefile.PL INSTALLDIRS=vendor PREFIX=%{_prefix} </dev/null
%{__make}
#%{__make} test

# make the apache2 module
pushd mod_persistentperl2
    %{__perl} Makefile.PL
    %{__perl} -p -i -e "s|^APXS=.*|APXS=%{_sbindir}/apxs|g" Makefile
    %{__make}
    cp -rp .libs ../
popd

%install
[ "%{buildroot}" != "/" ] && rm -rf %{buildroot} 

%{__make} PREFIX=%{buildroot}/%{_prefix} install

install -d %{buildroot}%{_localstatedir}/%{mod_name}
install -d %{buildroot}%{_var}/www/perperl
install -m0755 test.perperl %{buildroot}%{_var}/www/perperl/test.perperl

install -d %{buildroot}%{_var}/www/html/addon-modules
ln -s ../../../..%{_docdir}/apache-%{mod_name}-%{version} \
    %{buildroot}%{_var}/www/html/addon-modules/apache-%{mod_name}-%{version}

cat > HEADER.html << EOF
Click <a href="http://localhost/perperl/test.perperl">here</a> to run the test.perperl script.
EOF

install -d %{buildroot}%{_libdir}/apache-extramodules
install -d %{buildroot}%{_sysconfdir}/httpd/modules.d

install -m0755 .libs/*.so %{buildroot}%{_libdir}/apache-extramodules/
install -m0644 %{mod_conf} %{buildroot}%{_sysconfdir}/httpd/modules.d/%{mod_conf}

%post -n apache-%{mod_name}
if [ -f %{_var}/lock/subsys/httpd ]; then
    %{_initrddir}/httpd restart 1>&2;
fi
    
%postun -n apache-%{mod_name}
if [ "$1" = "0" ]; then
    if [ -f %{_var}/lock/subsys/httpd ]; then
        %{_initrddir}/httpd restart 1>&2
    fi
fi

%clean 
[ "%{buildroot}" != "/" ] && rm -rf %{buildroot} 

%files
%defattr(-,root,root)
%doc Changes README
%attr(0755,root,root) %{_bindir}/*
%{perl_vendorlib}/PersistentPerl.pm

%files -n apache-%{mod_name}
%defattr(-,root,root)
%doc docs contrib util README.html HEADER.html
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/httpd/modules.d/%{mod_conf}
%attr(0755,root,root) %{_libdir}/apache-extramodules/%{mod_so}
%attr(0755,root,root) %{_var}/www/perperl/test.perperl
%dir %attr(0755,apache,apache) %{_localstatedir}/%{mod_name}
%{_var}/www/html/addon-modules/*


%changelog
* Sun Sep 09 2007 Oden Eriksson <oeriksson@mandriva.com> 2.22-15mdv2008.0
+ Revision: 83476
- rebuild


* Sun Mar 11 2007 Oden Eriksson <oeriksson@mandriva.com> 2.22-14mdv2007.1
+ Revision: 141352
- Import perl-PersistentPerl

* Sun Mar 11 2007 Oden Eriksson <oeriksson@mandriva.com> 2.22-14mdv2007.1
- rebuild

* Tue May 09 2006 Scott Karns <scottk@mandriva.org> 2.22-13mdk
- fix deprecated use of apr_filename_of_pathname

* Fri Feb 10 2006 Oden Eriksson <oeriksson@mandriva.com> 2.22-12mdk
- fix versioning
- added apr1.x fixes (P0)

* Fri Jun 03 2005 Oden Eriksson <oeriksson@mandriva.com> 2.22-11mdk
- rename the package
- the conf.d directory is renamed to modules.d
- use new rpm-4.4.x pre,post magic

* Sat May 21 2005 Buchan Milne <bgmilne@linux-mandrake.com> 2.22-10mdk
- Rebuild for new libperl.so

* Sun Mar 20 2005 Oden Eriksson <oeriksson@mandrakesoft.com> 2.22-9mdk
- use the %%mkrel macro

* Mon Feb 28 2005 Oden Eriksson <oeriksson@mandrakesoft.com> 2.22-8mdk
- fix %%post and %%postun to prevent double restarts
- fix bug #6574

* Wed Feb 16 2005 Oden Eriksson <oeriksson@mandrakesoft.com> 2.22-7mdk
- spec file cleanups, remove the ADVX-build stuff

* Sun Feb 13 2005 Oden Eriksson <oeriksson@mandrakesoft.com> 2.22-6mdk
- built for apache 2.0.53

* Mon Aug 02 2004 Oden Eriksson <oeriksson@mandrakesoft.com> 2.22-5mdk
- remove redundant provides
- built for apache 2.0.50

* Tue Jun 15 2004 Oden Eriksson <oden.eriksson@kvikkjokk.net> 2.22-4mdk
- built for apache 2.0.49