You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by br...@apache.org on 2010/08/25 19:09:03 UTC

svn commit: r989226 - in /incubator/thrift/trunk: bootstrap.sh configure.ac lib/php/Makefile.am lib/php/thrift_protocol.ini

Author: bryanduxbury
Date: Wed Aug 25 17:09:02 2010
New Revision: 989226

URL: http://svn.apache.org/viewvc?rev=989226&view=rev
Log:
THRIFT-854. php: Provide configure option and make rules to build/install php extension

This patch adds a make target in lib/php that builds the php extension. By default configure will attempt to build this, but it can be disabled with --without-php_extension.

Patch: Anthony Molinaro

Added:
    incubator/thrift/trunk/lib/php/thrift_protocol.ini
Modified:
    incubator/thrift/trunk/bootstrap.sh
    incubator/thrift/trunk/configure.ac
    incubator/thrift/trunk/lib/php/Makefile.am

Modified: incubator/thrift/trunk/bootstrap.sh
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/bootstrap.sh?rev=989226&r1=989225&r2=989226&view=diff
==============================================================================
--- incubator/thrift/trunk/bootstrap.sh (original)
+++ incubator/thrift/trunk/bootstrap.sh Wed Aug 25 17:09:02 2010
@@ -20,6 +20,7 @@
 #
 
 ./cleanup.sh
+(cd lib/php/src/ext/thrift_protocol && phpize)
 
 autoscan || exit 1
 aclocal -I ./aclocal || exit 1

Modified: incubator/thrift/trunk/configure.ac
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/configure.ac?rev=989226&r1=989225&r2=989226&view=diff
==============================================================================
--- incubator/thrift/trunk/configure.ac (original)
+++ incubator/thrift/trunk/configure.ac Wed Aug 25 17:09:02 2010
@@ -48,6 +48,13 @@ AC_ARG_VAR([PHP_PREFIX], [Prefix for ins
                          Default = "/usr/lib/php"])
 AS_IF([test "x$PHP_PREFIX" = x], [PHP_PREFIX="/usr/lib/php"])
 
+AC_ARG_VAR([PHP_CONFIG_PREFIX],
+           [Prefix for installing PHP extension module .ini file.
+            (Normal --prefix is ignored for PHP because PHP has
+             different conventions.)
+           Default = "/etc/php.d"])
+AS_IF([test "x$PHP_CONFIG_PREFIX" = x], [PHP_CONFIG_PREFIX="/etc/php.d"])
+
 AC_ARG_VAR([PERL_PREFIX], [Prefix for installing Perl modules.
                            (Normal --prefix is ignored for Perl because
                            Perl has different conventions.)
@@ -137,6 +144,13 @@ if test "$with_php" = "yes"; then
 fi
 AM_CONDITIONAL(WITH_PHP, [test -n "$PHP"])
 
+AX_THRIFT_LIB(php_extension, [PHP_EXTENSION], yes)
+if test "$with_php_extension" = "yes"; then
+  AC_PATH_PROG([PHP_CONFIG], [php-config])
+  AC_CONFIG_SUBDIRS([lib/php/src/ext/thrift_protocol])
+fi
+AM_CONDITIONAL(WITH_PHP_EXTENSION, [test -n "$PHP_CONFIG"])
+
 AX_THRIFT_LIB(ruby, [Ruby], yes)
 if test "$with_ruby" = "yes"; then
   AC_PATH_PROG([RUBY], [ruby])

Modified: incubator/thrift/trunk/lib/php/Makefile.am
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/php/Makefile.am?rev=989226&r1=989225&r2=989226&view=diff
==============================================================================
--- incubator/thrift/trunk/lib/php/Makefile.am (original)
+++ incubator/thrift/trunk/lib/php/Makefile.am Wed Aug 25 17:09:02 2010
@@ -17,17 +17,23 @@
 # under the License.
 #
 
+%.so:
+	cd src/ext/thrift_protocol/ \
+	  && $(MAKE)
+
+if WITH_PHP_EXTENSION
+phpconfdir=$(PHP_CONFIG_PREFIX)
+phpconf_DATA=thrift_protocol.ini
+
+phpmoduledir = `php-config --extension-dir`
+phpmodule_SCRIPTS = src/ext/thrift_protocol/modules/thrift_protocol.so
+endif
+
 phpdir = $(PHP_PREFIX)
 php_DATA =  \
   src/autoload.php \
   src/Thrift.php
 
-phpextdir = $(phpdir)/ext/thrift_protocol
-phpext_DATA = \
-  src/ext/thrift_protocol/config.m4 \
-  src/ext/thrift_protocol/php_thrift_protocol.cpp \
-  src/ext/thrift_protocol/php_thrift_protocol.h
-
 phpprotocoldir = $(phpdir)/protocol
 phpprotocol_DATA = \
   src/protocol/TBinaryProtocol.php \

Added: incubator/thrift/trunk/lib/php/thrift_protocol.ini
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/php/thrift_protocol.ini?rev=989226&view=auto
==============================================================================
--- incubator/thrift/trunk/lib/php/thrift_protocol.ini (added)
+++ incubator/thrift/trunk/lib/php/thrift_protocol.ini Wed Aug 25 17:09:02 2010
@@ -0,0 +1 @@
+extension=thrift_protocol.so