%{expand:%%define version %(php -v)} %define phpdir %{_libdir}/php %define phpsource /usr/src/php-devel %define release 1mdk %define realname DIO %define extname dio 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 BuildRequires: php-devel = %{version} Provides: mod_php-%{extname} Provides: mod_php3-%{extname} Obsoletes: mod_php-%{extname} Obsoletes: mod_php3-%{extname} BuildRoot: %{_tmppath}/%{name}-root %define _docdir %{_datadir}/doc/%{name}-%{version} %description The php-%{extname} package is a dynamic shared object (DSO) that adds %{realname} support to PHP4. PHP4 is an HTML-embedded scripting language. If you need %{realname} support for PHP4 applications, you will need to install this package in addition to the php package. %build [ -e ./%{extname} ] && rm -fr ./%{extname} cp -dpR %{phpsource}/extensions/%{extname} . cd %{extname} %{phpsource}/buildext %{extname} "dio.c" "-DCOMPILE_DL_DIO -DHAVE_DIO" %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 if [ $1 = "1" ]; then if [ -f %{_sysconfdir}/php.ini ]; then perl -pi -e '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. perl -pi -e 's|^extension\s*=\s*%{extname}.so|;extension = %{extname}.so|g' %{_sysconfdir}/php.ini perl -pi -e 's|^;extension\s*=\s*%{extname}.so|extension = %{extname}.so|' %{_sysconfdir}/php.ini fi %preun if [ $1 = "0" ]; then if [ -f %{_sysconfdir}/php.ini ]; then perl -pi -e '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 * Sun Sep 15 2002 Oden Eriksson <oden.eriksson@kvikkjokk.net> 4.2.3-1mdk - initial cooker contrib