Skip to content

Commit

Permalink
Merge pull request grpc#1170 from murgatroid99/php_external_includes
Browse files Browse the repository at this point in the history
Make PHP library work with PHP 5.6
  • Loading branch information
tbetbetbe committed Apr 2, 2015
2 parents 5228f62 + bfa9e4f commit a830d3c
Show file tree
Hide file tree
Showing 17 changed files with 89 additions and 84 deletions.
5 changes: 4 additions & 1 deletion src/php/bin/interop_client.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,8 @@

set +e
cd $(dirname $0)
php -d extension_dir=../ext/grpc/modules/ -d extension=grpc.so \

module_dir=`php --version | grep -q 'PHP 5.6' && echo '../ext/grpc' || echo '../ext/grpc/modules'`

php -d extension_dir=$module_dir -d extension=grpc.so \
../tests/interop/interop_client.php $@ 1>&2
6 changes: 4 additions & 2 deletions src/php/bin/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,15 @@ set -e
cd $(dirname $0)
default_extension_dir=`php -i | grep extension_dir | sed 's/.*=> //g'`

module_dir=`php --version | grep -q 'PHP 5.6' && echo '../ext/grpc' || echo '../ext/grpc/modules'`

# sym-link in system supplied extensions
for f in $default_extension_dir/*.so
do
ln -s $f ../ext/grpc/modules/$(basename $f) &> /dev/null || true
ln -s $f $module_dir/$(basename $f) &> /dev/null || true
done

php \
-d extension_dir=../ext/grpc/modules/ \
-d extension_dir=$module_dir \
-d extension=grpc.so \
`which phpunit` -v --debug --strict ../tests/unit_tests
12 changes: 6 additions & 6 deletions src/php/ext/grpc/byte_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,18 @@
#include "config.h"
#endif

#include "php.h"
#include "php_ini.h"
#include "ext/standard/info.h"
#include "ext/spl/spl_exceptions.h"
#include <php.h>
#include <php_ini.h>
#include <ext/standard/info.h>
#include <ext/spl/spl_exceptions.h>
#include "php_grpc.h"

#include <string.h>

#include "byte_buffer.h"

#include "grpc/grpc.h"
#include "grpc/support/slice.h"
#include <grpc/grpc.h>
#include <grpc/support/slice.h>

grpc_byte_buffer *string_to_byte_buffer(char *string, size_t length) {
gpr_slice slice = gpr_slice_from_copied_buffer(string, length);
Expand Down
2 changes: 1 addition & 1 deletion src/php/ext/grpc/byte_buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#ifndef NET_GRPC_PHP_GRPC_BYTE_BUFFER_H_
#define NET_GRPC_PHP_GRPC_BYTE_BUFFER_H_

#include "grpc/grpc.h"
#include <grpc/grpc.h>

grpc_byte_buffer *string_to_byte_buffer(char *string, size_t length);

Expand Down
18 changes: 9 additions & 9 deletions src/php/ext/grpc/call.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,20 @@
#include "config.h"
#endif

#include "php.h"
#include "php_ini.h"
#include "ext/standard/info.h"
#include "ext/spl/spl_exceptions.h"
#include <php.h>
#include <php_ini.h>
#include <ext/standard/info.h>
#include <ext/spl/spl_exceptions.h>
#include "php_grpc.h"

#include "zend_exceptions.h"
#include "zend_hash.h"
#include <zend_exceptions.h>
#include <zend_hash.h>

#include <stdbool.h>

#include "grpc/support/log.h"
#include "grpc/support/alloc.h"
#include "grpc/grpc.h"
#include <grpc/support/log.h>
#include <grpc/support/alloc.h>
#include <grpc/grpc.h>

#include "timeval.h"
#include "channel.h"
Expand Down
8 changes: 4 additions & 4 deletions src/php/ext/grpc/call.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@
#include "config.h"
#endif

#include "php.h"
#include "php_ini.h"
#include "ext/standard/info.h"
#include <php.h>
#include <php_ini.h>
#include <ext/standard/info.h>
#include "php_grpc.h"

#include "grpc/grpc.h"
#include <grpc/grpc.h>

/* Class entry for the Call PHP class */
extern zend_class_entry *grpc_ce_call;
Expand Down
16 changes: 8 additions & 8 deletions src/php/ext/grpc/channel.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,19 @@
#include "config.h"
#endif

#include "php.h"
#include "php_ini.h"
#include "ext/standard/info.h"
#include "ext/spl/spl_exceptions.h"
#include <php.h>
#include <php_ini.h>
#include <ext/standard/info.h>
#include <ext/spl/spl_exceptions.h>
#include "php_grpc.h"

#include "zend_exceptions.h"
#include <zend_exceptions.h>

#include <stdbool.h>

#include "grpc/grpc.h"
#include "grpc/support/log.h"
#include "grpc/grpc_security.h"
#include <grpc/grpc.h>
#include <grpc/support/log.h>
#include <grpc/grpc_security.h>

#include "server.h"
#include "credentials.h"
Expand Down
8 changes: 4 additions & 4 deletions src/php/ext/grpc/channel.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@
#include "config.h"
#endif

#include "php.h"
#include "php_ini.h"
#include "ext/standard/info.h"
#include <php.h>
#include <php_ini.h>
#include <ext/standard/info.h>
#include "php_grpc.h"

#include "grpc/grpc.h"
#include <grpc/grpc.h>

/* Class entry for the PHP Channel class */
extern zend_class_entry *grpc_ce_channel;
Expand Down
2 changes: 1 addition & 1 deletion src/php/ext/grpc/config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,5 @@ if test "$PHP_GRPC" != "no"; then

