Sophie

Sophie

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

php-xml-4.1.2-1mdk.src.rpm

%define phpversion 4.1.2
%define phprelease 1mdk
%define phpdir %{_libdir}/php 
%define phpsource /usr/src/php-devel
%define release 1mdk

Summary:	XML module for PHP4
Name:		php-xml
Version:	%{phpversion}
Release:	%{release}
Group:		System/Servers
URL:		http://www.php.net
License:	PHP License
BuildRoot:	%{_tmppath}/%{name}-root
Prereq:		php-common = %{phpversion}, perl
Requires:	libexpat1_95
BuildRequires:  php-devel = %{phpversion}
BuildRequires:	libexpat1_95-devel

%description
The php-XML package is a dynamic shared object (DSO) that adds XML support to 
PHP4. PHP4 is an HTML-embedded scripting language. If you need XML support for 
PHP4 applications, you will need to install this package in addition to the php 
package.

%build
[ -e ./xml ] && rm -fr ./xml
cp -dpR %{phpsource}/extensions/xml .
cd xml

%{phpsource}/buildext xml xml.c "-lexpat" "-DCOMPILE_DL_XML -DHAVE_LIBEXPAT -DHAVE_DLFCN_H" 


%install
cd xml
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT 
mkdir -p $RPM_BUILD_ROOT%{phpdir}/extensions

install -m 755 -s xml.so $RPM_BUILD_ROOT%{phpdir}/extensions/

mkdir -p $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}
echo > $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}/README <<EOF
The php-xml package contains a dynamic shared object (DSO) for PHP4. 
To activate it, make sure the line 'extension=xml' is uncommented
in your /etc/php.ini file.
EOF

%clean
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
[ -e ./xml ] && rm -fr ./xml

%post
if [ $1 = "1" ]; then
  if [ -f %{_sysconfdir}/php.ini ]; then
    perl -pi -e 's|^;extension\s*=\s*xml.so|extension = xml.so|' %{_sysconfdir}/php.ini
    LINE=`grep xml\.so %{_sysconfdir}/php.ini |grep extension`
    if [ "x$LINE" = "x" ]; then
      echo extension = xml.so >> %{_sysconfdir}/php.ini
    fi
  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)
   #Also, there could be extra lines, so make sure we uncomment one
   #Finally, don't check for presence of php.ini, if it's not there,
   #we have a problem, so it should generate an error message.
   perl -pi -e 's|^extension\s*=\s*xml.so|;extension = xml.so|g' %{_sysconfdir}/php.ini
   perl -pi -e 's|^;extension\s*=\s*xml.so|extension = xml.so|' %{_sysconfdir}/php.ini
fi
if [ -e %{_sbindir}/AESctl ]; then %{_sbindir}/AESctl reload;fi 

%preun
if [ $1 = "0" ]; then
  if [ -f %{_sysconfdir}/php.ini ]; then
    perl -pi -e 's|^extension\s*=\s*xml.so|;extension = xml.so|g' %{_sysconfdir}/php.ini
  fi
  if [ -e %{_sbindir}/AESctl ]; then %{_sbindir}/AESctl reload;fi 
fi

%files 
%defattr(-,root,root)
%{phpdir}/extensions/xml.so
%dir %{_docdir}/%{name}-%{version}
%{_docdir}/%{name}-%{version}/README

%changelog
* Mon Mar 02 2002 Jean-Michel Dault <jmdault@mandrakesoft.com> 4.1.2-1mdk
- Moved the XML functionnality into this php-xml package to get rid of
  segfault problems with different expat libraries statically linked into
  different parts of Apache.