Sophie

Sophie

distrib > Mandriva > 8.2 > i586 > media > main-src > by-pkgid > e4af09fcfa16e3fb591ad4c5d9e9683a > files > 1

mod_php-4.1.2-1mdk.src.rpm

%define mm_major 1
%define mm_minor 1.3
%define apache_version 1.3.23
%define apache_release 1mdk
%define phpversion 4.1.2
%define phprelease 1mdk
%define phpsource /usr/src/php-devel

%define release 1mdk
%define name mod_php

Name:		%{name}
Version:	%{phpversion}
Release:	%{release}
Summary:	The PHP4 HTML-embedded scripting language for use with Apache.
Group:		System/Servers
URL:		http://www.php.net/ 
License:	PHP License
Source1:	php.conf

Prereq:		apache-common = %{apache_version}
Prereq:		apache-conf = %{apache_version}
Prereq: 	mm = %{mm_major}.%{mm_minor}
Requires:	apache
Requires:	php-common = %{phpversion}
BuildRequires:  php-devel = %{phpversion}
BuildRequires:	apache-devel = %{apache_version}
BuildRequires:  mm-devel = %{mm_major}.%{mm_minor}, perl >= 5.600
BuildRequires:  libgdbm2-devel, db3-devel, db1-devel
#glibc-devel provides libpthread.so
BuildRequires:  glibc-devel
Provides:	mod_php3, php3, phpfi
Obsoletes:	mod_php3, php3, phpfi
BuildRoot:	%{_tmppath}/%{name}-root

%define sysconfdir /etc
%define apachebase %{sysconfdir}/httpd
%define apacheroot /var/www
%define apachecontent /var/www/html
%define phpdir %{_libdir}/php

%description
PHP is an HTML-embedded scripting language.  PHP attempts to make it
easy for developers to write dynamically generated web pages.  PHP
also offers built-in database integration for several commercial
and non-commercial database management systems, so writing a
database-enabled web page with PHP is fairly simple.  The most
common use of PHP coding is probably as a replacement for CGI
scripts.  The mod_php module enables the Apache web server to
understand and process the embedded PHP language in web pages.

This package contains PHP version 4. You'll also need to install the
Apache web server.


