[php] add php-mysqlnd subpackage

Remi Collet remi at fedoraproject.org
Tue Sep 13 16:47:26 UTC 2011


commit 8863ec23721350be4ad0125b4b0d908c3482397b
Author: remi <fedora at famillecollet.com>
Date:   Tue Sep 13 18:47:06 2011 +0200

    add php-mysqlnd subpackage

 php-5.3.0-phpize64.patch |   24 -----------
 php-5.3.8-aconf259.patch |   18 ++++----
 php-5.3.8-mysqlnd.patch  |   77 ++++++++++++++++++++++++++++++++++++
 php.spec                 |   98 ++++++++++++++++++++++++++++++++++++++-------
 4 files changed, 168 insertions(+), 49 deletions(-)
---
diff --git a/php-5.3.8-aconf259.patch b/php-5.3.8-aconf259.patch
index b135fc4..1d9696b 100644
--- a/php-5.3.8-aconf259.patch
+++ b/php-5.3.8-aconf259.patch
@@ -1,6 +1,6 @@
 diff -up php-5.3.8/build/buildcheck.sh.aconf259 php-5.3.8/build/buildcheck.sh
 --- php-5.3.8/build/buildcheck.sh.aconf259	2011-05-18 21:55:34.000000000 +0200
-+++ php-5.3.8/build/buildcheck.sh	2011-08-23 13:43:08.977271533 +0200
++++ php-5.3.8/build/buildcheck.sh	2011-09-12 17:42:17.016672712 +0200
 @@ -28,33 +28,23 @@ if test -z "$PHP_AUTOCONF"; then
    PHP_AUTOCONF='autoconf'
  fi
@@ -41,8 +41,8 @@ diff -up php-5.3.8/build/buildcheck.sh.aconf259 php-5.3.8/build/buildcheck.sh
  if test "$1" = "2" -a "$2" -ge "50"; then
    ./vcsclean
 diff -up php-5.3.8/configure.in.aconf259 php-5.3.8/configure.in
---- php-5.3.8/configure.in.aconf259	2011-08-23 13:43:08.971271521 +0200
-+++ php-5.3.8/configure.in	2011-08-23 13:43:34.264326174 +0200
+--- php-5.3.8/configure.in.aconf259	2011-09-12 17:42:17.008672708 +0200
++++ php-5.3.8/configure.in	2011-09-12 17:42:17.017672713 +0200
 @@ -1,28 +1,6 @@
  ## $Id: configure.in 315343 2011-08-23 08:56:29Z johannes $ -*- autoconf -*-
  dnl ## Process this file with autoconf to produce a configure script.
@@ -138,7 +138,7 @@ diff -up php-5.3.8/configure.in.aconf259 php-5.3.8/configure.in
  
 diff -up php-5.3.8/ext/standard/config.m4.aconf259 php-5.3.8/ext/standard/config.m4
 --- php-5.3.8/ext/standard/config.m4.aconf259	2010-06-17 12:22:03.000000000 +0200
-+++ php-5.3.8/ext/standard/config.m4	2011-08-23 13:43:08.979271537 +0200
++++ php-5.3.8/ext/standard/config.m4	2011-09-12 17:42:17.018672714 +0200
 @@ -1,7 +1,5 @@
  dnl $Id: config.m4 300511 2010-06-17 10:22:03Z pajoye $ -*- autoconf -*-
  
@@ -158,7 +158,7 @@ diff -up php-5.3.8/ext/standard/config.m4.aconf259 php-5.3.8/ext/standard/config
  dnl and defining which handles it receives
 diff -up php-5.3.8/scripts/php-config.in.aconf259 php-5.3.8/scripts/php-config.in
 --- php-5.3.8/scripts/php-config.in.aconf259	2011-04-18 13:13:37.000000000 +0200
-+++ php-5.3.8/scripts/php-config.in	2011-08-23 13:43:08.980271540 +0200
++++ php-5.3.8/scripts/php-config.in	2011-09-12 17:42:17.019672714 +0200
 @@ -2,6 +2,7 @@
  
  SED="@SED@"
