]> git.pld-linux.org Git - packages/php.git/blobdiff - php.spec
fix php-config --php-sapis
[packages/php.git] / php.spec
index 2fa7f9308ac6f437732905b1273be8d8fe06544e..9ae9d197beac89829f0632cdf596ea79f5b7424d 100644 (file)
--- a/php.spec
+++ b/php.spec
@@ -8,7 +8,6 @@
 # - dba: enable: --with-tcadb=DIR        DBA: Tokyo Cabinet abstract DB support
 # --with-libmbfl=DIR      MBSTRING: Use external libmbfl.  DIR is the libmbfl base install directory BUNDLED
 # --with-onig=DIR         MBSTRING: Use external oniguruma. DIR is the oniguruma install prefix.
-# - recheck: define PDO_MYSQL_UNIX_ADDR (ensure if's correct with mysql-libs and mysqlng)
 # - uses libvpx for webp support, should use libwebp-devel instead?
 # - fpm -qn check fails, as it still loads /etc/php/php.ini
 # - co-install with php 5.3:
@@ -17,7 +16,6 @@
 #        file /usr/share/man/man8/php-fpm.8.gz from install of php54-fpm-5.4.5-0.2.i686 conflicts with file from package php-fpm-5.3.14-1.i686
 #        file /usr/bin/php.cli from install of php54-cli-5.4.5-0.2.i686 conflicts with file from package php-cli-5.3.14-1.i686
 #        file /usr/share/man/man1/php.1.gz from install of php54-cli-5.4.5-0.2.i686 conflicts with file from package php-cli-5.3.14-1.i686
-#        file /usr/bin/php.cgi from install of php54-cgi-5.4.5-0.2.i686 conflicts with file from package php-cgi-5.3.14-1.i686
 # NOTE: mysqlnd does not support ssl or compression (see FAQ at http://dev.mysql.com/downloads/connector/php-mysqlnd/)
 # UNPACKAGED EXTENSION NOTES:
 # - com_dotnet is Win32-only
@@ -133,7 +131,7 @@ ERROR: You need to select at least one Apache SAPI to build shared modules.
 %define                orgname php
 %define                php_suffix 54
 
-%define                rel     0.2
+%define                rel     0.15
 Summary:       PHP: Hypertext Preprocessor
 Summary(fr.UTF-8):     Le langage de script embarque-HTML PHP
 Summary(pl.UTF-8):     Język skryptowy PHP
@@ -238,7 +236,7 @@ BuildRequires:      elfutils-devel
 #BuildRequires:        flex
 %{?with_kerberos5:BuildRequires:       heimdal-devel}
 %{?with_system_libzip:BuildRequires:   libzip-devel >= 0.10-3}
-BuildRequires: mysql-devel
+%{!?with_mysqlnd:BuildRequires:        mysql-devel}
 BuildRequires: pkgconfig
 BuildRequires: sed >= 4.0
 %if %{with mssql} || %{with sybase_ct}
@@ -394,7 +392,7 @@ PHP - це мова написання скриптів, що вбудовуют
 роботи з базами даних є доволі простим. Найбільш популярне
 використання PHP - заміна для CGI скриптів.
 
-%package -n apache1-mod_php%{php_suffix}
+%package -n apache1-mod_%{name}
 Summary:       PHP DSO module for Apache 1.3.x
 Summary(pl.UTF-8):     Moduł DSO (Dynamic Shared Object) PHP dla Apache 1.3.x
 Group:         Development/Languages/PHP
@@ -406,13 +404,13 @@ Provides: webserver(php) = %{version}
 Obsoletes:     apache-mod_php < 1:4.1.1
 Obsoletes:     phpfi
 
-%description -n apache1-mod_php%{php_suffix}
+%description -n apache1-mod_%{name}
 PHP as DSO module for Apache 1.3.x.
 