%build
[ -e ./mod_php-%{version} ] && rm -rf ./mod_php-%{version}
mkdir mod_php-%{version}
cd mod_php-%{version}
cp %{phpsource}/sapi/apache/* .

/usr/sbin/apxs -c -I. -I -I./main -I. -I/usr/include/php \
	-I/usr/include/php/main \
	-I/usr/include/php/Zend \
	-I/usr/include/php/TSRM \
	-lphp_common -lpthread -lgdbm -lmm \
	-DHAVE_AP_COMPAT_H \
        php_apache.c sapi_apache.c mod_php4.c  -o libphp4.so 

%install
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT 
cd mod_php-%{version}

mkdir -p $RPM_BUILD_ROOT%{_libdir}/apache-extramodules
mkdir -p $RPM_BUILD_ROOT%{apachebase}/conf/addon-modules

mkdir -p $RPM_BUILD_ROOT%{_docdir}/mod_php-%{version}
cp %{phpsource}/PHP_FAQ.php \
	$RPM_BUILD_ROOT%{_docdir}/mod_php-%{version}

install -m 644 %{SOURCE1} \
	$RPM_BUILD_ROOT%{apachebase}/conf/addon-modules/php.conf
install -m 755 -s libphp4.so \
	$RPM_BUILD_ROOT%{_libdir}/apache-extramodules/

mkdir -p $RPM_BUILD_ROOT%{apachecontent}/addon-modules
pushd $RPM_BUILD_ROOT%{apachecontent}/addon-modules
ln -s ../../../..%{_docdir}/mod_php-%{version} mod_php
popd


%clean
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
[ -e ./mod_php-%{version} ] && rm -rf ./mod_php-%{version}

%post
if [ $1 = "1" ]; then 
   #We're in Install mode, add module to the config files
   for config in %{apachebase}/conf/{httpd,httpd-perl}.conf; do
     if [ -x %{_sbindir}/advxaddmod -a -e $config ]; then
       %{_sbindir}/advxaddmod $config \
	extramodules/libphp4.so mod_php4.c php4_module \
	before=perl define=HAVE_PHP4 addconf=conf/addon-modules/php.conf
     fi
   done
   if [ -x %{_sbindir}/AESctl ]; then %{_sbindir}/AESctl update;fi 
fi

if [ $1 -gt 1 ]; then 
   #We're in *upgrade mode*. Since we can't be sure the configuration files
   #are sane, remove module from the conf files to clean them, re-add again 
   #in a way that the older module we're replacing won't try to erase (the 
   #post scripts were broken on some packages), and finally clean the module
   #specific config file so it's compatible with the upgrade.
   for config in %{apachebase}/conf/{httpd,httpd-perl}.conf; do
     if [ -x %{_sbindir}/advxdelmod -a -e $config ]; then
       %{_sbindir}/advxdelmod $config \
	extramodules/libphp4.so mod_php4.c php4_module \
	define=HAVE_PHP4 addconf=conf/addon-modules/php.conf
     fi
     if [ -x %{_sbindir}/advxaddmod -a -e $config ]; then
       %{_sbindir}/advxaddmod $config \
	extramodules/libphp4.so mod_php4.c php4_module \
	before=perl define=HAVE_PHP4 addconf=conf/addon-modules/php.conf
     fi
   done
   if [ -x %{_sbindir}/advxfixconf ]; then
       %{_sbindir}/advxfixconf %{apachebase}/conf/addon-modules/php.conf \
	libphp4.so mod_php4.c php4_module ifmodule
   fi
   if [ -x %{_sbindir}/AESctl ]; then %{_sbindir}/AESctl update;fi 
fi

%postun
if [ $1 = "0" ]; then 
   for config in %{apachebase}/conf/{httpd,httpd-perl}.conf; do
     if [ -x %{_sbindir}/advxdelmod -a -e $config ]; then
       %{_sbindir}/advxdelmod $config \
	extramodules/libphp4.so mod_php4.c php4_module \
	define=HAVE_PHP4 addconf=conf/addon-modules/php.conf
     fi
   done
   if [ -x %{_sbindir}/AESctl ]; then %{_sbindir}/AESctl update;fi 
fi


%files -n mod_php
%defattr(-,root,root)
%{_libdir}/apache-extramodules/libphp4.so
%config(noreplace) %{apachebase}/conf/addon-modules/php.conf
%dir %{_docdir}/mod_php-%{version}
%doc %{_docdir}/mod_php-%{version}/*
%{apachecontent}/addon-modules/*

%changelog
* Mon Mar 02 2002 Jean-Michel Dault <jmdault@mandrakesoft.com> 4.1.2-1mdk
- 4.1.2 = 4.1.1 + patch, but needed to recompile because Zend optimizer and
  other addons won't work if the API doesn't say 4.1.2

* Mon Feb 04 2002 Christian Belisle <cbelisle@mandrakesoft.com> 4.1.1-2mdk
- Rebuild against latest apache.

* Mon Jan 07 2002 Christian Belisle <cbelisle@mandrakesoft.com> 4.1.1-1mdk
- PHP 4.1.1.

* Tue Dec 11 2001 Christian Belisle <cbelisle@mandrakesoft.com> 4.1.0-1mdk
- PHP 4.1.0.

* Thu Nov 22 2001 Christian Belisle <cbelisle@mandrakesoft.com> 4.0.6-8mdk
- Rebuild to fix invalid-packager warning (rpmlint).

* Tue Oct 16 2001 Christian Belisle <cbelisle@mandrakesoft.com> 4.0.6-7mdk
- apache 1.3.22.

* Thu Oct 11 2001 Christian Belisle <cbelisle@mandrakesoft.com> 4.0.6-6mdk
- make rpmlint happier.

* Mon Sep 10 2001 Christian Belisle <cbelisle@mandrakesoft.com> 4.0.6-5mdk
- Provides the Obsoletes for compatibility.

* Wed Aug 29 2001 Philippe Libat <philippe@mandrakesoft.com> 4.0.6-4mdk
- libgdbm2

* Wed Jul 11 2001 Philippe Libat <philippe@mandrakesoft.com> 4.0.6-3mdk
- new apache version

* Mon Jul  9 2001 Vincent Danen <vdanen@mandrakesoft.com> 4.0.6-2mdk
- removed Obsoletes: php-mysql

* Wed Jul  4 2001 Vincent Danen <vdanen@mandrakesoft.com> 4.0.6-1mdk
- 4.0.6
- s/Copyright/License/

* Thu Apr 12 2001 Jean-Michel Dault <jmdault@mandrakesoft.com> 4.0.4pl1-6mdk
- fix requires

* Mon Apr  9 2001 Jean-Michel Dault <jmdault@mandrakesoft.com> 4.0.4pl1-5mdk
- fix upgrade scripts (for good this time I hope)

* Wed Mar 28 2001 Jean-Michel Dault <jmdault@mandrakesoft.com> 4.0.4pl1-4mdk
- Put mod_php into its own package so we don't have to recompile php
  for each apache minor release