# TODO
+# - lost patches:
+# +Patch11: %{name}-acam.patch
+# +Patch12: %{name}-threads-acfix.patch
+# +Patch13: %{name}-tsrmlsfetchgcc2.patch
+# +Patch16: %{name}-sybase-fix.patch
+# +Patch26: %{name}-pear.patch
+# +Patch28: %{name}-bug-42952.patch
+# +Patch30: %{name}-apr-apu.patch
+# +Patch31: %{name}-fcgi-error_log-no-newlines.patch
+# +Patch32: %{name}-curl-limit-speed.patch
+# +Patch33: %{name}-mime_magic.patch
+# +Patch34: %{name}-libtool.patch
+# +Patch36: %{name}-mysql-charsetphpini.patch
+# +Patch37: %{name}-mysqli-charsetphpini.patch
+# +Patch38: %{name}-pdo_mysql-charsetphpini.patch
+# +Patch44: %{name}-include_path.patch
+# +Patch45: %{name}-imap-annotations.patch
+# +Patch46: %{name}-imap-myrights.patch
+# +Patch51: spl-shared.patch
# - deal with modules removed from php and not moved to PECL, still not obsoleted anywhere
# - removed from php 5.0 (currently in php4):
# db, hyperwave, java, mcal, overload, qtdom
%bcond_without zts # disable Zend Thread Safety
%bcond_without fpm # fpm patches from http://www.php-fpm.org/
%bcond_without suhosin # with suhosin patch
-%bcond_with tests # default off; test process very often hangs on buildersl; perform "make test"
+%bcond_with tests # default off; test process very often hangs on builders; perform "make test"
%bcond_with type_hints # experimental support for strict typing/casting
%define apxs1 /usr/sbin/apxs1
%undefine with_interbase
%endif
-%ifnarch %{ix86} %{x8664}
+%ifnarch %{ix86} %{x8664} sparc sparcv9
# unsupported, see sapi/cgi/fpm/fpm_atomic.h
%undefine with_fpm
%endif
Source5: %{name}-cli.ini
# Taken from: http://browsers.garykeith.com/downloads.asp
Source9: %{name}_browscap.ini
+Source10: %{name}-fpm.init
+Source11: %{name}-fpm.logrotate
Patch0: %{name}-shared.patch
Patch1: %{name}-pldlogo.patch
Patch2: %{name}-mail.patch
Patch4: %{name}-libpq_fs_h_path.patch
Patch5: %{name}-filter-shared.patch
Patch6: %{name}-build_modules.patch
-Patch7: %{name}-config-file-scan-dir.patch
-Patch8: %{name}-sapi-ini-file.patch
+Patch7: %{name}-sapi-ini-file.patch
+Patch8: %{name}-config-file-scan-dir.patch
Patch9: %{name}-sh.patch
Patch10: %{name}-ini.patch
-Patch11: extension-shared-optional-dep.patch
Patch14: %{name}-no_pear_install.patch
Patch15: %{name}-zlib.patch
Patch17: %{name}-readline.patch
Patch19: %{name}-gd_imagerotate_enable.patch
Patch20: %{name}-uint32_t.patch
Patch21: %{name}-dba-link.patch
-Patch23: %{name}-both-apxs.patch
-Patch24: %{name}-builddir.patch
-Patch25: %{name}-zlib-for-getimagesize.patch
-Patch29: %{name}-config-dir.patch
-Patch30: %{name}-silent-session-cleanup.patch
-Patch31: %{name}-fcgi-graceful.patch
-Patch32: %{name}-m4-divert.patch
-Patch38: %{name}-tds.patch
-Patch39: %{name}-stupidapache_version.patch
+Patch22: %{name}-both-apxs.patch
+Patch23: %{name}-builddir.patch
+Patch24: %{name}-zlib-for-getimagesize.patch
+Patch25: %{name}-stupidapache_version.patch
+Patch27: %{name}-config-dir.patch
+Patch29: %{name}-fcgi-graceful.patch
+Patch35: %{name}-tds.patch
+Patch39: %{name}-use-prog_sendmail.patch
Patch40: %{name}-fpm.patch
-#Patch41: %{name}-fpm-config.patch
-#Patch42: %{name}-fpm-initdir.patch
-Patch43: %{name}-use-prog_sendmail.patch
+Patch41: %{name}-fpm-config.patch
+Patch42: %{name}-fpm-shared.patch
+Patch43: %{name}-silent-session-cleanup.patch
Patch47: suhosin.patch
+Patch49: %{name}-m4-divert.patch
+Patch50: extension-shared-optional-dep.patch
%if %{with type_hints}
-Patch50: http://ilia.ws/patch/type_hint_53_v2.txt
+Patch52: http://ilia.ws/patch/type_hint_53_v2.txt
%endif
URL: http://www.php.net/
%{?with_interbase:%{!?with_interbase_inst:BuildRequires: Firebird-devel >= 1.0.2.908-2}}
BuildRequires: apr-devel >= 1:1.0.0
BuildRequires: apr-util-devel >= 1:1.0.0
%endif
+%if %{with fpm}
+BuildRequires: judy-devel
+BuildRequires: libevent-devel >= 1.4.7-3
+%endif
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
%define php_sysconfdir /etc/php
%description program -l pl.UTF-8
Pakiet dostarczający dowiązanie symboliczne /usr/bin/php do PHP CLI.
+%package fpm
+Summary: PHP FastCGI Process Manager
+Group: Development/Languages/PHP
+URL: http://www.php-fpm.org/
+Requires(post,preun): /sbin/chkconfig
+Requires: %{name}-common = %{epoch}:%{version}-%{release}
+Requires: libevent >= 1.4.7-3
+Requires: rc-scripts
+Provides: webserver(php) = %{version}
+
+%description fpm
+PHP FastCGI Process Manager.
+
%package common
Summary: Common files needed by both Apache modules and CGI/CLI SAPI-s
Summary(pl.UTF-8): Wspólne pliki dla modułu apache'a i programu CGI
%{__sed} -i -e 's,\r$,,' Zend/Zend.dsp Zend/ZendTS.dsp
%if %{with type_hints}
-%patch50 -p0
+%patch52 -p0
%endif
%patch0 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
-%patch7 -p1
%patch8 -p1
+%patch7 -p1
%patch9 -p1
-
cp php.ini-production php.ini
%patch10 -p1
-
-%patch11 -p1
%patch14 -p1
%patch15 -p1
%patch17 -p1
%endif
%patch20 -p1
%patch21 -p1
-
+%patch22 -p1
%patch23 -p1
%patch24 -p1
%patch25 -p1
-
+%patch27 -p1
%patch29 -p1
-%patch30 -p1
-%patch31 -p1
-%patch32 -p1
-%patch38 -p1
+%patch35 -p1
%patch39 -p1
%if %{with fpm}
%patch40 -p1
-#%patch41 -p1
-#%patch42 -p1
+%patch41 -p1
+%patch42 -p1
%endif
-
%patch43 -p1
-
%if %{with suhosin}
%patch47 -p1
%endif
+%patch49 -p1
+%patch50 -p1
+
+# cleanup backups after patching
+find '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f
# conflict seems to be resolved by recode patches
rm -f ext/recode/config9.m4
#rm -rf ext/bcmath/libbcmath
#rm -rf ext/date/lib
#rm -rf ext/dba/libcdb
-cp -af Zend/LICENSE{,.Zend}
#rm -rf ext/dba/libflatfile
#rm -rf ext/dba/libinifile
#rm -rf ext/gd/libgd
#rm -rf ext/soap/interop
rm -rf ext/xmlrpc/libxmlrpc
+cp -af Zend/LICENSE{,.Zend}
+
# breaks build
sed -i -e 's#-fvisibility=hidden##g' configure*
fi
export EXTENSION_DIR="%{php_extensiondir}"
-if [ ! -f _built-conf ]; then # configure once (for faster debugging purposes)
- rm -f Makefile.{cgi-fcgi,cli,apxs{1,2}} # now remove Makefile copies
+# configure once (for faster debugging purposes)
+if [ ! -f _built-conf ]; then
+ # now remove Makefile copies
+ rm -f Makefile.{cgi-fcgi,fpm,cli,apxs{1,2}}
%{__libtoolize}
%{__aclocal}
cp -f /usr/share/automake/config.* .
sapis="
cgi-fcgi cli
+%if %{with fpm}
+fpm
+%endif
%if %{with apache1}
apxs1
%endif
"
for sapi in $sapis; do
: SAPI $sapi
- [ -f Makefile.$sapi ] && continue # skip if already configured (for faster debugging purposes)
+ # skip if already configured (for faster debugging purposes)
+ [ -f Makefile.$sapi ] && continue
sapi_args=''
case $sapi in
cgi-fcgi)
- sapi_args=''
+ sapi_args='--disable-cli'
;;
cli)
sapi_args='--disable-cgi'
;;
+ fpm)
+ sapi_args='--disable-cli --with-fpm'
+ ;;
apxs1)
ver=$(rpm -q --qf '%{V}' apache1-devel)
- sapi_args="--with-apxs=%{apxs1} --with-apache-version=$ver"
+ sapi_args="--disable-cli --with-apxs=%{apxs1} --with-apache-version=$ver"
;;
apxs2)
ver=$(rpm -q --qf '%{V}' apache-devel)
- sapi_args="--with-apxs2=%{apxs2} --with-apache-version=$ver"
+ sapi_args="--disable-cli --with-apxs2=%{apxs2} --with-apache-version=$ver"
;;
esac
--enable-json=shared \
--enable-hash=shared \
--enable-xmlwriter=shared \
+%if %{with fpm}
+ --with-libevent=shared \
+ --with-fpm-conf=%{_sysconfdir}/fpm.conf \
+ --with-fpm-log=/var/log/fpm.log \
+ --with-fpm-pid=/var/run/php/fpm.pid \
+ --with-fpm-port=9000 \
+ --with-fpm-user=http \
+ --with-fpm-group=http \
+%endif
%if %{with mssql} || %{with sybase_ct}
--with-pdo-dblib=shared \
%endif
--with-zlib-dir=shared,/usr \
--enable-zip=shared,/usr \
+ # save for debug
cp -f Makefile Makefile.$sapi
cp -f main/php_config.h php_config.h.$sapi
cp -f config.log config.log.$sapi
%{__make} libtool-sapi LIBTOOL_SAPI=sapi/apache2handler/libphp5.la -f Makefile.apxs2
%endif
-# CGI
+# CGI/FCGI
cp -af php_config.h.cgi-fcgi main/php_config.h
-rm -rf sapi/cgi/.libs sapi/cgi/*.lo
-%{__make} sapi/cgi/php-cgi -f Makefile.cgi-fcgi
+%{__make} -f Makefile.cgi-fcgi
[ "$(echo '<?=php_sapi_name();' | ./sapi/cgi/php-cgi -qn)" = cgi-fcgi ] || exit 1
# CLI
cp -af php_config.h.cli main/php_config.h
-%{__make} sapi/cli/php -f Makefile.cli
+%{__make} -f Makefile.cli
[ "$(echo '<?=php_sapi_name();' | ./sapi/cli/php -qn)" = cli ] || exit 1
+%if %{with fpm}
+cp -af php_config.h.fpm main/php_config.h
+%{__make} -f Makefile.fpm
+ ./sapi/fpm/php-fpm -qn -m > /dev/null
+%endif
+
%if %{with tests}
# Run tests, using the CLI SAPI
export NO_INTERACTION=1 REPORT_EXIT_STATUS=1 MALLOC_CHECK_=2
# better solution?
sed -i -e 's|libphp_common.la|$(libdir)/libphp_common.la|' $RPM_BUILD_ROOT%{_libdir}/php/build/acinclude.m4
-# install CGI
+# install CGI/FCGI
libtool --silent --mode=install install sapi/cgi/php-cgi $RPM_BUILD_ROOT%{_bindir}/php.cgi
ln -sf php.cgi $RPM_BUILD_ROOT%{_bindir}/php.fcgi
+# install FCGI PM
+%if %{with fpm}
+libtool --silent --mode=install install sapi/fpm/php-fpm $RPM_BUILD_ROOT%{_bindir}/php.fpm
+cp -a sapi/fpm/php-fpm.1 $RPM_BUILD_ROOT%{_mandir}/man1/php-fpm.1
+cp -a sapi/fpm/php_fpm.conf $RPM_BUILD_ROOT%{_sysconfdir}/fpm.conf
+install -d $RPM_BUILD_ROOT/etc/rc.d/init.d
+install -p %{SOURCE10} $RPM_BUILD_ROOT/etc/rc.d/init.d/php-fpm
+install -d $RPM_BUILD_ROOT/etc/logrotate.d
+cp -a %{SOURCE11} $RPM_BUILD_ROOT/etc/logrotate.d/php-fpm
+%endif
+
# install CLI
libtool --silent --mode=install install sapi/cli/php $RPM_BUILD_ROOT%{_bindir}/php.cli
install sapi/cli/php.1 $RPM_BUILD_ROOT%{_mandir}/man1/php.1
echo ".so php.1" >$RPM_BUILD_ROOT%{_mandir}/man1/php.cli.1
-
ln -sf php.cli $RPM_BUILD_ROOT%{_bindir}/php
sed -e 's#%{_prefix}/lib/php#%{_libdir}/php#g' php.ini > $RPM_BUILD_ROOT%{_sysconfdir}/php.ini
install -d $RPM_BUILD_ROOT%{_sysconfdir}
-install %{SOURCE5} $RPM_BUILD_ROOT%{_sysconfdir}/php-cli.ini
-install %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/php-cgi-fcgi.ini
-install %{SOURCE9} $RPM_BUILD_ROOT%{_sysconfdir}/browscap.ini
+cp -a %{SOURCE5} $RPM_BUILD_ROOT%{_sysconfdir}/php-cli.ini
+cp -a %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/php-cgi-fcgi.ini
+cp -a %{SOURCE9} $RPM_BUILD_ROOT%{_sysconfdir}/browscap.ini
%if %{with apache1}
-install %{SOURCE2} $RPM_BUILD_ROOT/etc/apache/conf.d/70_mod_php.conf
-install %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/php-apache.ini
+cp -a %{SOURCE2} $RPM_BUILD_ROOT/etc/apache/conf.d/70_mod_php.conf
+cp -a %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/php-apache.ini
rm -f $RPM_BUILD_ROOT%{_libdir}/apache1/libphp5.la
%endif
%if %{with apache2}
-install %{SOURCE2} $RPM_BUILD_ROOT/etc/httpd/conf.d/70_mod_php.conf
-install %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/php-apache2handler.ini
+cp -a %{SOURCE2} $RPM_BUILD_ROOT/etc/httpd/conf.d/70_mod_php.conf
+cp -a %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/php-apache2handler.ini
rm -f $RPM_BUILD_ROOT%{_libdir}/apache/libphp5.la
%endif
# tests
install -d $RPM_BUILD_ROOT%{php_data_dir}/tests/php
-install run-tests.php $RPM_BUILD_ROOT%{php_data_dir}/tests/php/run-tests.php
+install -p run-tests.php $RPM_BUILD_ROOT%{php_data_dir}/tests/php/run-tests.php
cp -a tests/* $RPM_BUILD_ROOT%{php_data_dir}/tests/php
%clean
%service -q httpd restart
fi
+%post fpm
+/sbin/chkconfig --add php-fpm
+%service php-fpm restart
+
+%preun fpm
+if [ "$1" = 0 ]; then
+ %service php-fpm stop
+ /sbin/chkconfig --del php-fpm
+fi
+
%post common -p /sbin/ldconfig
%postun common -p /sbin/ldconfig
%triggerun interbase -- %{name}-interbase < 4:5.0.4-9.1
%{__sed} -i -e '/^extension[[:space:]]*=[[:space:]]*interbase\.so/d' %{_sysconfdir}/php.ini
-%triggerun intl -- %{name}-intl < 4:5.0.4-9.1
-%{__sed} -i -e '/^extension[[:space:]]*=[[:space:]]*intl\.so/d' %{_sysconfdir}/php.ini
-
%triggerun ldap -- %{name}-ldap < 4:5.0.4-9.1
%{__sed} -i -e '/^extension[[:space:]]*=[[:space:]]*ldap\.so/d' %{_sysconfdir}/php.ini
%triggerun pgsql -- %{name}-pgsql < 4:5.0.4-9.1
%{__sed} -i -e '/^extension[[:space:]]*=[[:space:]]*pgsql\.so/d' %{_sysconfdir}/php.ini
-%triggerun phar -- %{name}-phar < 4:5.0.4-9.1
-%{__sed} -i -e '/^extension[[:space:]]*=[[:space:]]*phar\.so/d' %{_sysconfdir}/php.ini
-
%triggerun posix -- %{name}-posix < 4:5.0.4-9.1
%{__sed} -i -e '/^extension[[:space:]]*=[[:space:]]*posix\.so/d' %{_sysconfdir}/php.ini
%defattr(644,root,root,755)
%attr(755,root,root) %{_bindir}/php
+%if %{with fpm}
+%files fpm
+%defattr(644,root,root,755)
+%doc %lang(ru) sapi/fpm/readme-ru.markdown
+%doc sapi/fpm/nginx-site-conf.sample
+%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/fpm.conf
+%attr(755,root,root) %{_bindir}/php.fpm
+%{_mandir}/man1/php-fpm.1*
+%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/php-fpm
+%attr(754,root,root) /etc/rc.d/init.d/php-fpm
+%endif
+
%files common
%defattr(644,root,root,755)
%doc php.ini-*