-%description -n apache1-mod_php%{php_suffix} -l pl.UTF-8
+%description -n apache1-mod_%{name} -l pl.UTF-8
 PHP jako moduł DSO (Dynamic Shared Object) dla Apache 1.3.x.
 
-%package -n apache-mod_php%{php_suffix}
+%package -n apache-mod_%{name}
 Summary:       PHP DSO module for Apache 2.x
 Summary(pl.UTF-8):     Moduł DSO (Dynamic Shared Object) PHP dla Apache 2.x
 Group:         Development/Languages/PHP
@@ -422,10 +420,10 @@ Requires: apache-mod_mime
 Provides:      webserver(php) = %{version}
 Obsoletes:     phpfi
 
-%description -n apache-mod_php%{php_suffix}
+%description -n apache-mod_%{name}
 PHP as DSO module for Apache 2.x.
 
-%description -n apache-mod_php%{php_suffix} -l pl.UTF-8
+%description -n apache-mod_%{name} -l pl.UTF-8
 PHP jako moduł DSO (Dynamic Shared Object) dla Apache 2.x.
 
 %package litespeed
@@ -2168,7 +2166,7 @@ for sapi in $sapis; do
 %endif
        %{?with_mhash:--with-mhash=yes} \
        --with-mysql-sock=/var/lib/mysql/mysql.sock \
-       --with-pdo-mysql=shared%{?with_mysqlnd:,mysqlnd} \
+       --with-pdo-mysql=shared,%{!?with_mysqlnd:/usr}%{?with_mysqlnd:mysqlnd} \
        %{?with_oci8:--with-pdo-oci=shared%{?with_instantclient:,instantclient,%{_libdir}}} \
        %{?with_odbc:--with-pdo-odbc=shared,unixODBC,/usr} \
        %{?with_pgsql:--with-pdo-pgsql=shared} \
@@ -2206,9 +2204,9 @@ for sapi in $sapis; do
        --with-mcrypt=shared \
        %{?with_mm:--with-mm} \
        %{?with_mssql:--with-mssql=shared} \
-       %{?with_mysqlnd:--with-mysqlnd=shared} \
-       --with-mysql=shared%{?with_mysqlnd:,mysqlnd} \
-       %{?with_mysqli:--with-mysqli=shared%{?with_mysqlnd:,mysqlnd}} \
+       %{?with_mysqlnd:--enable-mysqlnd=shared} \
+       --with-mysql=shared,%{!?with_mysqlnd:/usr}%{?with_mysqlnd:mysqlnd} \
+       %{?with_mysqli:--with-mysqli=shared,%{!?with_mysqlnd:/usr/bin/mysql_config}%{?with_mysqlnd:mysqlnd}} \
        %{?with_oci8:--with-oci8=shared%{?with_instantclient:,instantclient,%{_libdir}}} \
        %{?with_openssl:--with-openssl=shared} \
        %{?with_kerberos5:--with-kerberos} \
@@ -2244,8 +2242,8 @@ for sapi in $sapis; do
 done
 
 # as we build each SAPI in own make, adjust php-config.in forehead
-sapis=$(awk '/^PHP_SAPI = /{print $3}' Makefile.* | sort -u | xargs)
-sed -i -e "s,@PHP_INSTALLED_SAPIS@,$sapis," "scripts/php-config.in"
+sapis=$(%{__sed} -rne 's/^PHP_INSTALLED_SAPIS = (.+)/\1/p' Makefile.* | tr ' ' '\n' | sort -u | xargs)
+%{__sed} -i -e "s,@PHP_INSTALLED_SAPIS@,$sapis," scripts/php-config.in
 
 # must make libphp_common first, so modules can link against it.
 cp -af php_config.h.cli main/php_config.h
@@ -2269,20 +2267,21 @@ cp -af Makefile.cli Makefile
 %if %{with cgi}
 cp -pf php_config.h.cgi-fcgi main/php_config.h
 %{__make} -f Makefile.cgi-fcgi
