Sophie

Sophie

distrib > Mandriva > 9.0 > i586 > media > contrib-src > by-pkgid > 0e57c2d69856bac456d2eaea547152da > files > 1

php-openssl-4.2.3-1mdk.src.rpm

%{expand:%%define version %(php -v 2>/dev/null)}
%define phpdir %{_libdir}/php 
%define phpsource /usr/src/php-devel
%define release 1mdk
%define realname OpenSSL
%define extname openssl

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

%define _docdir %{_datadir}/doc/%{name}-%{version}

%description
The php-%{extname} package contains a dynamic shared object that will add
%{extname} to PHP. PHP is an HTML-embeddable scripting language. If you
need %{extname} support for PHP applications, you will need to install
this package and the php package.

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

phpize
%configure --with-openssl=/usr
make
mv modules/*.so .

%install
cd %{extname}
[ "%{buildroot}" != "/" ] && rm -rf %{buildroot} 
mkdir -p %{buildroot}%{phpdir}/extensions
mkdir -p %{buildroot}%{_docdir}

install -m755 %{extname}.so %{buildroot}%{phpdir}/extensions/

cat > %{buildroot}%{_docdir}/README <<EOF
The php-%{extname} package contains a dynamic shared object (DSO) for PHP4. 
To activate it, make sure the line 'extension = %{extname}.so' is uncommented
in your /etc/php.ini file.
EOF

%clean
[ "%{buildroot}" != "/" ] && rm -rf %{buildroot}
[ -e ./%{extname} ] && rm -fr ./%{extname}

%post
alias FIXME="perl -pi -e"
if [ $1 = "1" ]; then
  if [ -f %{_sysconfdir}/php.ini ]; then
    FIXME 's|^;extension\s*=\s*%{extname}.so|extension = %{extname}.so|' %{_sysconfdir}/php.ini
  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.
   FIXME 's|^extension\s*=\s*%{extname}.so|;extension = %{extname}.so|g' %{_sysconfdir}/php.ini
   FIXME 's|^;extension\s*=\s*%{extname}.so|extension = %{extname}.so|' %{_sysconfdir}/php.ini
fi

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

%files 
%defattr(-,root,root)
%doc %{_docdir}/README
%{phpdir}/extensions/%{extname}.so

%changelog
* Sat Sep  7 2002 Jean-Michel Dault <jmdault@mandrakesoft.com> 4.2.3-1mdk
- 4.2.3 maintenance release
- Do not reload apache

* Thu Aug 22 2002 Jean-Michel Dault <jmdault@mandrakesoft.com> 4.2.2-1mdk
- New version 4.2.2. Was splitted from the main package so php-common does
  not require openssl