SPECS: php.spec - port changes fron php4.spec: - add conf.d supp...

glen glen at pld-linux.org
Mon Aug 15 18:39:20 CEST 2005


Author: glen                         Date: Mon Aug 15 16:39:20 2005 GMT
Module: SPECS                         Tag: HEAD
---- Log message:
- port changes fron php4.spec:
  - add conf.d support
  - minimize apache restarts
  - possibility to build both apache1/apache2 modules (unfinished due Obsolete not resolved)
- cut php 4.x changelog

---- Files affected:
SPECS:
   php.spec (1.459 -> 1.460) 

---- Diffs:

================================================================
Index: SPECS/php.spec
diff -u SPECS/php.spec:1.459 SPECS/php.spec:1.460
--- SPECS/php.spec:1.459	Sun Aug 14 17:21:34 2005
+++ SPECS/php.spec	Mon Aug 15 18:39:15 2005
@@ -1,5 +1,4 @@
 # $Revision$, $Date$
-#
 # TODO:
 # - php-shared is SERIOUSLY broken. Try compiling with --enable-versioning.
 # - think of including support for:
@@ -15,6 +14,12 @@
 # - make additional headers added by mail patch configurable
 # - apply -hardened patch by default ?
 # - ftp module needs to be linked with -lssl if openssl module is enabled
+# - finish apache1/apache2 package split. currently don't know how to resolve:
+#  apache1-mod_php4-4.4.0-4.44 obsoleted by apache-mod_php-5.0.4-8.3
+#  it's because apache1-mod_php4 Provides:   php = %{epoch}:%{version}-%{release}
+#  and new apache-mod_php:
+#  # Obsolete last version when apache module was in main package
+#  Obsoletes:  php < 4:5.0.4-8.1
 #
 # Conditional build:
 %bcond_with	db3		# use db3 packages instead of db (4.x) for Berkeley DB support
@@ -24,7 +29,6 @@
 %bcond_with	interbase_inst	# use InterBase install., not Firebird	(BR: proprietary libs)
 %bcond_with	oci8		# with Oracle oci8 extension module	(BR: proprietary libs)
 %bcond_with	oracle		# with oracle extension module		(BR: proprietary libs)
-%bcond_with	apache1		# build with apache1
 %bcond_without	mysqli		# with mysqli support (Requires mysql > 4.1)
 %bcond_without	cpdf		# without cpdf extension module
 %bcond_without	curl		# without CURL extension module
@@ -51,24 +55,30 @@
 %bcond_without	tidy		# without Tidy extension module
 %bcond_without	wddx		# without WDDX extension module
 %bcond_without	xmlrpc		# without XML-RPC extension module
+%bcond_with		apache1		# enable building apache 1.3.x module (disables apache2)
+%bcond_without	apache2		# disable building apache 2.x module
 
-%define	_apache2	%{?with_apache1:0}%{!?with_apache1:1}
-%if %{_apache2}
-%define	apxs		/usr/sbin/apxs
-%else
-%define	apxs		/usr/sbin/apxs1
+%define apxs1		/usr/sbin/apxs1
+%define	apxs2		/usr/sbin/apxs
+
+%if %{with apache1}
+%undefine	with_apache2
 %endif
+
 # some problems with apache 2.x
-%if %{_apache2}
+%if %{with apache2}
 %undefine	with_mm
 %endif
+
 %ifnarch %{ix86} %{x8664} sparc sparcv9 alpha ppc
 %undefine	with_interbase
 %endif
+
 # x86-only lib
 %ifnarch %{ix86}
 %undefine	with_msession
 %endif
+
 %include	/usr/lib/rpm/macros.php
 Summary:	The PHP HTML-embedded scripting language for use with Apache
 Summary(fr):	Le langage de script embarque-HTML PHP pour Apache
@@ -78,7 +88,7 @@
 Summary(uk):	PHP ÷ĹŇÓŚ§ 5 - ÍĎ×Á ĐŇĹĐŇĎĂĹÓŐ×ÁÎÎŃ HTML-ĆÁĘĚŚ×, ×ÉËĎÎŐ×ÁÎÁ ÎÁ ÓĹŇ×ĹŇŚ
 Name:		php
 Version:	5.0.4