-[ "$(echo '<?=php_sapi_name();' | ./sapi/cgi/php-cgi -qn)" = cgi-fcgi ] || exit 1
+[ "$(echo '<?=php_sapi_name();' | ./sapi/cgi/php-cgi -qn)" = "cgi-fcgi" ]
 %endif
 
 # PHP FPM
 %if %{with fpm}
 cp -pf php_config.h.fpm main/php_config.h
 %{__make} -f Makefile.fpm
-#./sapi/fpm/php-fpm -qn -m > /dev/null
+./sapi/fpm/php-fpm -n -m
+[ $(./sapi/fpm/php-fpm -n -m | grep cgi-fcgi) = "cgi-fcgi" ]
 %endif
 
 # CLI
 cp -pf php_config.h.cli main/php_config.h
 %{__make} -f Makefile.cli
-[ "$(echo '<?=php_sapi_name();' | ./sapi/cli/php -qn)" = cli ] || exit 1
+[ "$(echo '<?=php_sapi_name();' | ./sapi/cli/php -qn)" = "cli" ]
 
 # check for stupid xml parse breakage where &lt; and &gt; just get lost in parse result
 ./sapi/cli/php -n -dextension_dir=modules -dextension=xml.so -r '$p = xml_parser_create(); xml_parse_into_struct($p, "<x>&lt;</x>", $vals, $index); exit((int )empty($vals[0]["value"]));'
@@ -2384,7 +2383,7 @@ libtool --mode=install install -p sapi/apache2handler/libphp5.la $RPM_BUILD_ROOT
 
 # install litespeed sapi
 %if %{with litespeed}
-libtool --mode=install install -p sapi/litespeed/php $RPM_BUILD_ROOT%{_sbindir}/php.litespeed
+libtool --mode=install install -p sapi/litespeed/php $RPM_BUILD_ROOT%{_sbindir}/%{name}.litespeed
 %endif
 
 libtool --mode=install install -p libphp_common.la $RPM_BUILD_ROOT%{_libdir}
@@ -2392,21 +2391,26 @@ libtool --mode=install install -p libphp_common.la $RPM_BUILD_ROOT%{_libdir}
 # install CGI/FCGI
 %if %{with cgi}
 # install-cgi
-libtool --mode=install install -p sapi/cgi/php-cgi $RPM_BUILD_ROOT%{_bindir}/php.cgi
-ln -sf php.cgi $RPM_BUILD_ROOT%{_bindir}/php.fcgi
+libtool --mode=install install -p sapi/cgi/php-cgi $RPM_BUILD_ROOT%{_bindir}/%{name}.cgi
+ln -sf %{name}.cgi $RPM_BUILD_ROOT%{_bindir}/%{name}.fcgi
 cp -p %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/php-cgi-fcgi.ini
 %endif
 
 # install FCGI PM
 %if %{with fpm}
 install -d $RPM_BUILD_ROOT{%{_sysconfdir}/fpm.d,%{_sbindir}}
-libtool --mode=install install -p sapi/fpm/php-fpm $RPM_BUILD_ROOT%{_sbindir}
-cp -p sapi/fpm/php-fpm.8 $RPM_BUILD_ROOT%{_mandir}/man8
+libtool --mode=install install -p sapi/fpm/php-fpm $RPM_BUILD_ROOT%{_sbindir}/%{name}-fpm
+cp -p sapi/fpm/php-fpm.8 $RPM_BUILD_ROOT%{_mandir}/man8/%{name}-fpm.8
 cp -p sapi/fpm/php-fpm.conf $RPM_BUILD_ROOT%{_sysconfdir}
 install -d $RPM_BUILD_ROOT/etc/rc.d/init.d
