SPECS: perl-CGI-SpeedyCGI.spec - fix building of apache modules (w...

glen glen at pld-linux.org
Thu Dec 22 02:25:47 CET 2005


Author: glen                         Date: Thu Dec 22 01:25:47 2005 GMT
Module: SPECS                         Tag: HEAD
---- Log message:
- fix building of apache modules (was completely messed up)
- somebody kill existing apache-mod_speedycgi from ftp, as it's actually apache1 module!
- rel 7

---- Files affected:
SPECS:
   perl-CGI-SpeedyCGI.spec (1.53 -> 1.54) 

---- Diffs:

================================================================
Index: SPECS/perl-CGI-SpeedyCGI.spec
diff -u SPECS/perl-CGI-SpeedyCGI.spec:1.53 SPECS/perl-CGI-SpeedyCGI.spec:1.54
--- SPECS/perl-CGI-SpeedyCGI.spec:1.53	Tue Dec 13 15:37:23 2005
+++ SPECS/perl-CGI-SpeedyCGI.spec	Thu Dec 22 02:25:41 2005
@@ -1,13 +1,11 @@
 # $Revision$, $Date$
-#
-# TODO:
-# - build apache1-mod_* for apache1 and apache-mod_* for apache2
-#
 # Conditional build:
 %bcond_without	tests	# do not perform "make test"
-%bcond_without	apache1	# do not use apache1 instead of apache (apxs1 instead apxs)
+%bcond_without	apache1	# skip building of apache1 module
+%bcond_with	apache2	# build apache2 module (missing APR_BRIGADE_FOREACH macro)
 #
-%define	apxs	/usr/sbin/apxs%{?with_apache1:1}
+%define	apxs	/usr/sbin/apxs
+%define	apxs1	/usr/sbin/apxs1
 %include 	/usr/lib/rpm/macros.perl
 %define		pdir	CGI
 %define		pnam	SpeedyCGI
@@ -15,7 +13,7 @@
 Summary(pl):	Moduł przyspieszający perlowe skrypty CGI
 Name:		perl-CGI-SpeedyCGI
 Version:	2.22
-Release:	6.1
+Release:	7
 License:	GPL v2+
 Group:		Networking/Daemons
 URL:		http://daemoninc.com/SpeedyCGI/
@@ -24,19 +22,23 @@
 Source1:	apache-mod_speedycgi.conf
 Patch0:		%{name}-DESTDIR.patch
 Patch1:		%{name}-APXS.patch
-BuildRequires:	apache%{?with_apache1:1}-devel
+%{?with_apache2:BuildRequires:	apache-devel}
+%{?with_apache1:BuildRequires:	apache1-devel}
 BuildRequires:	perl-devel >= 1:5.8.0
 BuildRequires:	rpm-perlprov >= 3.0.3-16
-Requires(post,preun):	/usr/sbin/apxs%{?with_apache1:1}
-Requires(post,preun):	apache%{?with_apache1:1}
-Requires(post,preun):	grep
-Requires(preun):	fileutils
 Requires:	perl(DynaLoader) = %(%{__perl} -MDynaLoader -e 'print DynaLoader->VERSION')
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
-%define		_pkglibdir	%(%{apxs} -q LIBEXECDIR)
-%define		_sysconfdir	%(%{apxs} -q SYSCONFDIR)
+%if %{with apache2}
+%define		_pkglibdir	%(%{apxs} -q LIBEXECDIR 2>/dev/null)
+%define		_sysconfdir	%(%{apxs} -q SYSCONFDIR 2>/dev/null)
 %define		httpdir		/home/services/httpd
+%endif
+%if %{with apache1}
+%define		_pkglibdir1	%(%{apxs1} -q LIBEXECDIR 2>/dev/null)
+%define		_sysconfdir1	%(%{apxs1} -q SYSCONFDIR 2>/dev/null)
+%define		httpdir1		/home/services/apache
+%endif
 
 %description
 SpeedyCGI is a way to run CGI perl scripts persistently, which usually
@@ -58,7 +60,9 @@
 Summary:	SpeedyCGI apache module
 Summary(pl):	Moduł apache SpeedyCGI
 Group:		Networking/Daemons
-Requires:	%{name} = %{version}
+Requires:	%{name} = %{version}-%{release}
+Requires:	apache(modules-api) = %apache_modules_api
+Requires:	apache >= 2.0.36
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
 %description -n apache-mod_speedycgi
@@ -67,6 +71,19 @@
 %description -n apache-mod_speedycgi -l pl
 Moduł apache SpeedyCGI.
 
+%package -n apache1-mod_speedycgi
+Summary:	SpeedyCGI apache module
+Summary(pl):	Moduł apache SpeedyCGI
+Group:		Networking/Daemons
+Requires:	%{name} = %{version}-%{release}
+BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%description -n apache1-mod_speedycgi
+SpeedyCGI apache module.
+
+%description -n apache1-mod_speedycgi -l pl
+Moduł apache SpeedyCGI.
+
 %prep
 %setup -q -n %{pdir}-%{pnam}-%{version}
 %patch0 -p1
@@ -75,66 +92,89 @@
 %build
 %{__perl} Makefile.PL </dev/null \
 	INSTALLDIRS=vendor
-cd mod_speedycgi && perl Makefile.PL
-cd ..
+%{?with_apache1:cd mod_speedycgi && perl Makefile.PL && cd ..}
+%{?with_apache2:cd mod_speedycgi2 && perl Makefile.PL && cd ..}
 
 %{__make} \
 	OPTIMIZE="%{rpmcflags}"
-%{__make} -C mod_speedycgi APXS="%{apxs}" \
+
+%if %{with apache1}
+%{__make} -C mod_speedycgi APXS="%{apxs1}" \
+	OPTIMIZE="%{rpmcflags}"
+%endif
+%if %{with apache2}
+%{__make} -C mod_speedycgi2 APXS="%{apxs}" \
 	OPTIMIZE="%{rpmcflags}"
+%endif
 
 %{?with_test:%{__make} test}
 
-APXS="%{apxs}"
-
 %install
 rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT%{perl_archlib} \
-	$RPM_BUILD_ROOT{%{_pkglibdir},%{httpdir}/speedy,%{_sysconfdir}}
+install -d $RPM_BUILD_ROOT%{perl_archlib}
 
 %{__make} install \
 	DESTDIR=$RPM_BUILD_ROOT
 
-install %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/mod_speedycgi.conf
-install mod_speedycgi/mod_speedycgi.so $RPM_BUILD_ROOT%{_pkglibdir}
+%if %{with apache1}
+install -d $RPM_BUILD_ROOT{%{_pkglibdir1},%{httpdir1}/speedy,%{_sysconfdir1}/conf.d}
+install %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir1}/conf.d/mod_speedycgi.conf
+install mod_speedycgi/mod_speedycgi.so $RPM_BUILD_ROOT%{_pkglibdir1}
+%endif
+%if %{with apache2}
+install -d $RPM_BUILD_ROOT{%{_pkglibdir},%{httpdir}/speedy,%{_sysconfdir}/httpd.conf}
+install %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/httpd.conf/90_mod_speedycgi.conf
+install mod_speedycgi2/mod_speedycgi.so $RPM_BUILD_ROOT%{_pkglibdir}
+%endif
 
 %clean
 rm -rf $RPM_BUILD_ROOT
 
 %post -n apache-mod_speedycgi
