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 |
| 10 | PHP_ADD_INCLUDE(../../grpc/include) |
| 11 | PHP_ADD_INCLUDE(../../grpc/src/php/ext/grpc) |
| 12 | PHP_ADD_INCLUDE(../../grpc/third_party/boringssl/include) |
| 13 | |
Stanley Cheung | bf74d69 | 2016-02-23 22:39:25 -0800 | [diff] [blame] | 14 | LIBS="-lpthread $LIBS" |
| 15 | |
| 16 | GRPC_SHARED_LIBADD="-lpthread $GRPC_SHARED_LIBADD" |
Stanley Cheung | 5adb71f | 2016-02-13 00:03:02 -0800 | [diff] [blame] | 17 | PHP_ADD_LIBRARY(pthread) |
| 18 | |
Stanley Cheung | bf74d69 | 2016-02-23 22:39:25 -0800 | [diff] [blame] | 19 | PHP_ADD_LIBRARY(dl,,GRPC_SHARED_LIBADD) |
| 20 | PHP_ADD_LIBRARY(dl) |
| 21 | |
| 22 | case $host in |
| 23 | *darwin*) ;; |
| 24 | *) |
| 25 | PHP_ADD_LIBRARY(rt,,GRPC_SHARED_LIBADD) |
| 26 | PHP_ADD_LIBRARY(rt) |
| 27 | ;; |
| 28 | esac |
| 29 | |
Stanley Cheung | 5adb71f | 2016-02-13 00:03:02 -0800 | [diff] [blame] | 30 | PHP_NEW_EXTENSION(grpc, |
| 31 | % for source in php_config_m4.src: |
| 32 | ${source} ${"\\"} |
| 33 | % endfor |
| 34 | % for lib in libs: |
| 35 | % if lib.name in php_config_m4.get('deps', []): |
| 36 | % for source in lib.src: |
| 37 | ${source} ${"\\"} |
| 38 | % endfor |
| 39 | % endif |
| 40 | % endfor |
Stanley Cheung | 5ade2d4 | 2016-02-25 13:44:05 -0800 | [diff] [blame^] | 41 | , $ext_shared, , -Wall -Werror ${"\\"} |
| 42 | -Wno-parentheses-equality -Wno-unused-value -std=c11 ${"\\"} |
Stanley Cheung | 5adb71f | 2016-02-13 00:03:02 -0800 | [diff] [blame] | 43 | -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN ${"\\"} |
| 44 | -D_HAS_EXCEPTIONS=0 -DNOMINMAX) |
Stanley Cheung | 80db5be | 2016-02-24 21:35:56 -0800 | [diff] [blame] | 45 | |
| 46 | PHP_ADD_BUILD_DIR($ext_builddir/src/php/ext/grpc) |
| 47 | <% |
| 48 | dirs = {} |
| 49 | for lib in libs: |
| 50 | if lib.name in php_config_m4.get('deps', []): |
| 51 | for source in lib.src: |
| 52 | dirs[source[:source.rfind('/')]] = 1 |
| 53 | dirs = dirs.keys() |
| 54 | dirs.sort() |
| 55 | %> |
| 56 | % for dir in dirs: |
| 57 | PHP_ADD_BUILD_DIR($ext_builddir/${dir}) |
| 58 | % endfor |
Stanley Cheung | 5adb71f | 2016-02-13 00:03:02 -0800 | [diff] [blame] | 59 | fi |