-install -p %{SOURCE10} $RPM_BUILD_ROOT/etc/rc.d/init.d/php-fpm
+install -p %{SOURCE10} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}-fpm
+%{__sed} -i -e '
+       s#/usr/lib/php#%{php_extensiondir}#
+       s#/etc/php#%{_sysconfdir}#
+       s#@processname@#%{name}-fpm#g
+' $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}-fpm $RPM_BUILD_ROOT%{_sysconfdir}/php-fpm.conf
 install -d $RPM_BUILD_ROOT/etc/logrotate.d
-cp -p %{SOURCE11} $RPM_BUILD_ROOT/etc/logrotate.d/php-fpm
+cp -p %{SOURCE11} $RPM_BUILD_ROOT/etc/logrotate.d/%{name}-fpm
 %endif
 
 # install Embedded API
@@ -2418,12 +2422,12 @@ cp -p sapi/embed/php_embed.h $RPM_BUILD_ROOT%{_includedir}/php/sapi/embed
 %endif
 
 # install CLI
-libtool --mode=install install -p sapi/cli/php $RPM_BUILD_ROOT%{_bindir}/php.cli
-cp -p 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
+libtool --mode=install install -p sapi/cli/php $RPM_BUILD_ROOT%{_bindir}/%{name}
+cp -p sapi/cli/php.1 $RPM_BUILD_ROOT%{_mandir}/man1/%{name}.1
+echo ".so %{name}.1" >$RPM_BUILD_ROOT%{_mandir}/man1/php.1
+ln -sf %{name} $RPM_BUILD_ROOT%{_bindir}/php
 
-sed -e 's#%{_prefix}/lib/php#%{_libdir}/php#g' php.ini > $RPM_BUILD_ROOT%{_sysconfdir}/php.ini
+cp -p php.ini $RPM_BUILD_ROOT%{_sysconfdir}/php.ini
 
 cp -p %{SOURCE5} $RPM_BUILD_ROOT%{_sysconfdir}/php-cli.ini
 cp -p %{SOURCE9} $RPM_BUILD_ROOT%{_sysconfdir}/browscap.ini
@@ -2440,6 +2444,13 @@ cp -p %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/php-apache2handler.ini
 %{__rm} -f $RPM_BUILD_ROOT%{_libdir}/apache/libphp5.la
 %endif
 