-Release:	9%{?with_hardening:hardened}
+Release:	9.21%{?with_hardening:hardened}
 Epoch:		4
 Group:		Libraries
 License:	PHP
@@ -125,6 +135,7 @@
 Patch28:	%{name}-cpdf-fix.patch
 Patch29:	%{name}-gcc4.patch
 Patch30:	%{name}-hardening-fix.patch
+Patch31:	%{name}-both-apxs.patch
 Icon:		php.gif
 URL:		http://www.php.net/
 %{?with_interbase:%{!?with_interbase_inst:BuildRequires:	Firebird-devel >= 1.0.2.908-2}}
@@ -181,7 +192,7 @@
 BuildRequires:	readline-devel
 %{?with_recode:BuildRequires:	recode-devel >= 3.5d-3}
 BuildRequires:	rpm-php-pearprov >= 4.0.2-100
-BuildRequires:	rpmbuild(macros) >= 1.213
+BuildRequires:	rpmbuild(macros) >= 1.230
 %{?with_sqlite:BuildRequires:	sqlite-devel}
 BuildRequires:	t1lib-devel
 %{?with_tidy:BuildRequires:	tidy-devel}
@@ -189,32 +200,25 @@
 %{?with_odbc:BuildRequires:	unixODBC-devel}
 %{?with_xmlrpc:BuildRequires:	xmlrpc-epi-devel}
 BuildRequires:	zlib-devel >= 1.0.9
-# apache 1.3 vs apache 2.0
-%if %{_apache2}
+%if %{with apache1}
+BuildRequires:	apache1-devel
+PreReq:		%{name}-common = %{epoch}:%{version}-%{release}
+PreReq:		apache1(EAPI) >= 1.3.9
+Requires(post,preun):	%{apxs1}
+Requires(post,preun):	%{__perl}
+%endif
+%if %{with apache2}
 BuildRequires:	apache-devel >= 2.0.52-2
 BuildRequires:	apr-devel >= 1:1.0.0
 BuildRequires:	apr-util-devel >= 1:1.0.0
+PreReq:		%{name}-common = %{epoch}:%{version}-%{release}
 PreReq:		apache >= 2.0.52-2
 Requires:	apache(modules-api) = %{apache_modules_api}
-%else
-BuildRequires:	apache1-devel
-PreReq:		apache1(EAPI) >= 1.3.9
-Requires(post,preun):	%{apxs}
-Requires(post,preun):	%{__perl}
 %endif
-PreReq:		%{name}-common = %{epoch}:%{version}-%{release}
-Obsoletes:	phpfi
-Obsoletes:	apache-mod_php
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
 %define		_sysconfdir	/etc/php
 %define		extensionsdir	%{_libdir}/php
-%define		httpdir		/home/services/httpd
-%if %{_apache2}
-%define		apachelib	%{_libdir}/apache
-%else
-%define		apachelib	%{_libdir}/apache1
-%endif
 
 %description
 PHP is an HTML-embedded scripting language. PHP attempts to make it
@@ -282,6 +286,48 @@
 ÍÁ¤ÔĹ ÔÁËĎÖ ×ÓÔÁÎĎ×ÉÔÉ ĐÁËĹÔ %{name}-common. ńËÝĎ ×ÁÍ ĐĎÔŇŚÂĹÎ
 ŚÎÔĹŇĐŇĹÔÁÔĎŇ PHP × ŃËĎÓÔŚ ÍĎÄŐĚŃ apache, ×ÓÔÁÎĎ׌ÔŘ ĐÁËĹÔ apache-php.
 