@@ -168,19 +168,19 @@ diff -up php-5.3.8/scripts/php-config.in.aconf259 php-5.3.8/scripts/php-config.i
  version="@PHP_VERSION@"
  vernum="@PHP_VERSION_ID@"
 diff -up php-5.3.8/scripts/phpize.in.aconf259 php-5.3.8/scripts/phpize.in
---- php-5.3.8/scripts/phpize.in.aconf259	2011-08-23 13:43:08.968271513 +0200
-+++ php-5.3.8/scripts/phpize.in	2011-08-23 13:43:08.981271543 +0200
+--- php-5.3.8/scripts/phpize.in.aconf259	2009-06-24 09:42:33.000000000 +0200
++++ php-5.3.8/scripts/phpize.in	2011-09-12 17:43:12.706714796 +0200
 @@ -2,6 +2,7 @@
  
  # Variable declaration
  prefix='@prefix@'
 +datarootdir='@datarootdir@'
  exec_prefix="`eval echo @exec_prefix@`"
- phpdir="@libdir@/php/build"
+ phpdir="`eval echo @libdir@`/build"
  includedir="`eval echo @includedir@`/php"
 diff -up php-5.3.8/scripts/phpize.m4.aconf259 php-5.3.8/scripts/phpize.m4
 --- php-5.3.8/scripts/phpize.m4.aconf259	2010-11-02 10:58:08.000000000 +0100
-+++ php-5.3.8/scripts/phpize.m4	2011-08-23 13:43:08.982271545 +0200
++++ php-5.3.8/scripts/phpize.m4	2011-09-12 17:42:17.020672715 +0200
 @@ -1,9 +1,8 @@
  dnl This file becomes configure.in for self-contained extensions.
  
