]> git.pld-linux.org Git - packages/php.git/blobdiff - php.spec
use alternatives for php-fpm binary
[packages/php.git] / php.spec
index b22466cb71415f5ff708c24ed4ff1169ef3cb2c8..98dcfee025aa36fccdbb815ef96d7676ead9ae60 100644 (file)
--- a/php.spec
+++ b/php.spec
@@ -124,7 +124,7 @@ ERROR: You need to select at least one Apache SAPI to build shared modules.
 %undefine      with_filter
 %endif
 
-%define                rel     2
+%define                rel     11
 %define                orgname php
 %define                ver_suffix 54
 %define                php_suffix %{!?with_default_php:%{ver_suffix}}
@@ -135,7 +135,7 @@ Summary(pt_BR.UTF-8):       A linguagem de script PHP
 Summary(ru.UTF-8):     PHP Версии 5 - язык препроцессирования HTML-файлов, выполняемый на сервере
 Summary(uk.UTF-8):     PHP Версії 5 - мова препроцесування HTML-файлів, виконувана на сервері
 Name:          %{orgname}%{php_suffix}
-Version:       5.4.44
+Version:       5.4.45
 Release:       %{rel}%{?with_type_hints:.th}%{?with_oci8:.oci}
 Epoch:         4
 # All files licensed under PHP version 3.01, except
@@ -144,7 +144,7 @@ Epoch:              4
 License:       PHP 3.01 and Zend and BSD
 Group:         Libraries
 Source0:       http://www.php.net/distributions/%{orgname}-%{version}.tar.bz2
-# Source0-md5: 25725eb0dff0d45351b01fb483709b8d
+# Source0-md5: 185f67f1ca652b18bc0cca9d7edbde7c
 Source2:       %{orgname}-mod_%{orgname}.conf
 Source3:       %{orgname}-cgi-fcgi.ini
 Source4:       %{orgname}-apache.ini
@@ -163,6 +163,7 @@ Patch5:             %{orgname}-filter-shared.patch
 Patch6:                %{orgname}-build_modules.patch
 Patch7:                %{orgname}-sapi-ini-file.patch
 Patch8:                %{orgname}-config-file-scan-dir.patch
+Patch9:                php-bug-71475.patch
 Patch10:       %{orgname}-ini.patch
 Patch11:       embed.patch
 %if %{with type_hints}
@@ -255,7 +256,7 @@ BuildRequires:      libpng-devel >= 1.0.8
 %{?with_webp:BuildRequires:    libvpx-devel}
 BuildRequires: tokyocabinet-devel
 %if "%{pld_release}" != "ac"
-BuildRequires: libtool >= 2:2.2
+BuildRequires: libtool >= 2:2.4.6
 %else
 BuildRequires: libtool >= 1.4.3
 %endif
@@ -504,6 +505,8 @@ Requires(postun):   /usr/sbin/userdel
 Requires(pre): /bin/id
 Requires(pre): /usr/sbin/useradd
 Requires:      %{name}-common = %{epoch}:%{version}-%{release}
+%{?with_alternatives:Requires: alternatives}
+Requires:      php-dirs >= 1.4-2
 Requires:      rc-scripts
 Provides:      php(fpm)
 Provides:      user(http)
@@ -575,7 +578,7 @@ Requires:   %{name}-common = %{epoch}:%{version}-%{release}
 Requires:      autoconf >= 2.13
 Requires:      automake
 %if "%{pld_release}" != "ac"
-Requires:      libtool >= 2:2.2
+Requires:      libtool >= 2:2.4.6
 %else
 Requires:      libtool
 %endif
@@ -1403,12 +1406,13 @@ Moduł PHP umożliwiający dostęp do bazy danych PostgreSQL.
 Um módulo para aplicações PHP que usam bancos de dados postgresql.
 
 %package phar
-Summary:       phar database module for PHP
+Summary:       Phar archive module for PHP
 Summary(pl.UTF-8):     Moduł phar dla PHP
 Group:         Libraries
 URL:           http://www.php.net/manual/en/book.phar.php
 Requires:      %{name}-common = %{epoch}:%{version}-%{release}
 Requires:      %{name}-spl = %{epoch}:%{version}-%{release}
+Requires:      alternatives
 Suggests:      %{name}-cli
 # zlib is required by phar program, but as phar cli is optional should the dep be too
 Suggests:      %{name}-zlib
@@ -1887,6 +1891,7 @@ Moduł PHP umożliwiający używanie kompresji zlib.
 %patch5 -p1
 %patch6 -p1
 %patch8 -p1
+%patch9 -p1
 %patch7 -p1
 cp -p php.ini-production php.ini
 %patch10 -p1