+%package -n apache1-mod_php
+Summary:	PHP DSO module for apache 1.3.x
+Summary(pl):	Moduł DSO (Dynamic Shared Object) php dla apache 1.3.x
+Group:		Development/Languages/PHP
+PreReq:		%{name}-common = %{epoch}:%{version}-%{release}
+Requires(post,preun):	%{apxs1}
+Requires(post,preun):	%{__perl}
+Requires:	apache1(EAPI) >= 1.3.33-2
+Requires:	apache1-mod_mime
+Provides:	%{name} = %{epoch}:%{version}-%{release}
+Provides:	php = %{epoch}:%{version}-%{release}
+Obsoletes:	phpfi
+Obsoletes:	apache-mod_php < 1:4.1.1
+# Obsolete last version when apache module was in main package
+Obsoletes:	php <= 4:5.0.4-9
+
+%description -n apache1-mod_php
+PHP as DSO module for apache 1.3.x.
+
+%description -n apache1-mod_php -l pl
+php jako moduł DSO (Dynamic Shared Object) dla apache 1.3.x.
+
+%package -n apache-mod_php
+Summary:	PHP DSO module for apache 2.x
+Summary(pl):	Moduł DSO (Dynamic Shared Object) php dla apache 2.x
+Group:		Development/Languages/PHP
+PreReq:		%{name}-common = %{epoch}:%{version}-%{release}
+Requires:	apache >= 2.0.52-2
+Requires:	apache(modules-api) = %{apache_modules_api}
+Provides:	%{name} = %{epoch}:%{version}-%{release}
+Provides:	php = %{epoch}:%{version}-%{release}
+Obsoletes:	phpfi
+Obsoletes:	apache-mod_php < 1:4.1.1
+# Obsolete last version when apache module was in main package
+Obsoletes:	php <= 4:5.0.4-9
+
+%description -n apache-mod_php
+PHP as DSO module for apache 2.x.
+
+%description -n apache-mod_php -l pl
+php jako moduł DSO (Dynamic Shared Object) dla apache 2.x.
+
 %package fcgi
 Summary:	php as FastCGI program
 Summary(pl):	php jako program FastCGI
@@ -1439,6 +1485,7 @@
 zcat %{SOURCE9} | patch -p1
 patch -p1 < %{PATCH30}
 %endif
+%patch31 -p1
 
 # conflict seems to be resolved by recode patches
 rm -f ext/recode/config9.m4
@@ -1452,29 +1499,59 @@
 sed -i -e 's#apr-config#apr-1-config#g' sapi/apache*/*.m4
 
 %build
-%if %{_apache2}
-CFLAGS="%{rpmcflags} -DEAPI=1 -I/usr/X11R6/include `%{_bindir}/apr-1-config --includes` `%{_bindir}/apu-1-config --includes`"
-%else
 CFLAGS="%{rpmcflags} -DEAPI=1 -I/usr/X11R6/include"
+%if %{with apache2}
+# Apache2 CFLAGS. harmless for other SAPIs.
+CFLAGS="$CFLAGS $(%{_bindir}/apr-1-config --includes) $(%{_bindir}/apu-1-config --includes)"
 %endif
+
 EXTENSION_DIR="%{extensionsdir}"; export EXTENSION_DIR
-./buildconf --force
-%{__libtoolize}
-%{__aclocal}
-%{__autoconf}
+if [ ! -f _built-conf ]; then # configure once (for faster debugging purposes)
+	./buildconf --force
+	%{__libtoolize}
+	%{__aclocal}
+	%{__autoconf}
+	touch _built-conf
+fi
 PROG_SENDMAIL="/usr/lib/sendmail"; export PROG_SENDMAIL
-for i in fcgi cgi cli apxs ; do
-%configure \
-	`[ $i = cgi ] && echo --enable-discard-path` \
-	`[ $i = cli ] && echo --disable-cgi` \
-	`[ $i = fcgi ] && echo --enable-fastcgi --with-fastcgi=/usr` \
-%if %{_apache2}
-	`[ $i = apxs ] && echo --with-apxs2=%{apxs}` \
-	--enable-maintainer-zts \
-%else
-	`[ $i = apxs ] && echo --with-apxs=%{apxs}` \
-%endif
+
+sapis="
+fcgi cgi cli
+%if %{with apache1}
+apxs1
+%endif
+%if %{with apache2}
+apxs2
+%endif
+"
+for sapi in $sapis; do
+	[ -f Makefile.$sapi ] && continue # skip if already configured (for faster debugging purposes)
+
+	%configure \
+	`
+	case $sapi in
+	cgi)
+		echo --enable-discard-path
+	;;
+	cli)
+		echo --disable-cgi
+	;;
+	fcgi)
+		echo --enable-fastcgi --with-fastcgi=/usr
+	;;
+	apxs1)
+		ver=%(rpm -q --qf '%%{version}' apache1-apxs)
+		echo --with-apxs=%{apxs1} --with-apache-version=$ver
+	;;
+	apxs2)
+		ver=%(rpm -q --qf '%%{version}' apache-apxs)
+		echo --with-apxs2=%{apxs2} --with-apache-version=$ver --enable-maintainer-zts
+	;;
+	esac
+	` \
+	--cache-file=config.cache \
 	--with-config-file-path=%{_sysconfdir} \
+	--with-config-file-scan-dir=%{_sysconfdir}/conf.d \
 	--with-exec-dir=%{_bindir} \
 	--%{!?debug:dis}%{?debug:en}able-debug \
 	--enable-memory-limit \
@@ -1571,25 +1648,38 @@
 	--with-zlib=shared \
 	--with-zlib-dir=shared,/usr
 
-cp -f Makefile Makefile.$i
-# left for debugging purposes
-cp -f main/php_config.h php_config.h.$i
+	cp -f Makefile Makefile.$sapi
+
+	# left for debugging purposes
+	cp -f main/php_config.h php_config.h.$sapi
 done
 
 # for now session_mm doesn't work with shared session module...
 # --enable-session=shared
 # %{!?with_mm:--with-mm=shared,no}%{?with_mm:--with-mm=shared}
 
-%{__make}
+%{__make} build-modules
 
+%{__make} libphp_common.la
 # fix install paths, avoid evil rpaths
-%{__perl} -pi -e "s|^libdir=.*|libdir='%{_libdir}'|" libphp_common.la
-%{__perl} -pi -e "s|^libdir=.*|libdir='%{apachelib}'|" libphp5.la
-%{__perl} -pi -e 's|^(relink_command=.* -rpath )[^ ]*/libs |$1%{apachelib} |' libphp5.la
+sed -i -e "s|^libdir=.*|libdir='%{_libdir}'|" libphp_common.la
 
 # for fcgi: -DDISCARD_PATH=0 -DENABLE_PATHINFO_CHECK=1 -DFORCE_CGI_REDIRECT=0
 # -DHAVE_FILENO_PROTO=1 -DHAVE_FPOS=1 -DHAVE_LIBNSL=1(die) -DHAVE_SYS_PARAM_H=1
 # -DPHP_FASTCGI=1 -DPHP_FCGI_STATIC=1 -DPHP_WRITE_STDOUT=1
