%{expand:%%define version %(php -v 2>/dev/null)} %define phpdir %{_libdir}/php %define phpsource /usr/src/php-devel %define release 1mdk %define realname dba-bundle %define extname dba_bundle Summary: A %{realname} module for PHP4 Name: php-%{extname} URL: http://www.pwp.net Version: %{version} Release: %{release} Group: System/Servers License: PHP License Prereq: php-common = %{version} Prereq: perl Requires: libgdbm2 Requires: db3 BuildRequires: php-devel = %{version} BuildRequires: libgdbm2-devel BuildRequires: libdb3.3-devel ### JMD: we should fix this, as cdb-devel is in the contribs... BuildRequires: cdb-devel BuildRoot: %{_tmppath}/%{name}-root Provides: php-dba_gdbm_db2 php-cdb php-db2 php-db3 php-db3 Obsoletes: php-dba_gdbm_db2 php-cdb php-db2 php-db3 php-db3 %description The php-%{extname} package is a dynamic shared object (DSO) that adds cdb, 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 cdb, 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 dba_cdb.c" \ "-lm -lc -lgdbm -ldb-3.3 -lcdb" "-DHAVE_DBA -DCOMPILE_DL_DBA \ -DDBA_GDBM -DDBA_DB3 -DDB3_INCLUDE_FILE -DDBA_CDB" %install cd dba [ "%{buildroot}" != "/" ] && rm -rf %{buildroot} mkdir -p %{buildroot}%{phpdir}/extensions install -m 755 -s db3.so \ %{buildroot}%{phpdir}/extensions/%{extname}.so mkdir -p %{buildroot}%{_docdir}/%{name}-%{version} echo > %{buildroot}%{_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=%{extname}.so' is uncommented in your /etc/php.ini file. EOF %clean [ "%{buildroot}" != "/" ] && rm -rf %{buildroot} [ -e ./dba ] && rm -fr ./dba %post alias FIXME="perl -pi -e" FIXME 's|gdbm_db2|dba_bundle|g' %{_sysconfdir}/php.ini FIXME 's|gdbm_db3|dba_bundle|g' %{_sysconfdir}/php.ini 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) %dir %{_docdir}/%{name}-%{version} %{_docdir}/%{name}-%{version}/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 - Rebuild for 4.2.2 - Macroize a bit more, make version depend on "php -v" * Fri May 31 2002 Christian Belisle <cbelisle@mandrakesoft.com> 4.2.1-2mdk - rebuild. * Tue May 21 2002 Christian Belisle <cbelisle@mandrakesoft.com> 4.2.1-1mdk - updated by Oden Eriksson <oden.eriksson@kvikkjokk.net> - misc spec file fixes - PHP 4.2.1 * Thu May 02 2002 Christian Belisle <cbelisle@mandrakesoft.com> 4.2.0-2mdk - fix error in Prereq (thanks to Oden). * Wed May 01 2002 Christian Belisle <cbelisle@mandrakesoft.com> 4.2.0-1mdk - updated by Oden Eriksson <oden.eriksson@kvikkjokk.net>: - renamed the php-dba_gdbm_db3 package to php-dba_bundle - added cdb support - PHP 4.2.0 * 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