@@ -1949,7 +1954,7 @@ cp -p php.ini-production php.ini
 %patch71 -p1
 %endif
 
-sed -i -e '/PHP_ADD_LIBRARY_WITH_PATH/s#xmlrpc,#xmlrpc-epi,#' ext/xmlrpc/config.m4
+%{__sed} -i -e '/PHP_ADD_LIBRARY_WITH_PATH/s#xmlrpc,#xmlrpc-epi,#' ext/xmlrpc/config.m4
 
 # cleanup backups after patching
 find '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f
@@ -2172,6 +2177,7 @@ for sapi in $sapis; do
        esac
 
        %configure \
+       EXTRA_LDFLAGS="%{rpmldflags}" \
        $sapi_args \
 %if "%{!?configure_cache:0}%{?configure_cache}" == "0"
        --cache-file=config.cache \
@@ -2416,8 +2422,13 @@ cp -pf Makefile.cli Makefile
        phpbuilddir=%{_libdir}/%{name}/build \
        INSTALL_ROOT=$RPM_BUILD_ROOT
 
-# make link relative
-ln -sfn phar.phar $RPM_BUILD_ROOT%{_bindir}/phar
+# version the .phar files
+mv $RPM_BUILD_ROOT%{_bindir}/phar{,%{ver_suffix}}.phar
+mv $RPM_BUILD_ROOT%{_mandir}/man1/phar{,%{ver_suffix}}.1
+# touch for ghost
+%{__rm} $RPM_BUILD_ROOT%{_bindir}/phar
+touch $RPM_BUILD_ROOT%{_bindir}/phar
+touch $RPM_BUILD_ROOT%{_mandir}/man1/phar.1
 
 # version suffix
 v=$(echo %{version} | cut -d. -f1-2)
@@ -2426,14 +2437,14 @@ v=$(echo %{version} | cut -d. -f1-2)
 %if %{with apache1}
 libtool --mode=install install -p sapi/apache/libphp5.la $RPM_BUILD_ROOT%{_libdir}/apache1
 mv $RPM_BUILD_ROOT%{_libdir}/apache1/libphp5{,-$v}.so
-ln -s libphp5-$v.so $RPM_BUILD_ROOT%{_libdir}/apache1/libphp5.so
+ln -s libphp5-$v.so $RPM_BUILD_ROOT%{_libdir}/apache1/mod_php.so
 %endif
 
 # install Apache2 DSO module
 %if %{with apache2}
 libtool --mode=install install -p sapi/apache2handler/libphp5.la $RPM_BUILD_ROOT%{_libdir}/apache
 mv $RPM_BUILD_ROOT%{_libdir}/apache/libphp5{,-$v}.so
-ln -s libphp5-$v.so $RPM_BUILD_ROOT%{_libdir}/apache/libphp5.so
+ln -s libphp5-$v.so $RPM_BUILD_ROOT%{_libdir}/apache/mod_php.so
 %endif
 
 # install litespeed sapi
@@ -2465,6 +2476,11 @@ cp -p %{SOURCE11} $RPM_BUILD_ROOT/etc/logrotate.d/%{name}-fpm
 %{__sed} -i -e '/su/d' $RPM_BUILD_ROOT/etc/logrotate.d/%{name}-fpm
 %endif
 
+%if %{with alternatives}
+# touch for ghost
+touch $RPM_BUILD_ROOT%{_sbindir}/php-fpm
+%endif
+
 %{__sed} -i -e '
        s#/usr/lib/php#%{php_extensiondir}#
        s#/etc/php#%{_sysconfdir}#
@@ -2581,11 +2597,17 @@ fi
 %post fpm
 /sbin/chkconfig --add %{name}-fpm
 %service %{name}-fpm restart
+%if %{with alternatives}
+update-alternatives --install %{_sbindir}/php-fpm php-fpm %{_sbindir}/php%{ver_suffix}-fpm %{ver_suffix} || :
+%endif
 
 %preun fpm
 if [ "$1" = 0 ]; then
        %service %{name}-fpm stop
        /sbin/chkconfig --del %{name}-fpm
+%if %{with alternatives}
+       update-alternatives --remove php-fpm %{_sbindir}/php-fpm || :
+%endif
 fi
 
 %postun fpm
@@ -2596,7 +2618,7 @@ fi
 %post  embedded -p /sbin/ldconfig
 %postun        embedded -p /sbin/ldconfig
 
-%post common
+%posttrans common
 # PHP 5.3 requires timezone being setup, try setup it from tzdata
 if ! grep -q '^date.timezone[[:space:]]*=' %{_sysconfdir}/php.ini && [ -f /etc/sysconfig/timezone ]; then
        TIMEZONE=
