Sophie

Sophie

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

php-bzip2-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	modname	bz2
%define dirname	%{modname}
%define soname	%{modname}.so
%define subname	bzip2

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

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

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

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

%{phpsource}/buildext %{modname} %{modname}.c "-lbz2" "-DCOMPILE_DL_BZ2 -DHAVE_BZ2"

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

install -m755 %{soname} %{buildroot}%{phpdir}/extensions/

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

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

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

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

%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
- Rebuild for 4.2.2
- Macroize a bit more, make version depend on "php -v"

* Mon May 27 2002 Oden Eriksson <oden.eriksson@kvikkjokk.net> 4.2.1-3mdk
- rebuilt against php-4.2.1 this time (klama is wierd...)
- added Requires: php-common

* Mon May 27 2002 Oden Eriksson <oden.eriksson@kvikkjokk.net> 4.2.1-2mdk
- misc spec file fixes

* Tue May 21 2002 Christian Belisle <cbelisle@mandrakesoft.com> 4.2.1-1mdk
- new version.

* Sun May 19 2002 Oden Eriksson <oden.eriksson@kvikkjokk.net> 4.2.0-2mdk
- rebuilt with gcc3.1

* Mon Apr 29 2002 Christian Belisle <cbelisle@mandrakesoft.com> 4.2.0-1mdk
- updated by Oden Eriksson <oden.eriksson@kvikkjokk.net>:
	- misc spec file fixes
	- PHP 4.2.0
- Alexander Skwar <ASkwar@DigitalProjects.com> also worked on it:
	- First release of the php-bz2 package