blob: 8bcbb47319a6bdbb5002ee83793962bc8fb2310c [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)
Stanley Cheung5ec52ae2017-04-14 15:07:28 -070013 PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/third_party/cares)
14 PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/third_party/cares/cares)
Stanley Cheung5adb71f2016-02-13 00:03:02 -080015
Stanley Cheungbf74d692016-02-23 22:39:25 -080016 LIBS="-lpthread $LIBS"
17
Stanley Cheung94d75882017-05-17 14:58:02 -070018 CFLAGS="-Wall -Werror -Wno-parentheses-equality -Wno-unused-value -std=c11"
19 CXXFLAGS="-std=c++11"
Stanley Cheungbf74d692016-02-23 22:39:25 -080020 GRPC_SHARED_LIBADD="-lpthread $GRPC_SHARED_LIBADD"
Stanley Cheung94d75882017-05-17 14:58:02 -070021 PHP_REQUIRE_CXX()
Stanley Cheung5adb71f2016-02-13 00:03:02 -080022 PHP_ADD_LIBRARY(pthread)
Stanley Cheungbf74d692016-02-23 22:39:25 -080023 PHP_ADD_LIBRARY(dl,,GRPC_SHARED_LIBADD)
24 PHP_ADD_LIBRARY(dl)
25
26 case $host in
Stanley Cheung5ec52ae2017-04-14 15:07:28 -070027 *darwin*)
28 PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/third_party/cares/config_darwin)
29 ;;
Stanley Cheungbf74d692016-02-23 22:39:25 -080030 *)
Stanley Cheung5ec52ae2017-04-14 15:07:28 -070031 PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/third_party/cares/config_linux)
Stanley Cheungbf74d692016-02-23 22:39:25 -080032 PHP_ADD_LIBRARY(rt,,GRPC_SHARED_LIBADD)
33 PHP_ADD_LIBRARY(rt)
34 ;;
35 esac
36
Stanley Cheung5adb71f2016-02-13 00:03:02 -080037 PHP_NEW_EXTENSION(grpc,
38 % for source in php_config_m4.src:
39 ${source} ${"\\"}
40 % endfor
41 % for lib in libs:
42 % if lib.name in php_config_m4.get('deps', []):
43 % for source in lib.src:
44 ${source} ${"\\"}
45 % endfor
46 % endif
47 % endfor
Stanley Cheung94d75882017-05-17 14:58:02 -070048 , $ext_shared, , -fvisibility=hidden ${"\\"}
49 -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN ${"\\"}
Stanley Cheung5adb71f2016-02-13 00:03:02 -080050 -D_HAS_EXCEPTIONS=0 -DNOMINMAX)
Stanley Cheung80db5be2016-02-24 21:35:56 -080051
52 PHP_ADD_BUILD_DIR($ext_builddir/src/php/ext/grpc)
53 <%
54 dirs = {}
55 for lib in libs:
56 if lib.name in php_config_m4.get('deps', []):
57 for source in lib.src:
58 dirs[source[:source.rfind('/')]] = 1
59 dirs = dirs.keys()
60 dirs.sort()
61 %>
62 % for dir in dirs:
63 PHP_ADD_BUILD_DIR($ext_builddir/${dir})
64 % endfor
Stanley Cheung5adb71f2016-02-13 00:03:02 -080065 fi