blob: cc19d98375f667d00cdc96767675834020f1a3d4 [file] [log] [blame]
Stanley Cheung5adb71f2016-02-13 00:03:02 -08001%YAML 1.2
2--- |
3 PHP_ARG_ENABLE(grpc, whether to enable grpc support,
4 [ --enable-grpc Enable grpc support])
5
6 if test "$PHP_GRPC" != "no"; then
7 dnl Write more examples of tests here...
8
9 dnl # --with-grpc -> add include path
Stanley Cheungfe71d7f2017-01-12 11:13:23 -080010 PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/include)
11 PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/src/php/ext/grpc)
12 PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/third_party/boringssl/include)
ZhouyihaiDing5ad50ec2018-03-27 09:37:09 -070013 PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/third_party/address_sorting/include)
Stanley Cheung5adb71f2016-02-13 00:03:02 -080014
Stanley Cheungbf74d692016-02-23 22:39:25 -080015 LIBS="-lpthread $LIBS"
16
ZhouyihaiDing32a96fe2018-03-24 19:06:24 -070017 CFLAGS="-Wall -Werror -Wno-parentheses-equality -Wno-unused-value -std=c11 -g -O2 -D PB_FIELD_16BIT=1"
18 CXXFLAGS="-std=c++11 -fno-exceptions -fno-rtti -g -O2 -D PB_FIELD_16BIT=1"
Stanley Cheungbf74d692016-02-23 22:39:25 -080019 GRPC_SHARED_LIBADD="-lpthread $GRPC_SHARED_LIBADD"
Stanley Cheung94d75882017-05-17 14:58:02 -070020 PHP_REQUIRE_CXX()
Stanley Cheung5adb71f2016-02-13 00:03:02 -080021 PHP_ADD_LIBRARY(pthread)
Stanley Cheungbf74d692016-02-23 22:39:25 -080022 PHP_ADD_LIBRARY(dl,,GRPC_SHARED_LIBADD)
23 PHP_ADD_LIBRARY(dl)
24
25 case $host in
Stanley Cheung5ec52ae2017-04-14 15:07:28 -070026 *darwin*)
Stanley Cheung5ec52ae2017-04-14 15:07:28 -070027 ;;
Stanley Cheungbf74d692016-02-23 22:39:25 -080028 *)
29 PHP_ADD_LIBRARY(rt,,GRPC_SHARED_LIBADD)
30 PHP_ADD_LIBRARY(rt)
31 ;;
32 esac
33
Stanley Cheung5adb71f2016-02-13 00:03:02 -080034 PHP_NEW_EXTENSION(grpc,
35 % for source in php_config_m4.src:
36 ${source} ${"\\"}
37 % endfor
38 % for lib in libs:
Stanley Cheungaf525b32017-05-19 20:00:06 -070039 % if lib.name in php_config_m4.get('deps', []) and lib.name != 'z':
Stanley Cheung5adb71f2016-02-13 00:03:02 -080040 % for source in lib.src:
41 ${source} ${"\\"}
42 % endfor
43 % endif
44 % endfor
Stanley Cheung94d75882017-05-17 14:58:02 -070045 , $ext_shared, , -fvisibility=hidden ${"\\"}
46 -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN ${"\\"}
Stanley Cheung19792102017-05-02 11:24:03 -070047 -D_HAS_EXCEPTIONS=0 -DNOMINMAX -DGRPC_ARES=0)
Stanley Cheung80db5be2016-02-24 21:35:56 -080048
49 PHP_ADD_BUILD_DIR($ext_builddir/src/php/ext/grpc)
50 <%
51 dirs = {}
52 for lib in libs:
Stanley Cheungaf525b32017-05-19 20:00:06 -070053 if lib.name in php_config_m4.get('deps', []) and lib.name != 'z':
Stanley Cheung80db5be2016-02-24 21:35:56 -080054 for source in lib.src:
55 dirs[source[:source.rfind('/')]] = 1
56 dirs = dirs.keys()
57 dirs.sort()
58 %>
59 % for dir in dirs:
60 PHP_ADD_BUILD_DIR($ext_builddir/${dir})
61 % endfor
Stanley Cheung5adb71f2016-02-13 00:03:02 -080062 fi