Sophie

Sophie

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

php-dba_gdbm_db3-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:	A dba-gdbm-db3 module for PHP4
Name:		php-dba_gdbm_db3
URL:		http://www.pwp.net
Version:	%{phpversion}
Release:	%{release}
Group:		System/Servers
License:	PHP License
BuildRoot:	%{_tmppath}/%{name}-root
Prereq:		php-common = %{phpversion}, perl
Requires:	libgdbm2, db3
BuildRequires:  php-devel = %{phpversion}
BuildRequires:	libgdbm2-devel, libdb3.3-devel
Provides:	php-dba_gdbm_db2
Obsoletes:	php-dba_gdbm_db2

%description
The php-dba_gdbm_db3 package is a dynamic shared object (DSO) that adds
gdbm and db3 support to PHP4.
 
These functions build the foundation for accessing Berkeley DB style
databases. This is a general abstraction layer for several file-based
databases. As such, functionality is limited to a subset of features modern
databases such as Sleepycat Software' DB3 support. The behaviour of various 
aspects depend on the implementation of the underlying database. Functions 
such as dba_optimize() and dba_sync() will do what they promise for one 
database and will do nothing for others.
 
PHP4 is an HTML-embedded scripting language. If you need db3 or gdbm
support for PHP4 applications, you will need to install this package in
addition to the php package.

***WARNING***
The db3 format is not-compatible with the db2 format, you will have
to use "db_upgrade <file>" (the command is in db3-utils) to remake each
database. Also, you will need to change the handler to "db3" in all your
"dba_open" directives in your php files. 

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

perl -pi -e 's|#include DB3_INCLUDE_FILE$|#include \"db.h"|g;' *db3.c
perl -pi -e 's|#if ([A-Z_])|#ifdef \1|' *.{c,h}

%{phpsource}/buildext db3 "dba.c dba_gdbm.c dba_db3.c" \
	"-lm -lc -lgdbm -ldb-3.3" "-DHAVE_DBA -DCOMPILE_DL_DBA \
	-DDBA_GDBM \
	-DDBA_DB3 -DDB3_INCLUDE_FILE"

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

install -m 755 -s db3.so \
	$RPM_BUILD_ROOT%{phpdir}/extensions/dba_gdbm_db3.so

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

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


%post
#The package name has changed, so make sure we change php.ini even at
#install.
perl -pi -e 's|gdbm_db2|gdbm_db3|g' %{_sysconfdir}/php.ini
if [ $1 = "1" ]; then
  if [ -f %{_sysconfdir}/php.ini ]; then
    perl -pi -e 's|^;extension\s*=\s*dba_gdbm_db3.so|extension = dba_gdbm_db3.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.
   perl -pi -e 's|^extension\s*=\s*dba_gdbm_db3.so|;extension = dba_gdbm_db3.so|g' %{_sysconfdir}/php.ini
   perl -pi -e 's|^;extension\s*=\s*dba_gdbm_db3.so|extension = dba_gdbm_db3.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*dba_gdbm_db3.so|;extension = dba_gdbm_db3.so|g' %{_sysconfdir}/php.ini
  fi
  if [ -e %{_sbindir}/AESctl ]; then %{_sbindir}/AESctl reload;fi 
fi


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

%changelog
* Mon Mar 04 2002 Jean-Michel Dault <jmdault@mandrakesoft.com> 4.1.2-1mdk
- PHP 4.1.2

* 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 Oct 18 2001 Christian Belisle <cbelisle@mandrakesoft.com> 4.0.6-5mdk
- new db3

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

* Tue Aug 28 2001 Christian Belisle <cbelisle@mandrakesoft.com> 4.0.6-3mdk
- s/libgdbm1/libgdbm2

* Fri Jul 13 2001 Vincent Danen <vdanen@mandrakesoft.com> 4.0.6-2mdk
- rebuild against db3.2

* 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 post scripts for good 

* Mon Apr  2 2001 Jean-Michel Dault <jmdault@mandrakesoft.com> 4.0.4pl1-4mdk
- Split dba_gdbm_db3 package from php package so that when a new gdbm, db2
  or db3 package comes out, we don't have to recompile php, only this module