Stanley Cheung | 5adb71f | 2016-02-13 00:03:02 -0800 | [diff] [blame] | 1 | %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 Cheung | fe71d7f | 2017-01-12 11:13:23 -0800 | [diff] [blame] | 10 | 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 Cheung | 5ec52ae | 2017-04-14 15:07:28 -0700 | [diff] [blame] | 13 | PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/third_party/cares) |
| 14 | PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/third_party/cares/cares) |
Stanley Cheung | 5adb71f | 2016-02-13 00:03:02 -0800 | [diff] [blame] | 15 | |
Stanley Cheung | bf74d69 | 2016-02-23 22:39:25 -0800 | [diff] [blame] | 16 | LIBS="-lpthread $LIBS" |
| 17 | |
Stanley Cheung | 94d7588 | 2017-05-17 14:58:02 -0700 | [diff] [blame] | 18 | CFLAGS="-Wall -Werror -Wno-parentheses-equality -Wno-unused-value -std=c11" |
| 19 | CXXFLAGS="-std=c++11" |
Stanley Cheung | bf74d69 | 2016-02-23 22:39:25 -0800 | [diff] [blame] | 20 | GRPC_SHARED_LIBADD="-lpthread $GRPC_SHARED_LIBADD" |
Stanley Cheung | 94d7588 | 2017-05-17 14:58:02 -0700 | [diff] [blame] | 21 | PHP_REQUIRE_CXX() |
Stanley Cheung | 5adb71f | 2016-02-13 00:03:02 -0800 | [diff] [blame] | 22 | PHP_ADD_LIBRARY(pthread) |
Stanley Cheung | bf74d69 | 2016-02-23 22:39:25 -0800 | [diff] [blame] | 23 | PHP_ADD_LIBRARY(dl,,GRPC_SHARED_LIBADD) |
| 24 | PHP_ADD_LIBRARY(dl) |
| 25 | |
| 26 | case $host in |
Stanley Cheung | 5ec52ae | 2017-04-14 15:07:28 -0700 | [diff] [blame] | 27 | *darwin*) |
| 28 | PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/third_party/cares/config_darwin) |
| 29 | ;; |
Stanley Cheung | bf74d69 | 2016-02-23 22:39:25 -0800 | [diff] [blame] | 30 | *) |
Stanley Cheung | 5ec52ae | 2017-04-14 15:07:28 -0700 | [diff] [blame] | 31 | PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/third_party/cares/config_linux) |
Stanley Cheung | bf74d69 | 2016-02-23 22:39:25 -0800 | [diff] [blame] | 32 | PHP_ADD_LIBRARY(rt,,GRPC_SHARED_LIBADD) |
| 33 | PHP_ADD_LIBRARY(rt) |
| 34 | ;; |
| 35 | esac |
| 36 | |
Stanley Cheung | 5adb71f | 2016-02-13 00:03:02 -0800 | [diff] [blame] | 37 | 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 Cheung | 94d7588 | 2017-05-17 14:58:02 -0700 | [diff] [blame] | 48 | , $ext_shared, , -fvisibility=hidden ${"\\"} |
| 49 | -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN ${"\\"} |
Stanley Cheung | 5adb71f | 2016-02-13 00:03:02 -0800 | [diff] [blame] | 50 | -D_HAS_EXCEPTIONS=0 -DNOMINMAX) |
Stanley Cheung | 80db5be | 2016-02-24 21:35:56 -0800 | [diff] [blame] | 51 | |
| 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 Cheung | 5adb71f | 2016-02-13 00:03:02 -0800 | [diff] [blame] | 65 | fi |