From aac57fde95e19fc1c0062747aca748cc8e5e9980 Mon Sep 17 00:00:00 2001
From: Craig Tiller <ctiller@google.com>
Date: Fri, 16 Jan 2015 12:54:26 -0800
Subject: [PATCH] Build php modules from run_tests.py

---
 src/php/ext/grpc/config.m4   | 12 +++++++++---
 tools/run_tests/build_php.sh | 21 +++++++++++++++++++++
 2 files changed, 30 insertions(+), 3 deletions(-)

diff --git a/src/php/ext/grpc/config.m4 b/src/php/ext/grpc/config.m4
index d7d13f413e..f8f15ce968 100755
--- a/src/php/ext/grpc/config.m4
+++ b/src/php/ext/grpc/config.m4
@@ -38,7 +38,13 @@ if test "$PHP_GRPC" != "no"; then
   PHP_ADD_LIBRARY(rt,,GRPC_SHARED_LIBADD)
   PHP_ADD_LIBRARY(rt)
 
-  PHP_ADD_LIBPATH($GRPC_DIR/lib)
+  if test -e $GRPC_DIR/libs/opt; then
+    GRPC_LIBDIR=$GRPC_DIR/libs/opt
+  else
+    GRPC_LIBDIR=$GRPC_DIR/lib
+  fi
+
+  PHP_ADD_LIBPATH($GRPC_LIBDIR)
 
   PHP_CHECK_LIBRARY(gpr,gpr_now,
   [
@@ -48,7 +54,7 @@ if test "$PHP_GRPC" != "no"; then
   ],[
     AC_MSG_ERROR([wrong gpr lib version or lib not found])
   ],[
-    -L$GRPC_DIR/lib
+    -L$GRPC_LIBDIR
   ])
 
   PHP_ADD_LIBRARY(event,,GRPC_SHARED_LIBADD)
@@ -68,7 +74,7 @@ if test "$PHP_GRPC" != "no"; then
   ],[
     AC_MSG_ERROR([wrong grpc lib version or lib not found])
   ],[
-    -L$GRPC_DIR/lib
+    -L$GRPC_LIBDIR
   ])
 
   PHP_SUBST(GRPC_SHARED_LIBADD)
diff --git a/tools/run_tests/build_php.sh b/tools/run_tests/build_php.sh
index a9bf588e2f..996ddce29b 100755
--- a/tools/run_tests/build_php.sh
+++ b/tools/run_tests/build_php.sh
@@ -1 +1,22 @@
 #!/bin/bash
+
+set -ex
+
+# change to grpc repo root
+cd $(dirname $0)/../..
+
+export GRPC_DIR=`pwd`
+
+# make the libraries
+make -j shared_c
+
+# build php
+cd src/php
+
+cd ext/grpc
+phpize
+cd ../..
+ext/grpc/configure
+#cd ext/grpc
+make
+
-- 
GitLab