+%if %{with apache1}
+%{__make} libtool-sapi LIBTOOL_SAPI=sapi/apache/libphp5.la -f Makefile.apxs1
+sed -i -e "
+s|^libdir=.*|libdir='%{_libdir}/apache1'|;
+s|^(relink_command=.* -rpath )[^ ]*/libs |$1%{_libdir}/apache1 |" sapi/apache/libphp5.la
+%endif
+
+%if %{with apache2}
+%{__make} libtool-sapi LIBTOOL_SAPI=sapi/apache2handler/libphp5.la -f Makefile.apxs2
+sed -i -e "
+s|^libdir=.*|libdir='%{_libdir}/apache'|;
+s|^(relink_command=.* -rpath )[^ ]*/libs |$1%{_libdir}/apache |" sapi/apache2handler/libphp5.la
+%endif
 
 %{__make} sapi/cgi/php -f Makefile.fcgi \
 	CFLAGS_CLEAN="%{rpmcflags} -DDISCARD_PATH=0 -DENABLE_PATHINFO_CHECK=1 -DFORCE_CGI_REDIRECT=0 -DHAVE_FILENO_PROTO=1 -DHAVE_FPOS=1 -DHAVE_LIBNSL=1 -DHAVE_SYS_PARAM_H=1 -DPHP_FASTCGI=1 -DPHP_FCGI_STATIC=1 -DPHP_WRITE_STDOUT=1"
@@ -1603,644 +1693,803 @@
 %{__make} sapi/cgi/php -f Makefile.cgi \
 	CFLAGS_CLEAN="%{rpmcflags} -DDISCARD_PATH=1 -DENABLE_PATHINFO_CHECK=1 -DFORCE_CGI_REDIRECT=0 -DPHP_WRITE_STDOUT=1"
 
+# CLI
+%{__make} sapi/cli/php -f Makefile.cli
+
 %install
 rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT{%{_libdir}/php,%{apachelib},%{_sysconfdir}/{apache,cgi}} \