@@ -2606,7 +2628,6 @@ if ! grep -q '^date.timezone[[:space:]]*=' %{_sysconfdir}/php.ini && [ -f /etc/s
        fi
 fi
 
-%posttrans common
 # minimizing apache restarts logics. we restart webserver:
 #
 # 1. at the end of transaction. (posttrans, feature from rpm 4.4.2)
@@ -2628,17 +2649,31 @@ if [ ! -e /usr/share/browscap/php_browscap.ini ]; then
        %{__sed} -i -e 's#^browscap = /usr/share/browscap/php_browscap.ini#;&#' %{_sysconfdir}/php.ini
 fi
 
+%triggerpostun -n apache1-mod_%{name} -- apache1-mod_%{name} < 4:5.4.45-2
+sed -i -e 's#modules/libphp5.so#modules/mod_php.so#g' /etc/apache/conf.d/*_mod_php.conf
+
+%triggerpostun -n apache-mod_%{name} -- apache-mod_%{name} < 4:5.4.45-2
+sed -i -e 's#modules/libphp[57].so#modules/mod_php.so#g' /etc/httpd/conf.d/*_mod_php.conf
+
 # common macros called at extension post/postun scriptlet
-%define        extension_scripts() \
-%post %1 \
+%define ext_post \
 if [ "$1" = "1" ]; then \
        %php_webserver_restart \
 fi \
-\
-%postun %1 \
+%{nil}
+
+%define ext_postun \
 if [ "$1" = "0" ]; then \
        %php_webserver_restart \
-fi
+fi \
+%{nil}
+
+%define extension_scripts() \
+%post %1 \
+%ext_post \
+\
+%postun %1 \
+%ext_postun \
 %{nil}
 
 # extension scripts defines
@@ -2683,7 +2718,6 @@ fi
 %extension_scripts pdo-pgsql
 %extension_scripts pdo-sqlite
 %extension_scripts pgsql
-%extension_scripts phar
 %extension_scripts pcntl
 %extension_scripts posix
 %extension_scripts pspell
@@ -2711,13 +2745,25 @@ fi
 %extension_scripts zip
 %extension_scripts zlib
 
+%post phar
+%ext_post
+update-alternatives \
+       --install %{_bindir}/phar phar %{_bindir}/phar%{ver_suffix}.phar %{ver_suffix} \
+       --slave %{_mandir}/man1/phar.1 phar.1 %{_mandir}/man1/phar%{ver_suffix}.1* || :
+
+%postun phar
+%ext_postun
+if [ $1 -eq 0 ]; then
+       update-alternatives --remove phar %{_bindir}/phar || :
+fi
+
 %if %{with apache1}
 %files -n apache1-mod_%{name}
 %defattr(644,root,root,755)
 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/apache/conf.d/*_mod_php.conf
 %dir %{_sysconfdir}/apache.d
 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/php-apache.ini
-%attr(755,root,root) %{_libdir}/apache1/libphp5.so
+%attr(755,root,root) %{_libdir}/apache1/mod_php.so
 %attr(755,root,root) %{_libdir}/apache1/libphp5-*.*.so
 %endif
 
@@ -2727,7 +2773,7 @@ fi
 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/httpd/conf.d/*_mod_php.conf
 %dir %{_sysconfdir}/apache2handler.d
 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/php-apache2handler.ini
-%attr(755,root,root) %{_libdir}/apache/libphp5.so
+%attr(755,root,root) %{_libdir}/apache/mod_php.so
 %attr(755,root,root) %{_libdir}/apache/libphp5-*.*.so
 %endif
 
@@ -2771,6 +2817,9 @@ fi
 %dir %{_sysconfdir}/fpm.d
 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/php-fpm.conf
 %attr(755,root,root) %{_sbindir}/%{name}-fpm
+%if %{with alternatives}
+%ghost %{_sbindir}/php-fpm
+%endif
 %{_mandir}/man8/%{name}-fpm.8*
 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/%{name}-fpm
 %attr(754,root,root) /etc/rc.d/init.d/%{name}-fpm
@@ -3103,10 +3152,11 @@ fi
 %doc ext/phar/{CREDITS,TODO}
 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/conf.d/phar.ini
 %attr(755,root,root) %{php_extensiondir}/phar.so
-%attr(755,root,root) %{_bindir}/phar
-%attr(755,root,root) %{_bindir}/phar.phar
-%{_mandir}/man1/phar.1*
+%attr(755,root,root) %{_bindir}/phar%{ver_suffix}.phar
 %{_mandir}/man1/phar.phar.1
+%{_mandir}/man1/phar%{ver_suffix}.1*
+%ghost %{_bindir}/phar
+%ghost %{_mandir}/man1/phar.1
 %endif
 
 %files posix
This page took 0.064026 seconds and 4 git commands to generate.