From: Marcin Krol Date: Wed, 8 Feb 2017 12:10:23 +0000 (+0000) Subject: - full versioning, always use alternatives to set default PHP X-Git-Url: https://git.tld-linux.org/?a=commitdiff_plain;h=f98fd0d81b14f50d8ebf24557414bbea7e5908a4;p=packages%2Fphp.git - full versioning, always use alternatives to set default PHP --- diff --git a/php-builddir.patch b/php-builddir.patch deleted file mode 100644 index 783dc2b..0000000 --- a/php-builddir.patch +++ /dev/null @@ -1,24 +0,0 @@ -diff -urbB php-5.0.5.org/scripts/Makefile.frag php-5.0.5/scripts/Makefile.frag ---- php-5.0.5.org/scripts/Makefile.frag 2005-09-10 21:29:04.884122000 +0200 -+++ php-5.0.5/scripts/Makefile.frag 2005-09-10 21:30:09.333324848 +0200 -@@ -4,7 +4,7 @@ - # - - phpincludedir = $(includedir)/php --phpbuilddir = $(libdir)/build -+phpbuilddir = $(libdir)/php/build - - BUILD_FILES = \ - scripts/phpize.m4 \ -diff -urbB php-5.0.5.org/scripts/phpize.in php-5.0.5/scripts/phpize.in ---- php-5.0.5.org/scripts/phpize.in 2005-06-15 19:19:41.000000000 +0200 -+++ php-5.0.5/scripts/phpize.in 2005-09-10 21:51:45.523274024 +0200 -@@ -3,7 +3,7 @@ - # Variable declaration - prefix='@prefix@' - exec_prefix="`eval echo @exec_prefix@`" --phpdir="`eval echo @libdir@`/build" -+phpdir="`eval echo @libdir@`/php/build" - includedir="`eval echo @includedir@`/php" - builddir="`pwd`" - diff --git a/php-libtool.patch b/php-libtool.patch index f9713d8..c95f37f 100644 --- a/php-libtool.patch +++ b/php-libtool.patch @@ -2,8 +2,8 @@ +++ php-5.4.6/scripts/phpize.in 2012-08-23 10:16:37.011306948 +0300 @@ -6,10 +6,16 @@ exec_prefix="`eval echo @exec_prefix@`" - phpdir="`eval echo @libdir@`/php/build" - includedir="`eval echo @includedir@`/php" + phpdir="`eval echo @libdir@`/php/php@program_suffix@/build" + includedir="`eval echo @includedir@`/php/php@program_suffix@" +aclocaldir="$prefix/share/aclocal" builddir="`pwd`" SED="@SED@" diff --git a/php-paths.patch b/php-paths.patch new file mode 100644 index 0000000..92e6743 --- /dev/null +++ b/php-paths.patch @@ -0,0 +1,40 @@ +diff -ur php-5.6.30.orig/scripts/Makefile.frag php-5.6.30/scripts/Makefile.frag +--- php-5.6.30.orig/scripts/Makefile.frag 2017-01-19 00:17:47.000000000 +0000 ++++ php-5.6.30/scripts/Makefile.frag 2017-02-08 10:02:07.721522787 +0000 +@@ -3,8 +3,8 @@ + # Build environment install + # + +-phpincludedir = $(includedir)/php +-phpbuilddir = $(libdir)/build ++phpincludedir = $(includedir)/php/php$(program_suffix) ++phpbuilddir = $(libdir)/php/php$(program_suffix)/build + + BUILD_FILES = \ + scripts/phpize.m4 \ +diff -ur php-5.6.30.orig/scripts/php-config.in php-5.6.30/scripts/php-config.in +--- php-5.6.30.orig/scripts/php-config.in 2017-01-19 00:17:47.000000000 +0000 ++++ php-5.6.30/scripts/php-config.in 2017-02-08 10:03:10.019522085 +0000 +@@ -6,7 +6,7 @@ + exec_prefix="@exec_prefix@" + version="@PHP_VERSION@" + vernum="@PHP_VERSION_ID@" +-include_dir="@includedir@/php" ++include_dir="@includedir@/php/php@program_suffix@" + includes="-I$include_dir -I$include_dir/main -I$include_dir/TSRM -I$include_dir/Zend -I$include_dir/ext -I$include_dir/ext/date/lib" + ldflags="@PHP_LDFLAGS@" + libs="@EXTRA_LIBS@" +diff -ur php-5.6.30.orig/scripts/phpize.in php-5.6.30/scripts/phpize.in +--- php-5.6.30.orig/scripts/phpize.in 2017-01-19 00:17:47.000000000 +0000 ++++ php-5.6.30/scripts/phpize.in 2017-02-08 10:04:03.281521486 +0000 +@@ -4,8 +4,8 @@ + prefix='@prefix@' + datarootdir='@datarootdir@' + exec_prefix="`eval echo @exec_prefix@`" +-phpdir="`eval echo @libdir@`/build" +-includedir="`eval echo @includedir@`/php" ++phpdir="`eval echo @libdir@`/php/php@program_suffix@/build" ++includedir="`eval echo @includedir@`/php/php@program_suffix@" + builddir="`pwd`" + SED="@SED@" + diff --git a/php.spec b/php.spec index 8552ad2..4b8e81d 100644 --- a/php.spec +++ b/php.spec @@ -26,9 +26,6 @@ # standard # # Conditional build: -# - packaging options -%bcond_without alternatives # use alternatives system to select default phar and php-fpm -%bcond_with default_php # build this PHP as default PHP in system (disables alternatives) # - General options: %bcond_without embed # disable building Embedded API %bcond_with gcov # Enable Code coverage reporting @@ -119,10 +116,6 @@ %undefine with_litespeed %endif -%if %{with default_php} -%undefine with_alternatives -%endif - # mm is not thread safe %if %{with zts} %undefine with_mm @@ -154,10 +147,9 @@ ERROR: You need to select at least one Apache SAPI to build shared modules. %undefine with_filter %endif -%define rel 0.1 +%define rel 1.1 %define orgname php -%define ver_suffix 56 -%define php_suffix %{!?with_default_php:%{ver_suffix}} +%define php_suffix 56 Summary: PHP: Hypertext Preprocessor Summary(fr.UTF-8): Le langage de script embarque-HTML PHP Summary(pl.UTF-8): Język skryptowy PHP @@ -201,7 +193,7 @@ Patch17: %{orgname}-readline.patch Patch18: %{orgname}-nohttpd.patch Patch21: %{orgname}-dba-link.patch Patch22: %{orgname}-both-apxs.patch -Patch23: %{orgname}-builddir.patch +Patch23: %{orgname}-paths.patch Patch24: %{orgname}-zlib-for-getimagesize.patch Patch25: %{orgname}-stupidapache_version.patch Patch26: %{orgname}-pear.patch @@ -316,6 +308,7 @@ BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) %define php_sysconfdir /etc/%{name} %define php_extensiondir %{_libdir}/%{name} +%define php_datadir /usr/share/%{name} %define _sysconfdir %{php_sysconfdir} # must be in sync with source. extra check ensuring that it is so is done in %%build @@ -475,6 +468,7 @@ Summary: PHP as CLI interpreter Summary(pl.UTF-8): PHP jako interpreter działający z linii poleceń Group: Development/Languages/PHP Requires: %{name}-common = %{epoch}:%{version}-%{release} +Requires: alternatives Obsoletes: php-cli < 4:5.3.28-7 %description cli @@ -508,7 +502,7 @@ 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: alternatives Requires: php-dirs >= 1.4-2 Requires: rc-scripts Provides: php(fcgi) @@ -629,8 +623,6 @@ Obsoletes: php52-devel Obsoletes: php53-devel Obsoletes: php54-devel Obsoletes: php55-devel -Obsoletes: php70-devel -Obsoletes: php71-devel %description devel The php-devel package lets you compile dynamic extensions to PHP. @@ -1532,7 +1524,7 @@ URL: http://php.net/manual/en/book.phar.php Requires: %{name}-common = %{epoch}:%{version}-%{release} Requires: %{name}-hash = %{epoch}:%{version}-%{release} Requires: %{name}-spl = %{epoch}:%{version}-%{release} -%{?with_alternatives:Requires: alternatives} +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 @@ -2363,10 +2355,12 @@ for sapi in $sapis; do %configure \ EXTRA_LDFLAGS="%{rpmldflags}" \ + --program-suffix=%{php_suffix} \ $sapi_args \ %if "%{!?configure_cache:0}%{?configure_cache}" == "0" --cache-file=config.cache \ %endif + --datadir=%{php_datadir} \ --with-libdir=%{_lib} \ --with-config-file-path=%{_sysconfdir} \ --with-config-file-scan-dir=%{_sysconfdir}/conf.d \ @@ -2632,17 +2626,13 @@ cp -pf Makefile.cli Makefile phpbuilddir=%{_libdir}/%{name}/build \ INSTALL_ROOT=$RPM_BUILD_ROOT -%if %{without default_php} # version the .phar files %{__mv} $RPM_BUILD_ROOT%{_bindir}/phar{,%{php_suffix}}.phar %{__mv} $RPM_BUILD_ROOT%{_mandir}/man1/phar{,%{php_suffix}}.1 -%endif -%if %{with alternatives} # touch for ghost %{__rm} $RPM_BUILD_ROOT%{_bindir}/phar touch $RPM_BUILD_ROOT%{_bindir}/phar touch $RPM_BUILD_ROOT%{_mandir}/man1/phar.1 -%endif # version suffix v=$(echo %{version} | cut -d. -f1-2) @@ -2670,14 +2660,14 @@ libtool --mode=install install -p sapi/litespeed/php $RPM_BUILD_ROOT%{_sbindir}/ %{__make} -f Makefile.phpdbg install-phpdbg \ INSTALL="libtool --mode=install install -p" \ INSTALL_ROOT=$RPM_BUILD_ROOT - -%if %{without default_php} -# version the phpdbg files -%{__mv} $RPM_BUILD_ROOT%{_bindir}/phpdbg{,%{ver_suffix}} -%{__mv} $RPM_BUILD_ROOT%{_mandir}/man1/phpdbg{,%{ver_suffix}}.1 -%endif %endif +# touch for ghost +touch $RPM_BUILD_ROOT%{_bindir}/phpize +touch $RPM_BUILD_ROOT%{_mandir}/man1/phpize.1 +touch $RPM_BUILD_ROOT%{_bindir}/php-config +touch $RPM_BUILD_ROOT%{_mandir}/man1/php-config.1 + %if %{with milter} %{__make} -f Makefile.milter install-milter \ INSTALL_ROOT=$RPM_BUILD_ROOT @@ -2705,10 +2695,8 @@ install -p %{SOURCE10} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}-fpm install -d $RPM_BUILD_ROOT/etc/logrotate.d cp -p %{SOURCE11} $RPM_BUILD_ROOT/etc/logrotate.d/%{name}-fpm -%if %{with alternatives} # touch for ghost for alternatives touch $RPM_BUILD_ROOT%{_sbindir}/php-fpm -%endif %{__sed} -i -e ' s#/usr/lib/php#%{php_extensiondir}#g @@ -2721,17 +2709,18 @@ touch $RPM_BUILD_ROOT%{_sbindir}/php-fpm %if %{with embed} # we could use install-headers from Makefile.embed, but that would reinstall all headers # install-sapi installs to wrong dir, so just do it all manually -install -d $RPM_BUILD_ROOT%{_includedir}/php/sapi/embed +install -d $RPM_BUILD_ROOT%{_includedir}/php/php%{php_suffix}/sapi/embed install -p libs/libphp5.so $RPM_BUILD_ROOT%{_libdir} -cp -p sapi/embed/php_embed.h $RPM_BUILD_ROOT%{_includedir}/php/sapi/embed +cp -p sapi/embed/php_embed.h $RPM_BUILD_ROOT%{_includedir}/php/php%{php_suffix}/sapi/embed %endif # install CLI # versioned suffix is always installed -libtool --mode=install install -p sapi/cli/php $RPM_BUILD_ROOT%{_bindir}/php%{ver_suffix} -cp -p sapi/cli/php.1 $RPM_BUILD_ROOT%{_mandir}/man1/php%{ver_suffix}.1 -echo ".so php%{ver_suffix}.1" >$RPM_BUILD_ROOT%{_mandir}/man1/php.1 -ln -sf php%{ver_suffix} $RPM_BUILD_ROOT%{_bindir}/php +#libtool --mode=install install -p sapi/cli/php $RPM_BUILD_ROOT%{_bindir}/php%{php_suffix} +#cp -p sapi/cli/php.1 $RPM_BUILD_ROOT%{_mandir}/man1/php%{php_suffix}.1 +# touch for ghost +touch $RPM_BUILD_ROOT%{_bindir}/php +touch $RPM_BUILD_ROOT%{_mandir}/man1/php.1 cp -p php.ini $RPM_BUILD_ROOT%{_sysconfdir}/php.ini cp -p %{SOURCE5} $RPM_BUILD_ROOT%{_sysconfdir}/php-cli.ini @@ -2778,16 +2767,16 @@ for fn in ltmain.sh config/ltmain.sh build-aux/ltmain.sh; do ln -snf $f $RPM_BUILD_ROOT%{_libdir}/%{name}/build break done -sed -i -e '/^phpdir/ s,/php/build,/%{name}/build,' $RPM_BUILD_ROOT%{_bindir}/phpize +sed -i -e '/^phpdir/ s,/php/build,/%{name}/build,' $RPM_BUILD_ROOT%{_bindir}/phpize%{php_suffix} # for php-pecl-mailparse -install -d $RPM_BUILD_ROOT%{_includedir}/php/ext/mbstring -cp -p ext/mbstring/libmbfl/mbfl/*.h $RPM_BUILD_ROOT%{_includedir}/php/ext/mbstring +install -d $RPM_BUILD_ROOT%{_includedir}/php/php%{php_suffix}/ext/mbstring +cp -p ext/mbstring/libmbfl/mbfl/*.h $RPM_BUILD_ROOT%{_includedir}/php/php%{php_suffix}/ext/mbstring # tests -install -d $RPM_BUILD_ROOT%{php_data_dir}/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 +install -d $RPM_BUILD_ROOT%{php_datadir}/tests/php +install -p run-tests.php $RPM_BUILD_ROOT%{php_datadir}/tests/php/run-tests.php +cp -a tests/* $RPM_BUILD_ROOT%{php_datadir}/tests/php # fix install paths, avoid evil rpaths sed -i -e "s|^libdir=.*|libdir='%{_libdir}'|" $RPM_BUILD_ROOT%{_libdir}/libphp_common.la @@ -2824,23 +2813,43 @@ if [ "$1" = "0" ]; then %service -q httpd restart fi +%post cli +update-alternatives \ + --install %{_bindir}/php php %{_bindir}/php%{php_suffix} %{php_suffix} \ + --slave %{_mandir}/man1/php.1 php.1 %{_mandir}/man1/php%{php_suffix}.1* || : + +%postun cli +if [ $1 -eq 0 ]; then + update-alternatives --remove php %{_bindir}/php || : +fi + +%post devel +update-alternatives \ + --install %{_bindir}/phpize phpize %{_bindir}/phpize%{php_suffix} %{php_suffix} \ + --slave %{_mandir}/man1/php.1 php.1 %{_mandir}/man1/php%{php_suffix}.1* || : +update-alternatives \ + --install %{_bindir}/php-config php-config %{_bindir}/php-config%{php_suffix} %{php_suffix} \ + --slave %{_mandir}/man1/php.1 php.1 %{_mandir}/man1/php%{php_suffix}.1* || : + +%postun devel +if [ $1 -eq 0 ]; then + update-alternatives --remove phpize %{_bindir}/phpize || : + update-alternatives --remove php-config %{_bindir}/php-config || : +fi + %pre fpm %useradd -u 51 -r -s /bin/false -c "HTTP User" -g http http %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 +update-alternatives --install %{_sbindir}/php-fpm php-fpm %{_sbindir}/php%{php_suffix}-fpm %{php_suffix} || : %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 @@ -3002,19 +3011,15 @@ fi \ %post phar %ext_post -%if %{with alternatives} 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* || : -%endif + --install %{_bindir}/phar phar %{_bindir}/phar%{php_suffix}.phar %{php_suffix} \ + --slave %{_mandir}/man1/phar.1 phar.1 %{_mandir}/man1/phar%{php_suffix}.1* || : %postun phar %ext_postun -%if %{with alternatives} if [ $1 -eq 0 ]; then update-alternatives --remove phar %{_bindir}/phar || : fi -%endif %if %{with apache1} %files -n apache1-mod_%{name} @@ -3061,8 +3066,10 @@ fi %defattr(644,root,root,755) %dir %{_sysconfdir}/cli.d %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/php-cli.ini -%attr(755,root,root) %{_bindir}/php%{ver_suffix} -%{_mandir}/man1/php%{ver_suffix}.1* +%attr(755,root,root) %{_bindir}/php%{php_suffix} +%{_mandir}/man1/php%{php_suffix}.1* +%ghost %{_bindir}/php +%ghost %{_mandir}/man1/php.1* %if %{with fpm} %files fpm @@ -3072,9 +3079,7 @@ fi %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/php-fpm.conf %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/fpm.d/www.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 @@ -3109,18 +3114,22 @@ fi %files devel %defattr(644,root,root,755) %doc CODING_STANDARDS README.{EXT_SKEL,PARAMETER_PARSING_API,SELF-CONTAINED-EXTENSIONS,STREAMS,SUBMITTING_PATCH,TESTING,TESTING2,UNIX-BUILD-SYSTEM,input_filter} -%attr(755,root,root) %{_bindir}/phpize -%attr(755,root,root) %{_bindir}/php-config +%attr(755,root,root) %{_bindir}/phpize%{php_suffix} +%attr(755,root,root) %{_bindir}/php-config%{php_suffix} +%ghost %{_bindir}/phpize +%ghost %{_bindir}/php-config %if %{with apache1} || %{with apache2} %attr(755,root,root) %{_libdir}/libphp_common.so %else %attr(755,root,root) %{_libdir}/libphp_common.a %endif %{_libdir}/libphp_common.la -%{_includedir}/php +%{_includedir}/php/php%{php_suffix} %{_libdir}/%{name}/build -%{_mandir}/man1/php-config.1* -%{_mandir}/man1/phpize.1* +%{_mandir}/man1/php-config%{php_suffix}.1* +%ghost %{_mandir}/man1/php-config.1* +%{_mandir}/man1/phpize%{php_suffix}.1* +%ghost %{_mandir}/man1/phpize.1* %if %{with bcmath} %files bcmath @@ -3475,12 +3484,8 @@ fi %attr(755,root,root) %{_bindir}/phar%{php_suffix}.phar %{_mandir}/man1/phar%{php_suffix}.1* %{_mandir}/man1/phar.phar.1* -%if %{with alternatives} %ghost %{_bindir}/phar -%ghost %{_mandir}/man1/phar.1 -%else -%attr(755,root,root) %{_bindir}/phar -%endif +%ghost %{_mandir}/man1/phar.1* %endif %if %{with posix} @@ -3600,18 +3605,18 @@ fi %files tests %defattr(644,root,root,755) -%dir %{php_data_dir}/tests -%dir %{php_data_dir}/tests/php -%{php_data_dir}/tests/php/basic -%{php_data_dir}/tests/php/classes -%{php_data_dir}/tests/php/func -%{php_data_dir}/tests/php/lang -%{php_data_dir}/tests/php/output -%{php_data_dir}/tests/php/run-test -%{php_data_dir}/tests/php/security -%{php_data_dir}/tests/php/strings -%{php_data_dir}/tests/php/quicktester.inc -%attr(755,root,root) %{php_data_dir}/tests/php/run-tests.php +%dir %{php_datadir}/tests +%dir %{php_datadir}/tests/php +%{php_datadir}/tests/php/basic +%{php_datadir}/tests/php/classes +%{php_datadir}/tests/php/func +%{php_datadir}/tests/php/lang +%{php_datadir}/tests/php/output +%{php_datadir}/tests/php/run-test +%{php_datadir}/tests/php/security +%{php_datadir}/tests/php/strings +%{php_datadir}/tests/php/quicktester.inc +%attr(755,root,root) %{php_datadir}/tests/php/run-tests.php %if %{with tidy} %files tidy