-%{apxs} -e -a -n speedycgi %{_pkglibdir}/mod_speedycgi.so 1>&2
-if [ -f /etc/httpd/httpd.conf ] && ! grep -q "^Include.*mod_speedycgi.conf" /etc/httpd/httpd.conf; then
-	echo "Include /etc/httpd/mod_speedycgi.conf" >> /etc/httpd/httpd.conf
-fi
 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
+
+%post -n apache1-mod_speedycgi
+if [ -f /var/lock/subsys/apache ]; then
+	/etc/rc.d/init.d/apache restart 1>&2
 fi
 
 %preun -n apache-mod_speedycgi
 if [ "$1" = "0" ]; then
-	umask 027
-	%{apxs} -e -A -n speedycgi %{_pkglibdir}/mod_speedycgi.so 1>&2
-	grep -v "^Include.*mod_speedycgi.conf" /etc/httpd/httpd.conf > \
-		/etc/httpd/httpd.conf.tmp
-	mv -f /etc/httpd/httpd.conf.tmp /etc/httpd/httpd.conf
 	if [ -f /var/lock/subsys/httpd ]; then
 		/etc/rc.d/init.d/httpd restart 1>&2
 	fi
 fi
 
+%preun -n apache1-mod_speedycgi
+if [ "$1" = "0" ]; then
+	if [ -f /var/lock/subsys/apache ]; then
+		/etc/rc.d/init.d/apache restart 1>&2
+	fi
+fi
+
 %files
 %defattr(644,root,root,755)
 %doc README docs contrib
 %{perl_vendorlib}/CGI/*.pm
 %attr(755,root,root) %{_bindir}/speedy*
 
+%if %{with apache1}
+%files -n apache1-mod_speedycgi
+%defattr(644,root,root,755)
+%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir1}/conf.d/*mod_speedycgi.conf
+%attr(755,root,root) %{_pkglibdir1}/mod_speedycgi.so
+%dir %{httpdir1}/*
+%endif
+
+%if %{with apache2}
 %files -n apache-mod_speedycgi
 %defattr(644,root,root,755)
-%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/mod_speedycgi.conf
+%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/httpd.conf/*mod_speedycgi.conf
 %attr(755,root,root) %{_pkglibdir}/mod_speedycgi.so
-%dir %{httpdir}
+%dir %{httpdir}/*
+%endif
 
 %define date	%(echo `LC_ALL="C" date +"%a %b %d %Y"`)
 %changelog
@@ -142,6 +182,11 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.54  2005/12/22 01:25:41  glen
+- fix building of apache modules (was completely messed up)
+- somebody kill existing apache-mod_speedycgi from ftp, as it's actually apache1 module!
+- rel 7
+
 Revision 1.53  2005/12/13 14:37:23  glen
 - adapterized (sorted %verify flags)
 
@@ -192,7 +237,7 @@
 - license/summary/description fixes
 
 Revision 1.37  2004/04/11 05:47:13  agaran
- - update to 2.22, added conditional build with apache1 (builds correctly), not tested with apache
+- update to 2.22, added conditional build with apache1 (builds correctly), not tested with apache
 
 Revision 1.36  2003/08/13 14:46:38  ankry
 - cosmetics
@@ -223,7 +268,7 @@
 
 Revision 1.27  2002/10/03 09:41:22  kloczek
 - release 2,
-- fixed http://bugs.pld.org.pl/?bug=368: added missing %%{apxs} macro definition.
+- fixed http://bugs.pld.org.pl/?bug=368: added missing %{apxs} macro definition.
 
 Revision 1.26  2002/09/27 21:02:12  ankry
 - added tests ; cleaning
@@ -234,7 +279,7 @@
 
 Revision 1.24  2002/06/11 07:39:21  qboosh
 - don't clear httpd.conf when uninstalling mod_speedycgi
-- new %%doc, release 7
+- new %doc, release 7
 
 Revision 1.23  2002/05/11 14:28:05  kloczek
 - s/ftp.perl.org/ftp.cpan.org/ in Source url.
@@ -247,13 +292,13 @@
   Group field using gettext).
 
 Revision 1.20  2002/02/10 15:39:12  depesz
-adapterized
+- adapterized
 
 Revision 1.19  2002/02/09 12:59:37  depesz
 - unfied source path
 
 Revision 1.18  2002/01/18 02:14:12  kloczek
-perl -pi -e "s/pld-list\@pld.org.pl/feedback\@pld.org.pl/"
+- perl -pi -e "s/pld-list\@pld.org.pl/feedback\@pld.org.pl/"
 
 Revision 1.17  2001/12/07 15:07:30  qboosh
 - pl translations, release 5
@@ -273,14 +318,14 @@
 - fixed pre/post scripts
 
 Revision 1.12  2001/04/30 16:05:26  kloczek
-- added using %%{rpmcflags} macro.
+- added using %{rpmcflags} macro.
 
 Revision 1.11  2001/04/17 12:06:06  baggins
 - release 2
 - rebuild with perl 5.6.1
 
 Revision 1.10  2001/04/14 18:00:04  baggins
-- removed explicit requirements for perl = %%{version} and %%{perl_sitearch}
+- removed explicit requirements for perl = %{version} and %{perl_sitearch}
   they will be added by rpm if needed
 
 Revision 1.9  2001/03/30 10:30:23  mis
@@ -290,7 +335,7 @@
 - updated to 2.10
 
 Revision 1.7  2001/01/25 20:03:43  misiek
-Massive attack. We use -O0 instead -O flags while debug enabled.
+- Massive attack. We use -O0 instead -O flags while debug enabled.
 
 Revision 1.6  2000/12/28 10:19:51  kloczek
 - BuildRequires rule for apache(EAPI)-devel (not apache(EAPI)).
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/SPECS/perl-CGI-SpeedyCGI.spec?r1=1.53&r2=1.54&f=u



More information about the pld-cvs-commit mailing list