%define phpversion 4.0.4pl1 %define phprelease 6mdk %define phpdir %{_libdir}/php %define phpsource /usr/src/php-devel Summary: IMAP module for PHP4 Name: php-imap Version: %{phpversion} Release: 6mdk Group: System/Servers Copyright: PHP License BuildRoot: %{_tmppath}/%{name}-root Prereq: php-common = %{phpversion}, perl Requires: imap, pam BuildRequires: php-devel = %{phpversion} BuildRequires: imap-devel, pam-devel Obsoletes: mod_php-imap %description The php-imap package contains a dynamic shared object (DSO) for PHP4. The php-imap module adds IMAP (Internet Message Access Protocol) support to PHP4. IMAP is a protocol for retrieving and uploading e-mail messages on mail servers. PHP is an HTML-embedded scripting language for use with a web server. If you need IMAP support for PHP4 applications, you will need to install this package and PHP4. %build [ -e ./imap ] && rm -fr ./imap cp -dpR %{phpsource}/extensions/imap . cd imap %{phpsource}/buildext imap php_imap.c \ "%{_libdir}/libc-client.a -lpam" "-DCOMPILE_DL_IMAP" %install cd imap [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT mkdir -p $RPM_BUILD_ROOT%{phpdir}/extensions install -m 755 -s imap.so $RPM_BUILD_ROOT%{phpdir}/extensions/ mkdir -p $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version} echo > $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}/README <<EOF The php-imap package contains a dynamic shared object (DSO) for PHP4. To activate it, make sure the line 'extension=imap.so' is uncommented in your /etc/php.ini file. EOF %clean [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT [ -e ./imap ] && rm -fr ./imap %post if [ $1 = "1" ]; then if [ -f %{_sysconfdir}/php.ini ]; then perl -pi -e 's|^;extension\s*=\s*imap.so|extension = imap.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*imap.so|;extension = imap.so|g' %{_sysconfdir}/php.ini perl -pi -e 's|^;extension\s*=\s*imap.so|extension = imap.so|' %{_sysconfdir}/php.ini fi if [ -e %{_sbindir}/AESctl ]; then %{_sbindir}/AESctl update;fi %preun if [ $1 = "0" ]; then if [ -f %{_sysconfdir}/php.ini ]; then perl -pi -e 's|^extension\s*=\s*imap.so|;extension = imap.so|g' %{_sysconfdir}/php.ini fi if [ -e %{_sbindir}/AESctl ]; then %{_sbindir}/AESctl update;fi fi %files %defattr(-,root,root) %{phpdir}/extensions/imap.so %dir %{_docdir}/%{name}-%{version} %{_docdir}/%{name}-%{version}/README %changelog * 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 imap package from php package so that when a new imap package comes out, we don't have to recompile php, only this module