-	$RPM_BUILD_ROOT%{httpdir}/icons \
+install -d $RPM_BUILD_ROOT{%{_libdir}/{php,apache{,1}},%{_sysconfdir}/{apache,cgi}} \
+	$RPM_BUILD_ROOT/home/services/{httpd,apache}/icons \
 	$RPM_BUILD_ROOT{%{_sbindir},%{_bindir}} \
 	$RPM_BUILD_ROOT/var/run/php \
-%if %{_apache2}
-	$RPM_BUILD_ROOT/etc/httpd/httpd.conf
-%else
-	$RPM_BUILD_ROOT/etc/apache/apache.conf
+	$RPM_BUILD_ROOT{/etc/apache/conf.d,/etc/httpd/httpd.conf} \
+	$RPM_BUILD_ROOT%{_mandir}/man1
+
+# install apache1 DSO module
+%if %{with apache1}
+# TODO: use libtool here
+install sapi/apache/.libs/libphp5.so $RPM_BUILD_ROOT%{_libdir}/apache1/libphp5.so
+%endif
+
+# install apache2 DSO module
+%if %{with apache2}
+# TODO: use libtool here
+install sapi/apache2handler/.libs/libphp5.so $RPM_BUILD_ROOT%{_libdir}/apache/libphp5.so
 %endif
 
-%{__make} install \
-	INSTALL_ROOT=$RPM_BUILD_ROOT \
-	INSTALL_IT="\$(LIBTOOL) --mode=install install libphp_common.la $RPM_BUILD_ROOT%{_libdir} ; \$(LIBTOOL) --mode=install install libphp5.la $RPM_BUILD_ROOT%{apachelib}; \$(LIBTOOL) --mode=install install sapi/cgi/php $RPM_BUILD_ROOT%{_bindir}/php.cgi ; \$(LIBTOOL) --mode=install install sapi/fcgi/php $RPM_BUILD_ROOT%{_bindir}/php.fcgi" \
-	INSTALL_CLI="\$(LIBTOOL) --mode=install install sapi/cli/php $RPM_BUILD_ROOT%{_bindir}/php.cli"
+libtool --silent --mode=install install libphp_common.la $RPM_BUILD_ROOT%{_libdir}
+
+# install the apache modules' files
+make install-headers install-build install-modules install-programs \
+	INSTALL_ROOT=$RPM_BUILD_ROOT
+
+# install CGI
+libtool --silent --mode=install install sapi/cgi/php $RPM_BUILD_ROOT%{_bindir}/php.cgi
+
+# install FCGI
+libtool --silent --mode=install install sapi/fcgi/php $RPM_BUILD_ROOT%{_bindir}/php.fcgi
+
+# install CLI
+libtool --silent --mode=install install sapi/cli/php $RPM_BUILD_ROOT%{_bindir}/php.cli
+install sapi/cli/php.1 $RPM_BUILD_ROOT%{_mandir}/man1/php.1
 
 # TODO:
 # Why make install doesn't install libphp5.so ?
-install libs/libphp5.so $RPM_BUILD_ROOT%{apachelib}
+#install libs/libphp5.so $RPM_BUILD_ROOT%{apachelib}
 
 ln -sf php.cli $RPM_BUILD_ROOT%{_bindir}/php
 
 install php.ini	$RPM_BUILD_ROOT%{_sysconfdir}/php.ini
-install %{SOURCE5} %{SOURCE6} %{SOURCE7} %{SOURCE8} $RPM_BUILD_ROOT%{_sysconfdir}
-install %{SOURCE2} php.gif $RPM_BUILD_ROOT%{httpdir}/icons
+install %{SOURCE5} $RPM_BUILD_ROOT%{_sysconfdir}/php-cgi-fcgi.ini
+install %{SOURCE6} $RPM_BUILD_ROOT%{_sysconfdir}/php-cgi.ini
+install %{SOURCE7} $RPM_BUILD_ROOT%{_sysconfdir}/php-apache.ini
+install %{SOURCE7} $RPM_BUILD_ROOT%{_sysconfdir}/php-apache2handler.ini
+install %{SOURCE8} $RPM_BUILD_ROOT%{_sysconfdir}/php-cli.ini
+
+install %{SOURCE2} php.gif $RPM_BUILD_ROOT/home/services/httpd/icons
+install %{SOURCE2} php.gif $RPM_BUILD_ROOT/home/services/apache/icons
 install %{SOURCE3} $RPM_BUILD_ROOT%{_sbindir}