+# ensure that paths are correct for current php version and arch
+grep -El '/etc/php/|/usr/lib/php/' %{_sysconfdir}/*.ini | xargs -r \
+%{__sed} -i -e '
+       s#/usr/lib/php#%{php_extensiondir}#
+       s#/etc/php#%{_sysconfdir}#
+'
+
 install -d $RPM_BUILD_ROOT%{_sysconfdir}/conf.d
 cp -p conf.d/*.ini $RPM_BUILD_ROOT%{_sysconfdir}/conf.d
 
@@ -2483,22 +2494,22 @@ sed -i -e 's|libphp_common.la|$(libdir)/libphp_common.la|' $RPM_BUILD_ROOT%{_lib
 %clean
 rm -rf $RPM_BUILD_ROOT
 
-%post -n apache1-mod_php%{php_suffix}
+%post -n apache1-mod_%{name}
 if [ "$1" = "1" ]; then
        %service -q apache restart
 fi
 
-%postun -n apache1-mod_php%{php_suffix}
+%postun -n apache1-mod_%{name}
 if [ "$1" = "0" ]; then
        %service -q apache restart
 fi
 
-%post -n apache-mod_php%{php_suffix}
+%post -n apache-mod_%{name}
 if [ "$1" = "1" ]; then
        %service -q httpd restart
 fi
 
-%postun -n apache-mod_php%{php_suffix}
+%postun -n apache-mod_%{name}
 if [ "$1" = "0" ]; then
        %service -q httpd restart
 fi
@@ -2507,13 +2518,13 @@ fi
 %useradd -u 51 -r -s /bin/false -c "HTTP User" -g http http
 
 %post fpm
-/sbin/chkconfig --add php-fpm
-%service php-fpm restart
+/sbin/chkconfig --add %{name}-fpm
+%service %{name}-fpm restart
 
 %preun fpm
 if [ "$1" = 0 ]; then
-       %service php-fpm stop
-       /sbin/chkconfig --del php-fpm
+       %service %{name}-fpm stop
+       /sbin/chkconfig --del %{name}-fpm
 fi
 
 %postun fpm
@@ -2548,24 +2559,6 @@ fi
 [ ! -f /etc/apache/conf.d/??_mod_php.conf ] || %service -q apache restart
 [ ! -f /etc/httpd/conf.d/??_mod_php.conf ] || %service -q httpd restart
 
-%if %{with apache1}
-%triggerpostun -n apache1-mod_php%{php_suffix} -- php < 4:5.0.4-9.11
-sed -i -e '
-       /^AddType application\/x-httpd-php \.php/s,^,#,
-       /^\(Add\|Load\)Module.*php5\.\(so\|c\)/d
-' /etc/apache/apache.conf
-%service -q apache restart
-%endif
-
-%if %{with apache2}
-%triggerpostun -n apache-mod_php%{php_suffix} -- php < 4:5.0.4-7.1
-# for fixed php-SAPI.ini, the poor php-apache.ini was never read for apache2
-if [ -f %{_sysconfdir}/php-apache.ini.rpmsave ]; then
-       cp -f %{_sysconfdir}/php-apache2handler.ini{,.rpmnew}
-       mv -f %{_sysconfdir}/php-apache.ini.rpmsave %{_sysconfdir}/php-apache2handler.ini
-fi
-%endif
-
 # common macros called at extension post/postun scriptlet
 %define        extension_scripts() \
 %post %1 \
@@ -2650,7 +2643,7 @@ fi
 %extension_scripts zlib
 
 %if %{with apache1}
-%files -n apache1-mod_php%{php_suffix}
+%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
@@ -2659,7 +2652,7 @@ fi
 %endif
 
 %if %{with apache2}
-%files -n apache-mod_php%{php_suffix}
+%files -n apache-mod_%{name}
 %defattr(644,root,root,755)
 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/httpd/conf.d/*_mod_php.conf
 %dir %{_sysconfdir}/apache2handler.d
@@ -2670,7 +2663,7 @@ fi
 %if %{with litespeed}
 %files litespeed
 %defattr(644,root,root,755)
-%attr(755,root,root) %{_sbindir}/php.litespeed
+%attr(755,root,root) %{_sbindir}/%{name}.litespeed
 %endif
 
 %if %{with cgi}
@@ -2678,8 +2671,8 @@ fi
 %defattr(644,root,root,755)
 %dir %{_sysconfdir}/cgi-fcgi.d
 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/php-cgi-fcgi.ini
-%attr(755,root,root) %{_bindir}/php.cgi
-%attr(755,root,root) %{_bindir}/php.fcgi
+%attr(755,root,root) %{_bindir}/%{name}.cgi
+%attr(755,root,root) %{_bindir}/%{name}.fcgi
 %endif
 
 %if %{with embed}
@@ -2692,13 +2685,13 @@ 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.cli
-%{_mandir}/man1/php.1*
-%{_mandir}/man1/php.cli.1*
+%attr(755,root,root) %{_bindir}/%{name}
+%{_mandir}/man1/%{name}.1*
 
 %files program
 %defattr(644,root,root,755)
 %attr(755,root,root) %{_bindir}/php
+%{_mandir}/man1/php.1*
 
 %if %{with fpm}
 %files fpm
@@ -2706,10 +2699,10 @@ fi
 %doc sapi/fpm/{CREDITS,LICENSE}
 %dir %{_sysconfdir}/fpm.d
 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/php-fpm.conf
-%attr(755,root,root) %{_sbindir}/php-fpm
-%{_mandir}/man8/php-fpm.8*
-%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
+%attr(755,root,root) %{_sbindir}/%{name}-fpm
+%{_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
 %endif
 
 %files common
This page took 0.265238 seconds and 4 git commands to generate.