blob: cd93fbd0fbea67c196fbf987043608d09e009b87 [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 Cheung5adb71f2016-02-13 00:03:02 -080013
Stanley Cheungbf74d692016-02-23 22:39:25 -080014 LIBS="-lpthread $LIBS"
15
Stanley Cheung94d75882017-05-17 14:58:02 -070016 CFLAGS="-Wall -Werror -Wno-parentheses-equality -Wno-unused-value -std=c11"
Stanley Cheung1ebe1e82017-08-30 14:52:57 -070017 CXXFLAGS="-std=c++11 -fno-exceptions -fno-rtti"
Stanley Cheungbf74d692016-02-23 22:39:25 -080018 GRPC_SHARED_LIBADD="-lpthread $GRPC_SHARED_LIBADD"
Stanley Cheung94d75882017-05-17 14:58:02 -070019 PHP_REQUIRE_CXX()
Stanley Cheung5adb71f2016-02-13 00:03:02 -080020 PHP_ADD_LIBRARY(pthread)
Stanley Cheungbf74d692016-02-23 22:39:25 -080021 PHP_ADD_LIBRARY(dl,,GRPC_SHARED_LIBADD)
22 PHP_ADD_LIBRARY(dl)
23
24 case $host in
Stanley Cheung5ec52ae2017-04-14 15:07:28 -070025 *darwin*)
Stanley Cheung5ec52ae2017-04-14 15:07:28 -070026 ;;
Stanley Cheungbf74d692016-02-23 22:39:25 -080027 *)
28 PHP_ADD_LIBRARY(rt,,GRPC_SHARED_LIBADD)
29 PHP_ADD_LIBRARY(rt)
30 ;;
31 esac
32
Stanley Cheung5adb71f2016-02-13 00:03:02 -080033 PHP_NEW_EXTENSION(grpc,
34 % for source in php_config_m4.src:
35 ${source} ${"\\"}
36 % endfor
37 % for lib in libs:
Stanley Cheungaf525b32017-05-19 20:00:06 -070038 % if lib.name in php_config_m4.get('deps', []) and lib.name != 'z':
Stanley Cheung5adb71f2016-02-13 00:03:02 -080039 % for source in lib.src:
40 ${source} ${"\\"}
41 % endfor
42 % endif
43 % endfor
Stanley Cheung94d75882017-05-17 14:58:02 -070044 , $ext_shared, , -fvisibility=hidden ${"\\"}
45 -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN ${"\\"}
Stanley Cheung19792102017-05-02 11:24:03 -070046 -D_HAS_EXCEPTIONS=0 -DNOMINMAX -DGRPC_ARES=0)
Stanley Cheung80db5be2016-02-24 21:35:56 -080047
48 PHP_ADD_BUILD_DIR($ext_builddir/src/php/ext/grpc)
49 <%
50 dirs = {}
51 for lib in libs:
Stanley Cheungaf525b32017-05-19 20:00:06 -070052 if lib.name in php_config_m4.get('deps', []) and lib.name != 'z':
Stanley Cheung80db5be2016-02-24 21:35:56 -080053 for source in lib.src:
54 dirs[source[:source.rfind('/')]] = 1
55 dirs = dirs.keys()
56 dirs.sort()
57 %>
58 % for dir in dirs:
59 PHP_ADD_BUILD_DIR($ext_builddir/${dir})
60 % endfor
Stanley Cheung5adb71f2016-02-13 00:03:02 -080061 fi