diff --git a/php-5.3.8-mysqlnd.patch b/php-5.3.8-mysqlnd.patch
new file mode 100644
index 0000000..7849784
--- /dev/null
+++ b/php-5.3.8-mysqlnd.patch
@@ -0,0 +1,77 @@
+diff -up php-5.3.8/ext/mysqlnd/config9.m4.mysqlnd php-5.3.8/ext/mysqlnd/config9.m4
+--- php-5.3.8/ext/mysqlnd/config9.m4.mysqlnd	2011-03-23 18:14:28.000000000 +0100
++++ php-5.3.8/ext/mysqlnd/config9.m4	2011-09-12 17:44:54.403846592 +0200
+@@ -3,6 +3,10 @@ dnl $Id: config9.m4 309609 2011-03-23 17
+ dnl config.m4 for mysqlnd driver
+ 
+ 
++PHP_ARG_ENABLE(mysqlnd, whether to enable mysqlnd,
++  [  --enable-mysqlnd       Enable mysqlnd expliciely, will be done implicitly
++                         when required by other extensions], no, yes)
++
+ PHP_ARG_ENABLE(mysqlnd_compression_support, whether to enable compressed protocol support in mysqlnd,
+ [  --disable-mysqlnd-compression-support
+                             Disable support for the MySQL compressed protocol in mysqlnd], yes, no)
+@@ -13,7 +17,7 @@ if test -z "$PHP_ZLIB_DIR"; then
+ fi
+ 
+ dnl If some extension uses mysqlnd it will get compiled in PHP core
+-if test "$PHP_MYSQLND_ENABLED" = "yes"; then
++if test "$PHP_MYSQLND" != "no" || test "$PHP_MYSQLND_ENABLED" = "yes"; then
+   mysqlnd_ps_sources="mysqlnd_ps.c mysqlnd_ps_codec.c"
+   mysqlnd_base_sources="mysqlnd.c mysqlnd_charset.c mysqlnd_wireprotocol.c \
+                    mysqlnd_loaddata.c mysqlnd_net.c mysqlnd_statistics.c \
+@@ -27,12 +31,12 @@ if test "$PHP_MYSQLND_ENABLED" = "yes"; 
+   AC_DEFINE([MYSQLND_SSL_SUPPORTED], 1, [Enable SSL support])
+ 
+   mysqlnd_sources="$mysqlnd_base_sources $mysqlnd_ps_sources"
+-  PHP_NEW_EXTENSION(mysqlnd, $mysqlnd_sources, no)
++  PHP_NEW_EXTENSION(mysqlnd, $mysqlnd_sources, $ext_shared)
+   PHP_ADD_BUILD_DIR([ext/mysqlnd], 1)
+   PHP_INSTALL_HEADERS([ext/mysqlnd/])
+ fi
+ 
+-if test "$PHP_MYSQLND_ENABLED" = "yes" || test "$PHP_MYSQLI" != "no"; then
++if test "$PHP_MYSQLND" != "no" || test "$PHP_MYSQLND_ENABLED" = "yes" || test "$PHP_MYSQLI" != "no"; then
+   PHP_ADD_BUILD_DIR([ext/mysqlnd], 1)
+ 
+   dnl This creates a file so it has to be after above macros
+diff -up php-5.3.8/ext/mysqlnd/mysqlnd.c.mysqlnd php-5.3.8/ext/mysqlnd/mysqlnd.c
+--- php-5.3.8/ext/mysqlnd/mysqlnd.c.mysqlnd	2011-09-12 17:50:37.676119503 +0200
++++ php-5.3.8/ext/mysqlnd/mysqlnd.c	2011-09-12 17:50:41.695136669 +0200
+@@ -620,7 +620,7 @@ MYSQLND_METHOD(mysqlnd_conn, connect)(MY
+ 		if (host_len == sizeof("localhost") - 1 && !strncasecmp(host, "localhost", host_len)) {
+ 			DBG_INF_FMT("socket=%s", socket_or_pipe? socket_or_pipe:"n/a");
+ 			if (!socket_or_pipe) {
+-				socket_or_pipe = "/tmp/mysql.sock";
++				socket_or_pipe = "/var/lib/mysql/mysql.sock";
+ 			}
+ 			transport_len = spprintf(&transport, 0, "unix://%s", socket_or_pipe);
+ 			unix_socket = TRUE;
+diff -up php-5.3.8/ext/mysqlnd/php_mysqlnd.c.mysqlnd php-5.3.8/ext/mysqlnd/php_mysqlnd.c
+--- php-5.3.8/ext/mysqlnd/php_mysqlnd.c.mysqlnd	2011-08-06 16:47:44.000000000 +0200
++++ php-5.3.8/ext/mysqlnd/php_mysqlnd.c	2011-09-12 17:44:54.404846593 +0200
+@@ -299,6 +299,11 @@ zend_module_entry mysqlnd_module_entry =
+ };
+ /* }}} */
+ 
++/* {{{ COMPILE_DL_MYSQLND */
++#ifdef COMPILE_DL_MYSQLND
++ZEND_GET_MODULE(mysqlnd)
++#endif
++/* }}} */
+ 
+ /*
+  * Local variables:
+diff -up php-5.3.8/ext/pdo_mysql/pdo_mysql.c.mysqlnd php-5.3.8/ext/pdo_mysql/pdo_mysql.c
+--- php-5.3.8/ext/pdo_mysql/pdo_mysql.c.mysqlnd	2011-09-12 17:49:24.769799256 +0200
++++ php-5.3.8/ext/pdo_mysql/pdo_mysql.c	2011-09-12 17:49:31.216828314 +0200
+@@ -42,7 +42,7 @@ ZEND_DECLARE_MODULE_GLOBALS(pdo_mysql);
+ #  ifdef PHP_MYSQL_UNIX_SOCK_ADDR
+ #   define PDO_MYSQL_UNIX_ADDR PHP_MYSQL_UNIX_SOCK_ADDR
+ #  else
+-#   define PDO_MYSQL_UNIX_ADDR "/tmp/mysql.sock"
++#   define PDO_MYSQL_UNIX_ADDR "/var/lib/mysql/mysql.sock"
+ #  endif
+ # endif
+ #endif
diff --git a/php.spec b/php.spec
index 0634e74..8a88191 100644
--- a/php.spec
+++ b/php.spec
@@ -37,7 +37,7 @@
 Summary: PHP scripting language for creating dynamic web sites
 Name: php
 Version: 5.3.8
-Release: 1%{?dist}
+Release: 2%{?dist}
 License: PHP
 Group: Development/Languages
 URL: http://www.php.net/
@@ -55,13 +55,15 @@ Source7: php-fpm.logrotate
 Patch1: php-5.3.7-gnusrc.patch
 Patch2: php-5.3.0-install.patch
 Patch3: php-5.2.4-norpath.patch
-Patch4: php-5.3.0-phpize64.patch
 Patch5: php-5.2.0-includedir.patch
 Patch6: php-5.2.4-embed.patch
 Patch7: php-5.3.0-recode.patch
 # from http://svn.php.net/viewvc?view=revision&revision=311042
 # and  http://svn.php.net/viewvc?view=revision&revision=311908
 Patch8: php-5.3.8-aconf259.patch
+# from http://svn.php.net/viewvc?view=revision&revision=316281
+# + fix harcoded mysql.sock path
+Patch9: php-5.3.8-mysqlnd.patch
 
 # Fixes for extension modules
 Patch20: php-4.3.11-shutdown.patch
@@ -263,10 +265,12 @@ Summary: A module for PHP applications that use MySQL databases
 Group: Development/Languages
 Requires: php-pdo%{?_isa} = %{version}-%{release}
 Provides: php_database
-Provides: php-mysqli, php-mysqli%{?_isa}
+Provides: php-mysqli = %{version}-%{release}
+Provides: php-mysqli%{?_isa} = %{version}-%{release}
 Provides: php-pdo_mysql, php-pdo_mysql%{?_isa}
 Obsoletes: mod_php3-mysql, stronghold-php-mysql
 BuildRequires: mysql-devel >= 4.1.0
+Conflicts: php-mysqlnd
 
 %description mysql
 The php-mysql package contains a dynamic shared object that will add
@@ -275,6 +279,26 @@ management system. PHP is an HTML-embeddable scripting language. If
 you need MySQL support for PHP applications, you will need to install
 this package and the php package.
 
+%package mysqlnd
+Summary: A module for PHP applications that use MySQL databases
+Group: Development/Languages
+Requires: php-pdo%{?_isa} = %{version}-%{release}
+Provides: php_database
+Provides: php-mysql = %{version}-%{release}
+Provides: php-mysql%{?_isa} = %{version}-%{release}
+Provides: php-mysqli = %{version}-%{release}
+Provides: php-mysqli%{?_isa} = %{version}-%{release}
+Provides: php-pdo_mysql, php-pdo_mysql%{?_isa}
+
+%description mysqlnd
+The php-mysqlnd package contains a dynamic shared object that will add
+MySQL database support to PHP. MySQL is an object-relational database
+management system. PHP is an HTML-embeddable scripting language. If
+you need MySQL support for PHP applications, you will need to install
+this package and the php package.
+
+This package use the MySQL Native Driver
+
 %package pgsql
 Summary: A PostgreSQL database module for PHP
 Group: Development/Languages
@@ -524,11 +548,11 @@ support for using the enchant library to PHP.
 %patch1 -p1 -b .gnusrc
 %patch2 -p1 -b .install
 %patch3 -p1 -b .norpath
-%patch4 -p1 -b .phpize64
 %patch5 -p1 -b .includedir
 %patch6 -p1 -b .embed
 %patch7 -p1 -b .recode
 %patch8 -p1 -b .aconf26x
+%patch9 -p1 -b .mysqlnd
 
 %patch20 -p1 -b .shutdown
 %patch21 -p1 -b .macropen
@@ -698,6 +722,7 @@ make %{?_smp_mflags}
 # Build /usr/bin/php-cgi with the CGI SAPI, and all the shared extensions
 pushd build-cgi
 build --enable-force-cgi-redirect \
+      --libdir=%{_libdir}/php \
       --enable-pcntl \
       --with-imap=shared --with-imap-ssl \
       --enable-mbstring=shared \
@@ -707,8 +732,9 @@ build --enable-force-cgi-redirect \
       --enable-dba=shared --with-db4=%{_prefix} \
       --with-xmlrpc=shared \
       --with-ldap=shared --with-ldap-sasl \
-      --with-mysql=shared,%{_prefix} \
-      --with-mysqli=shared,%{mysql_config} \
+      --enable-mysqlnd=shared \
+      --with-mysql=shared,mysqlnd \
+      --with-mysqli=shared,mysqlnd \
       --with-interbase=shared,%{_libdir}/firebird \
       --with-pdo-firebird=shared,%{_libdir}/firebird \
       --enable-dom=shared \
@@ -722,7 +748,7 @@ build --enable-force-cgi-redirect \
       --enable-fastcgi \
       --enable-pdo=shared \
       --with-pdo-odbc=shared,unixODBC,%{_prefix} \
-      --with-pdo-mysql=shared,%{mysql_config} \
+      --with-pdo-mysql=shared,mysqlnd \
       --with-pdo-pgsql=shared,%{_prefix} \
       --with-pdo-sqlite=shared,%{_prefix} \
       --with-pdo-dblib=shared,%{_prefix} \
@@ -748,9 +774,9 @@ build --enable-force-cgi-redirect \
       --with-recode=shared,%{_prefix}
 popd
 
-without_shared="--without-mysql --without-gd \
+without_shared="--without-gd \
       --disable-dom --disable-dba --without-unixODBC \
-      --disable-pdo --disable-xmlreader --disable-xmlwriter \
+      --disable-xmlreader --disable-xmlwriter \
       --without-sqlite3 --disable-phar --disable-fileinfo \
       --disable-json --without-pspell --disable-wddx \
       --without-curl --disable-posix \
@@ -758,26 +784,40 @@ without_shared="--without-mysql --without-gd \
 
 # Build Apache module, and the CLI SAPI, /usr/bin/php
 pushd build-apache
-build --with-apxs2=%{_sbindir}/apxs ${without_shared}
+build --with-apxs2=%{_sbindir}/apxs \
+      --libdir=%{_libdir}/php \
+      --enable-pdo=shared \
+      --with-mysql=shared,%{_prefix} \
+      --with-mysqli=shared,%{mysql_config} \
+      --with-pdo-mysql=shared,%{mysql_config} \
+      --with-pdo-sqlite=shared,%{_prefix} \
+      ${without_shared}
 popd
 
 %if %{with_fpm}
 # Build php-fpm
 pushd build-fpm
-build --enable-fpm ${without_shared}
+build --enable-fpm \
+      --libdir=%{_libdir}/php \
+      --without-mysql --disable-pdo \
+      ${without_shared}
 popd
 %endif
 
 # Build for inclusion as embedded script language into applications,
 # /usr/lib[64]/libphp5.so
 pushd build-embedded
-build --enable-embed ${without_shared}
+build --enable-embed \
+      --without-mysql --disable-pdo \
+      ${without_shared}
 popd
 
 # Build a special thread-safe Apache SAPI
 pushd build-zts
-EXTENSION_DIR=%{_libdir}/php/modules-zts
+EXTENSION_DIR=%{_libdir}/php-zts/modules
 build --with-apxs2=%{_sbindir}/apxs ${without_shared} \
+      --libdir=%{_libdir}/php-zts \
+      --without-mysql --disable-pdo \
       --enable-maintainer-zts \
       --with-config-file-scan-dir=%{_sysconfdir}/php-zts.d
 popd
@@ -812,11 +852,25 @@ make -C build-embedded install-sapi install-headers INSTALL_ROOT=$RPM_BUILD_ROOT
 
 %if %{with_fpm}
 # Install the php-fpm binary
-make -C build-fpm install-fpm INSTALL_ROOT=$RPM_BUILD_ROOT 
+make -C build-fpm install-fpm \
+     INSTALL_ROOT=$RPM_BUILD_ROOT
 %endif
 
 # Install everything from the CGI SAPI build
-make -C build-cgi install INSTALL_ROOT=$RPM_BUILD_ROOT 
+make -C build-cgi install \
+     INSTALL_ROOT=$RPM_BUILD_ROOT
+
+# rename extensions build with mysqlnd
+mv $RPM_BUILD_ROOT%{_libdir}/php/modules/mysql.so \
+   $RPM_BUILD_ROOT%{_libdir}/php/modules/mysqlnd_mysql.so
+mv $RPM_BUILD_ROOT%{_libdir}/php/modules/mysqli.so \
+   $RPM_BUILD_ROOT%{_libdir}/php/modules/mysqlnd_mysqli.so
+mv $RPM_BUILD_ROOT%{_libdir}/php/modules/pdo_mysql.so \
+   $RPM_BUILD_ROOT%{_libdir}/php/modules/pdo_mysqlnd.so
+
+# Install the mysql extension build with libmysql
+make -C build-apache install-modules \
+     INSTALL_ROOT=$RPM_BUILD_ROOT
 
 # Install the default configuration file and icons
 install -m 755 -d $RPM_BUILD_ROOT%{_sysconfdir}/
@@ -870,6 +924,7 @@ install -m 644 php-fpm.tmpfiles $RPM_BUILD_ROOT%{_sysconfdir}/tmpfiles.d/php-fpm
 
 # Generate files lists and stub .ini files for each subpackage
 for mod in pgsql mysql mysqli odbc ldap snmp xmlrpc imap \
+    mysqlnd mysqlnd_mysql mysqlnd_mysqli pdo_mysqlnd \
     mbstring gd dom xsl soap bcmath dba xmlreader xmlwriter \
     pdo pdo_mysql pdo_pgsql pdo_odbc pdo_sqlite json %{zipmod} \
     sqlite3 enchant phar fileinfo intl \
@@ -890,6 +945,11 @@ cat files.dom files.xsl files.xml{reader,writer} files.wddx > files.xml
 
 # The mysql and mysqli modules are both packaged in php-mysql
 cat files.mysqli >> files.mysql
+# mysqlnd
+cat files.mysqlnd_mysql \
+    files.mysqlnd_mysqli \
+    files.pdo_mysqlnd \
+    >> files.mysqlnd
 
 # Split out the PDO modules
 cat files.pdo_dblib >> files.mssql
@@ -966,7 +1026,7 @@ fi
 #dir %{_sysconfdir}/php-zts.d
 %dir %{_libdir}/php
 %dir %{_libdir}/php/modules
-#dir %{_libdir}/php/modules-zts
+#dir %{_libdir}/php-zts/modules
 %dir %{_localstatedir}/lib/php
 %dir %{_libdir}/php/pear
 %dir %{_datadir}/php
@@ -1038,9 +1098,15 @@ fi
 %files recode -f files.recode
 %files interbase -f files.interbase
 %files enchant -f files.enchant
+%files mysqlnd -f files.mysqlnd
 
 
 %changelog
+* Tue Sep 13 2011 Remi Collet <remi at fedoraproject.org> 5.3.8-2
+- add mysqlnd sub-package
+- drop patch4, use --libdir to use /usr/lib*/php/build
+- add patch to redirect mysql.sock (in mysqlnd)
+
 * Tue Aug 23 2011 Remi Collet <remi at fedoraproject.org> 5.3.8-1
 - update to 5.3.8
   http://www.php.net/ChangeLog-5.php#5.3.8


More information about the scm-commits mailing list