%define contentdir /var/www Summary: The PHP HTML-embedded scripting language Name: php Version: 5.2.5 Release: 1 License: The PHP License v3.01 Group: Development/Languages URL: http://www.php.net/ Source0: http://www.php.net/distributions/%{name}-%{version}.tar.bz2 Source1: php.conf Source2: php.ini Patch0: %{name}-%{version}-aix.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root BuildRequires: gd-devel >= 2.0.35 BuildRequires: bzip2, libjpeg-devel, libpng-devel, zlib-devel BuildRequires: httpd-devel >= 2.2.6-1 BuildRequires: openssl-devel, freetype-devel BuildRequires: pcre-devel >= 7.4 Provides: mod_php = %{version}-%{release} Requires: php-common = %{version}-%{release} Requires: bzip2, freetype, libjpeg, libpng, openssl, t1lib, zlib Requires: gd >= 2.0.35 Requires: httpd >= 2.2.6-1 Requires: pcre >= 7.4 %description PHP is an HTML-embedded scripting language. PHP attempts to make it easy for developers to write dynamically generated webpages. PHP also offers built-in database integration for several commercial and non-commercial database management systems, so writing a database-enabled webpage with PHP is fairly simple. The most common use of PHP coding is probably as a replacement for CGI scripts. The php package contains the module which adds support for the PHP language to Apache HTTP Server. %package cli Group: Development/Languages Summary: Command-line interface for PHP Provides: php-cgi = %{version}-%{release} Requires: php-common = %{version}-%{release} Requires: bzip2, freetype, libjpeg, libpng, openssl, t1lib, zlib Requires: gd >= 2.0.35 Requires: pcre >= 7.4 %description cli The php-cli package contains the command-line interface executing PHP scripts, /opt/freeware/bin/php, and the CGI interface. %package common Group: Development/Languages Summary: Common files for PHP %description common The php-common package contains files used by both the php package and the php-cli package. %package devel Group: Development/Libraries Summary: Files needed for building PHP extensions Requires: php = %{version}-%{release} Requires: gd-devel >= 2.0.35 Requires: libjpeg-devel, libpng-devel, zlib-devel Requires: httpd-devel >= 2.2.6-1 Requires: openssl-devel, freetype-devel Requires: pcre-devel >= 7.4 %description devel The php-devel package contains the files needed for building PHP extensions. If you need to compile your own PHP extensions, you will need to install this package. %prep %setup -q %patch0 %build # shell function to configure and build a PHP tree buildphp() { ln -sf ../configure ./configure \ --cache-file=../config.cache \ --prefix=/opt/freeware \ --with-config-file-path=/opt/freeware/etc \ --enable-shared --enable-static \ --without-pear \ --with-gd=/opt/freeware \ --with-openssl=/opt/freeware \ --with-zlib \ --with-bz2 \ --without-curl \ --with-t1lib=/opt/freeware \ --with-freetype-dir=/opt/freeware \ --with-jpeg-dir=/opt/freeware \ --with-png-dir=/opt/freeware \ --with-xpm-dir=/opt/freeware \ --with-zlib-dir=/opt/freeware \ --enable-bcmath \ --with-ncurses \ --enable-soap \ --enable-ftp \ --with-iconv \ --enable-dom \ --enable-json \ --with-pcre-regex=/opt/freeware \ $* make %{?_smp_mflags} } # build the command line and the CGI version of PHP mkdir build-cgi cd build-cgi buildphp cd .. # build the Apache module mkdir build-apache cd build-apache buildphp \ --with-apxs2=/opt/freeware/sbin/apxs cd .. %install [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT # unfortunately 'make install-sapi' does not seem to work for use, therefore # we have to install the targets separately cd build-cgi for TARGET in install-cli install-build install-headers install-programs ; do make INSTALL_ROOT=$RPM_BUILD_ROOT ${TARGET} done # install the php-cgi binary cp sapi/cgi/php-cgi $RPM_BUILD_ROOT%{_bindir} chmod 755 $RPM_BUILD_ROOT%{_bindir}/php-cgi # install the DSO cd ../build-apache mkdir -p $RPM_BUILD_ROOT%{_libdir}/httpd/modules chmod 755 $RPM_BUILD_ROOT%{_libdir}/httpd/modules cp .libs/libphp5.so $RPM_BUILD_ROOT%{_libdir}/httpd/modules chmod 755 $RPM_BUILD_ROOT%{_libdir}/httpd/modules/libphp5.so cd .. # strip binaries strip $RPM_BUILD_ROOT%{_bindir}/php strip $RPM_BUILD_ROOT%{_bindir}/php-cgi strip $RPM_BUILD_ROOT%{_libdir}/httpd/modules/libphp5.so # install the Apache httpd config file for PHP mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/httpd/conf/extra chmod 755 $RPM_BUILD_ROOT%{_sysconfdir}/httpd/conf/extra cp %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/httpd/conf/extra/httpd-php.conf chmod 644 $RPM_BUILD_ROOT%{_sysconfdir}/httpd/conf/extra/httpd-php.conf # install the default configuration file and icons cp %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/php.ini mkdir -p $RPM_BUILD_ROOT%{contentdir}/icons chmod 755 $RPM_BUILD_ROOT%{contentdir}/icons cp php.gif $RPM_BUILD_ROOT%{contentdir}/icons # for third-party packaging: mkdir -p $RPM_BUILD_ROOT%{_libdir}/php/pear chmod 755 $RPM_BUILD_ROOT%{_libdir}/php/pear mkdir -p $RPM_BUILD_ROOT/var/lib/php chmod 755 $RPM_BUILD_ROOT/var/lib/php mkdir -p $RPM_BUILD_ROOT/var/lib/php/session chmod 700 $RPM_BUILD_ROOT/var/lib/php/session %preun if [ "$1" = 0 ]; then cat %{_sysconfdir}/httpd/conf/httpd.conf | \ grep -v "# PHP settings" | \ grep -v "Include conf/extra/httpd-php.conf" \ > %{_sysconfdir}/httpd/conf/tmp_httpd.conf mv -f %{_sysconfdir}/httpd/conf/tmp_httpd.conf %{_sysconfdir}/httpd/conf/httpd.conf echo "Please restart your web server using: '/opt/freeware/sbin/apachectl restart'" fi %post cat %{_sysconfdir}/httpd/conf/httpd.conf | \ grep -v "# PHP settings" | \ grep -v "Include conf/extra/httpd-php.conf" \ > %{_sysconfdir}/httpd/conf/tmp_httpd.conf mv -f %{_sysconfdir}/httpd/conf/tmp_httpd.conf %{_sysconfdir}/httpd/conf/httpd.conf echo "# PHP settings" >> %{_sysconfdir}/httpd/conf/httpd.conf echo "Include conf/extra/httpd-php.conf" >> %{_sysconfdir}/httpd/conf/httpd.conf echo "Please restart your web server using: '/opt/freeware/sbin/apachectl restart'" %clean [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,system) %{_libdir}/httpd/modules/libphp5.so %attr(0770,root,apache) %dir /var/lib/php/session %config(noreplace) %{_sysconfdir}/httpd/conf/extra/httpd-php.conf %{contentdir}/icons/php.gif %files common %defattr(-,root,system) %doc CODING_STANDARDS CREDITS EXTENSIONS INSTALL LICENSE NEWS README* %doc Zend/ZEND_* %config(noreplace) %{_sysconfdir}/php.ini %dir /var/lib/php %dir %{_libdir}/php %dir %{_libdir}/php/pear %files cli %defattr(-,root,system) %{_bindir}/php %{_bindir}/php-cgi %{_mandir}/man1/php.1 %files devel %defattr(-,root,system) %dir %{_libdir}/php %{_bindir}/php-config %{_bindir}/phpize %{_includedir}/php %{_libdir}/php/build %{_mandir}/man1/php-config.1 %{_mandir}/man1/phpize.1 %changelog * Mon Dec 03 2007 Michael Perzl - 5.2.5-1 - first version for AIX V5.1 and higher