-%if %{_apache2}
+install %{SOURCE4} $RPM_BUILD_ROOT/etc/apache/conf.d/70_mod_php.conf
 install %{SOURCE4} $RPM_BUILD_ROOT/etc/httpd/httpd.conf/70_mod_php.conf
-mv $RPM_BUILD_ROOT%{_sysconfdir}/php-apache{,2handler}.ini
-%endif
 
 install %{SOURCE1} .
 
 cp -f Zend/LICENSE{,.Zend}
 
-rm -f $RPM_BUILD_ROOT%{apachelib}/libphp5.la
+# Generate stub .ini files for each subpackage
+install -d $RPM_BUILD_ROOT%{_sysconfdir}/conf.d
+for so in modules/*.so; do
+	mod=$(basename $so .so)
+	cat > $RPM_BUILD_ROOT%{_sysconfdir}/conf.d/${mod}.ini <<EOF
+; Enable ${mod} extension module
+extension=${mod}.so
+EOF
+done
+
+# Not in all SAPI, so don't need the .ini fragments.
+rm -f $RPM_BUILD_ROOT%{_sysconfdir}/conf.d/{ncurses,pcntl,readline}.ini
 
 %clean
 rm -rf $RPM_BUILD_ROOT
 
-%if %{_apache2}
-%triggerpostun -- php < 4:5.0.4-7.1
-# for fixed php-SAPI.ini, the poor php-apache.ini was never read for apache2
-if [ -f %{_sysconfdir}/php-apache.ini.rpmsave ]; then
-	cp -f %{_sysconfdir}/php-apache2handler.ini{,.rpmnew}
-	mv -f %{_sysconfdir}/php-apache.ini.rpmsave %{_sysconfdir}/php-apache2handler.ini
-fi
+%if %{with apache1}
+%triggerpostun -- %{name} < 4:5.0.4-9.11
+%{apxs1} -e -A -n php5 %{_pkglibdir}/libphp5.so 1>&2
+%{__perl} -pi -e \
+	's|^AddType application/x-httpd-php \.php|#AddType application/x-httpd-php .php|' \
+	/etc/apache/apache.conf
+%service -q apache restart
 %endif
 
 %post
-%if ! %{_apache2}
-%{__perl} -pi -e 's|^#AddType application/x-httpd-php \.php|AddType application/x-httpd-php .php|' \
-	/etc/apache/apache.conf
-%{apxs} -e -a -n php5 %{_pkglibdir}/libphp5.so 1>&2
-if [ -f /var/lock/subsys/apache ]; then
-	/etc/rc.d/init.d/apache restart 1>&2
-fi
-%else
-if [ -f /var/lock/subsys/httpd ]; then
-	/etc/rc.d/init.d/httpd restart 1>&2
-fi
+if [ "$1" = "1" ]; then
+%if %{with apache1}
+	%service -q apache restart
 %endif
+%if %{with apache2}
+	%service -q httpd restart
+%endif
+fi
 
-%if %{_apache2}
 %postun
 if [ "$1" = "0" ]; then
-	if [ -f /var/lock/subsys/httpd ]; then
-		/etc/rc.d/init.d/httpd restart 1>&2
-	fi
+%if %{with apache1}
+	%service -q apache restart
+%endif
+%if %{with apache2}
+	%service -q httpd restart
+%endif
 fi
-%else
-%preun
+
+%post -n apache1-mod_php
+if [ "$1" = "1" ]; then
+	%service -q apache restart
+fi
+
+%postun -n apache1-mod_php
 if [ "$1" = "0" ]; then
-	%{apxs} -e -A -n php5 %{_pkglibdir}/libphp5.so 1>&2
-	%{__perl} -pi -e \
-		's|^AddType application/x-httpd-php \.php|#AddType application/x-httpd-php .php|' \
-		/etc/apache/apache.conf
-	if [ -f /var/lock/subsys/apache ]; then
-		/etc/rc.d/init.d/apache restart 1>&2
-	fi
+	%service -q apache restart
+fi
+
+%post -n apache-mod_php
+if [ "$1" = "1" ]; then
+	%service -q httpd restart
+fi
+
+%postun -n apache-mod_php
+if [ "$1" = "0" ]; then
+	%service -q httpd restart
+fi
+
+# so tired of typing... so decided to create macros
+# macro called at extension post scriptlet
+%define	extension_post \
+if [ "$1" = "1" ]; then \
+	[ ! -f /etc/apache/conf.d/??_mod_php.conf ] || %service -q apache restart \
+	[ ! -f /etc/httpd/httpd.conf/??_mod_php.conf ] || %service -q httpd restart \
+fi
+
+# macro called at extension postun scriptlet
+%define	extension_postun \
+if [ "$1" = "0" ]; then \
+	[ ! -f /etc/apache/conf.d/??_mod_php.conf ] || %service -q apache restart \
+	[ ! -f /etc/httpd/httpd.conf/??_mod_php.conf ] || %service -q httpd restart \
 fi
-%endif
 
 %post	common -p /sbin/ldconfig
-%postun	common -p /sbin/ldconfig
+%postun	common
+/sbin/ldconfig
+# extension_post here is all correct.
+%extension_post
+
+# compensate missing restart of earlier -common package.
+%triggerpostun common -- %{name}-common < 4:5.0.4-9.1
+[ ! -f /etc/apache/conf.d/??_mod_php.conf ] || %service -q apache restart
+[ ! -f /etc/httpd/httpd.conf/??_mod_php.conf ] || %service -q httpd restart
 
-%post bcmath
-%{_sbindir}/php-module-install install bcmath %{_sysconfdir}/php.ini
+%if %{with apache2}
+%triggerpostun -- php < 4:5.0.4-7.1
+# for fixed php-SAPI.ini, the poor php-apache.ini was never read for apache2
+if [ -f %{_sysconfdir}/php-apache.ini.rpmsave ]; then
+	cp -f %{_sysconfdir}/php-apache2handler.ini{,.rpmnew}
+	mv -f %{_sysconfdir}/php-apache.ini.rpmsave %{_sysconfdir}/php-apache2handler.ini
+fi
 
-%preun bcmath
-if [ "$1" = "0" ]; then
-	%{_sbindir}/php-module-install remove bcmath %{_sysconfdir}/php.ini
+# extra trigger, if they did not upgrade to 4:5.0.4-7 but still had old php-apache.ini
+%triggerpostun -n apache-mod_php -- php < 4:5.0.4-7.1
+# for fixed php-SAPI.ini, the poor php-apache.ini was never read for apache2
+if [ -f %{_sysconfdir}/php-apache.ini.rpmsave ]; then
+	cp -f %{_sysconfdir}/php-apache2handler.ini{,.rpmnew}
+	mv -f %{_sysconfdir}/php-apache.ini.rpmsave %{_sysconfdir}/php-apache2handler.ini
 fi
+%endif
+
+%post bcmath
+%extension_post
+
+%postun bcmath
+%extension_postun
 
 %post bzip2
-%{_sbindir}/php-module-install install bz2 %{_sysconfdir}/php.ini
+%extension_post
 
-%preun bzip2
-if [ "$1" = "0" ]; then
-	%{_sbindir}/php-module-install remove bz2 %{_sysconfdir}/php.ini
-fi
+%postun bzip2
+%extension_postun
 
 %post calendar
-%{_sbindir}/php-module-install install calendar %{_sysconfdir}/php.ini
+%extension_post
 
-%preun calendar
-if [ "$1" = "0" ]; then
-	%{_sbindir}/php-module-install remove calendar %{_sysconfdir}/php.ini
-fi
+%postun calendar
+%extension_postun
 
 %post cpdf
-%{_sbindir}/php-module-install install cpdf %{_sysconfdir}/php.ini
+%extension_post
 
-%preun cpdf
-if [ "$1" = "0" ]; then
-	%{_sbindir}/php-module-install remove cpdf %{_sysconfdir}/php.ini
-fi
+%postun cpdf
+%extension_postun
 
 %post ctype
-%{_sbindir}/php-module-install install ctype %{_sysconfdir}/php.ini
+%extension_post
 
-%preun ctype
-if [ "$1" = "0" ]; then
-	%{_sbindir}/php-module-install remove ctype %{_sysconfdir}/php.ini
-fi
+%postun ctype
+%extension_postun
<<Diff was trimmed, longer than 597 lines>>

---- CVS-web:
    http://cvs.pld-linux.org/SPECS/php.spec?r1=1.459&r2=1.460&f=u




More information about the pld-cvs-commit mailing list