PHP_SUBST(GRPC_SHARED_LIBADD)

PHP_NEW_EXTENSION(grpc, byte_buffer.c call.c channel.c credentials.c timeval.c server.c server_credentials.c php_grpc.c, $ext_shared, , -Wall -Werror -pedantic -std=c99)
PHP_NEW_EXTENSION(grpc, byte_buffer.c call.c channel.c credentials.c timeval.c server.c server_credentials.c php_grpc.c, $ext_shared, , -Wall -Werror -std=c11)
fi
16 changes: 8 additions & 8 deletions src/php/ext/grpc/credentials.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,17 @@
#include "config.h"
#endif

#include "php.h"
#include "php_ini.h"
#include "ext/standard/info.h"
#include "ext/spl/spl_exceptions.h"
#include <php.h>
#include <php_ini.h>
#include <ext/standard/info.h>
#include <ext/spl/spl_exceptions.h>
#include "php_grpc.h"

#include "zend_exceptions.h"
#include "zend_hash.h"
#include <zend_exceptions.h>
#include <zend_hash.h>

#include "grpc/grpc.h"
#include "grpc/grpc_security.h"
#include <grpc/grpc.h>
#include <grpc/grpc_security.h>

zend_class_entry *grpc_ce_credentials;

Expand Down
6 changes: 3 additions & 3 deletions src/php/ext/grpc/php_grpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@
#include "config.h"
#endif

#include "php.h"
#include "php_ini.h"
#include "ext/standard/info.h"
#include <php.h>
#include <php_ini.h>
#include <ext/standard/info.h>
#include "php_grpc.h"

// ZEND_DECLARE_MODULE_GLOBALS(grpc)
Expand Down
16 changes: 8 additions & 8 deletions src/php/ext/grpc/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,19 @@
#include "config.h"
#endif

#include "php.h"
#include "php_ini.h"
#include "ext/standard/info.h"
#include "ext/spl/spl_exceptions.h"
#include <php.h>
#include <php_ini.h>
#include <ext/standard/info.h>
#include <ext/spl/spl_exceptions.h>
#include "php_grpc.h"

#include "zend_exceptions.h"
#include <zend_exceptions.h>

#include <stdbool.h>

#include "grpc/grpc.h"
#include "grpc/support/log.h"
#include "grpc/grpc_security.h"
#include <grpc/grpc.h>
#include <grpc/support/log.h>
#include <grpc/grpc_security.h>

#include "server.h"
#include "channel.h"
Expand Down
8 changes: 4 additions & 4 deletions src/php/ext/grpc/server.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@
#include "config.h"
#endif

#include "php.h"
#include "php_ini.h"
#include "ext/standard/info.h"
#include <php.h>
#include <php_ini.h>
#include <ext/standard/info.h>
#include "php_grpc.h"

#include "grpc/grpc.h"
#include <grpc/grpc.h>

/* Class entry for the Server PHP class */
extern zend_class_entry *grpc_ce_server;
Expand Down
16 changes: 8 additions & 8 deletions src/php/ext/grpc/server_credentials.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,17 @@
#include "config.h"
#endif

#include "php.h"
#include "php_ini.h"
#include "ext/standard/info.h"
#include "ext/spl/spl_exceptions.h"
#include <php.h>
#include <php_ini.h>
#include <ext/standard/info.h>
#include <ext/spl/spl_exceptions.h>
#include "php_grpc.h"

#include "zend_exceptions.h"
#include "zend_hash.h"
#include <zend_exceptions.h>
#include <zend_hash.h>

#include "grpc/grpc.h"
#include "grpc/grpc_security.h"
#include <grpc/grpc.h>
#include <grpc/grpc_security.h>

zend_class_entry *grpc_ce_server_credentials;

Expand Down
10 changes: 5 additions & 5 deletions src/php/ext/grpc/server_credentials.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@
#include "config.h"
#endif

#include "php.h"
#include "php_ini.h"
#include "ext/standard/info.h"
#include <php.h>
#include <php_ini.h>
#include <ext/standard/info.h>
#include "php_grpc.h"

#include "grpc/grpc.h"
#include "grpc/grpc_security.h"
#include <grpc/grpc.h>
#include <grpc/grpc_security.h>

/* Class entry for the Server_Credentials PHP class */
extern zend_class_entry *grpc_ce_server_credentials;
Expand Down
14 changes: 7 additions & 7 deletions src/php/ext/grpc/timeval.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,18 @@
#include "config.h"
#endif

#include "php.h"
#include "php_ini.h"
#include "ext/standard/info.h"
#include "ext/spl/spl_exceptions.h"
#include <php.h>
#include <php_ini.h>
#include <ext/standard/info.h>
#include <ext/spl/spl_exceptions.h>
#include "php_grpc.h"

#include "zend_exceptions.h"
#include <zend_exceptions.h>

#include <stdbool.h>

#include "grpc/grpc.h"
#include "grpc/support/time.h"
#include <grpc/grpc.h>
#include <grpc/support/time.h>

zend_class_entry *grpc_ce_timeval;

Expand Down
10 changes: 5 additions & 5 deletions src/php/ext/grpc/timeval.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@
#include "config.h"
#endif

#include "php.h"
#include "php_ini.h"
#include "ext/standard/info.h"
#include <php.h>
#include <php_ini.h>
#include <ext/standard/info.h>
#include "php_grpc.h"

#include "grpc/grpc.h"
#include "grpc/support/time.h"
#include <grpc/grpc.h>
#include <grpc/support/time.h>

/* Class entry for the Timeval PHP Class */
extern zend_class_entry *grpc_ce_timeval;
Expand Down

0 comments on commit a830d3c

Please sign in to comment.