murgatroid99 | 2d6d330 | 2015-09-21 13:29:40 -0700 | [diff] [blame] | 1 | %YAML 1.2 |
| 2 | --- | |
murgatroid99 | fd994f1 | 2015-10-09 14:02:28 -0700 | [diff] [blame] | 3 | # GRPC Node gyp file |
| 4 | # This currently builds the Node extension and dependencies |
murgatroid99 | 2d6d330 | 2015-09-21 13:29:40 -0700 | [diff] [blame] | 5 | # This file has been automatically generated from a template file. |
| 6 | # Please look at the templates directory instead. |
| 7 | # This file can be regenerated from the template by running |
| 8 | # tools/buildgen/generate_projects.sh |
| 9 | |
| 10 | # Copyright 2015, Google Inc. |
| 11 | # All rights reserved. |
| 12 | # |
| 13 | # Redistribution and use in source and binary forms, with or without |
| 14 | # modification, are permitted provided that the following conditions are |
| 15 | # met: |
| 16 | # |
| 17 | # * Redistributions of source code must retain the above copyright |
| 18 | # notice, this list of conditions and the following disclaimer. |
| 19 | # * Redistributions in binary form must reproduce the above |
| 20 | # copyright notice, this list of conditions and the following disclaimer |
| 21 | # in the documentation and/or other materials provided with the |
| 22 | # distribution. |
| 23 | # * Neither the name of Google Inc. nor the names of its |
| 24 | # contributors may be used to endorse or promote products derived from |
| 25 | # this software without specific prior written permission. |
| 26 | # |
| 27 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 28 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 29 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 30 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 31 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 32 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 33 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 34 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 35 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 36 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 37 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 38 | |
| 39 | # Some of this file is built with the help of |
| 40 | # https://n8.io/converting-a-c-library-to-gyp/ |
| 41 | { |
murgatroid99 | fd994f1 | 2015-10-09 14:02:28 -0700 | [diff] [blame] | 42 | 'variables': { |
| 43 | 'config': '<!(echo $CONFIG)' |
| 44 | }, |
murgatroid99 | 38745ef | 2015-09-21 16:39:37 -0700 | [diff] [blame] | 45 | # TODO: Finish windows support |
murgatroid99 | 2d6d330 | 2015-09-21 13:29:40 -0700 | [diff] [blame] | 46 | 'target_defaults': { |
murgatroid99 | e754079 | 2015-10-09 15:43:14 -0700 | [diff] [blame] | 47 | # Empirically, Node only exports ALPN symbols if its major version is >0. |
murgatroid99 | fd994f1 | 2015-10-09 14:02:28 -0700 | [diff] [blame] | 48 | # io.js always reports versions >0 and always exports ALPN symbols. |
murgatroid99 | 15def98 | 2015-10-09 14:11:02 -0700 | [diff] [blame] | 49 | # Therefore, Node's major version will be truthy if and only if it |
| 50 | # supports ALPN. The output of "node -v" is v[major].[minor].[patch], |
murgatroid99 | c07c734 | 2015-10-19 17:41:03 -0700 | [diff] [blame] | 51 | # like "v4.1.1" in a recent version. We use cut to split by period and |
| 52 | # take the first field (resulting in "v[major]"), then use cut again |
| 53 | # to take all but the first character, removing the "v". |
murgatroid99 | ca9db40 | 2015-09-21 14:39:09 -0700 | [diff] [blame] | 54 | 'defines': [ |
murgatroid99 | c07c734 | 2015-10-19 17:41:03 -0700 | [diff] [blame] | 55 | 'TSI_OPENSSL_ALPN_SUPPORT=<!(node --version | cut -d. -f1 | cut -c2-)' |
murgatroid99 | ca9db40 | 2015-09-21 14:39:09 -0700 | [diff] [blame] | 56 | ], |
murgatroid99 | 2d6d330 | 2015-09-21 13:29:40 -0700 | [diff] [blame] | 57 | 'include_dirs': [ |
murgatroid99 | ca9db40 | 2015-09-21 14:39:09 -0700 | [diff] [blame] | 58 | '.', |
murgatroid99 | afe4698 | 2015-10-23 10:17:26 -0700 | [diff] [blame^] | 59 | 'include', |
| 60 | '<(node_root_dir)/deps/openssl/openssl/include' |
murgatroid99 | a89d9e7 | 2015-10-13 16:03:16 -0700 | [diff] [blame] | 61 | ], |
| 62 | 'conditions': [ |
| 63 | ['OS != "win"', { |
| 64 | 'conditions': [ |
| 65 | ['config=="gcov"', { |
| 66 | 'cflags': [ |
| 67 | '-ftest-coverage', |
| 68 | '-fprofile-arcs', |
| 69 | '-O0' |
| 70 | ], |
| 71 | 'ldflags': [ |
| 72 | '-ftest-coverage', |
| 73 | '-fprofile-arcs' |
| 74 | ] |
| 75 | } |
| 76 | ] |
| 77 | ] |
| 78 | }], |
murgatroid99 | afe4698 | 2015-10-23 10:17:26 -0700 | [diff] [blame^] | 79 | ["target_arch=='ia32'", { |
| 80 | "include_dirs": [ "<(node_root_dir)/deps/openssl/config/piii" ] |
| 81 | }], |
| 82 | ["target_arch=='x64'", { |
| 83 | "include_dirs": [ "<(node_root_dir)/deps/openssl/config/k8" ] |
| 84 | }], |
| 85 | ["target_arch=='arm'", { |
| 86 | "include_dirs": [ "<(node_root_dir)/deps/openssl/config/arm" ] |
| 87 | }] |
murgatroid99 | fd994f1 | 2015-10-09 14:02:28 -0700 | [diff] [blame] | 88 | ] |
murgatroid99 | 2d6d330 | 2015-09-21 13:29:40 -0700 | [diff] [blame] | 89 | }, |
| 90 | 'targets': [ |
| 91 | % for lib in libs: |
murgatroid99 | db5b160 | 2015-10-01 13:20:11 -0700 | [diff] [blame] | 92 | % if lib.name == 'gpr' or lib.name == 'grpc': |
murgatroid99 | 2d6d330 | 2015-09-21 13:29:40 -0700 | [diff] [blame] | 93 | { |
| 94 | 'target_name': '${lib.name}', |
| 95 | 'product_prefix': 'lib', |
| 96 | 'type': 'static_library', |
| 97 | 'dependencies': [ |
| 98 | % for dep in getattr(lib, 'deps', []): |
| 99 | '${dep}', |
| 100 | % endfor |
| 101 | ], |
| 102 | 'sources': [ |
| 103 | % for source in lib.src: |
murgatroid99 | ca9db40 | 2015-09-21 14:39:09 -0700 | [diff] [blame] | 104 | '${source}', |
murgatroid99 | 2d6d330 | 2015-09-21 13:29:40 -0700 | [diff] [blame] | 105 | % endfor |
murgatroid99 | ca9db40 | 2015-09-21 14:39:09 -0700 | [diff] [blame] | 106 | ], |
murgatroid99 | 6ffdb94 | 2015-10-22 16:10:05 -0700 | [diff] [blame] | 107 | "conditions": [ |
| 108 | ['OS == "mac"', { |
| 109 | 'xcode_settings': { |
| 110 | 'MACOSX_DEPLOYMENT_TARGET': '10.9', |
| 111 | 'OTHER_CFLAGS': [ |
| 112 | '-stdlib=libc++' |
| 113 | ] |
| 114 | } |
| 115 | }] |
| 116 | ], |
murgatroid99 | 2d6d330 | 2015-09-21 13:29:40 -0700 | [diff] [blame] | 117 | }, |
murgatroid99 | ca9db40 | 2015-09-21 14:39:09 -0700 | [diff] [blame] | 118 | % endif |
murgatroid99 | 2d6d330 | 2015-09-21 13:29:40 -0700 | [diff] [blame] | 119 | % endfor |
murgatroid99 | fd994f1 | 2015-10-09 14:02:28 -0700 | [diff] [blame] | 120 | { |
| 121 | 'include_dirs': [ |
| 122 | "<!(node -e \"require('nan')\")" |
| 123 | ], |
| 124 | 'cflags': [ |
| 125 | '-std=c++0x', |
| 126 | '-Wall', |
| 127 | '-pthread', |
| 128 | '-g', |
| 129 | '-zdefs', |
| 130 | '-Werror', |
| 131 | '-Wno-error=deprecated-declarations' |
| 132 | ], |
| 133 | 'ldflags': [ |
| 134 | '-g' |
| 135 | ], |
| 136 | "conditions": [ |
murgatroid99 | fd994f1 | 2015-10-09 14:02:28 -0700 | [diff] [blame] | 137 | ['OS == "mac"', { |
| 138 | 'xcode_settings': { |
| 139 | 'MACOSX_DEPLOYMENT_TARGET': '10.9', |
| 140 | 'OTHER_CFLAGS': [ |
| 141 | '-std=c++11', |
| 142 | '-stdlib=libc++' |
| 143 | ] |
| 144 | } |
| 145 | }] |
| 146 | ], |
| 147 | "target_name": "grpc_node", |
| 148 | "sources": [ |
| 149 | "src/node/ext/byte_buffer.cc", |
| 150 | "src/node/ext/call.cc", |
| 151 | "src/node/ext/call_credentials.cc", |
| 152 | "src/node/ext/channel.cc", |
| 153 | "src/node/ext/channel_credentials.cc", |
| 154 | "src/node/ext/completion_queue_async_worker.cc", |
| 155 | "src/node/ext/node_grpc.cc", |
| 156 | "src/node/ext/server.cc", |
| 157 | "src/node/ext/server_credentials.cc", |
| 158 | "src/node/ext/timeval.cc" |
| 159 | ], |
| 160 | "dependencies": [ |
| 161 | "grpc" |
| 162 | ] |
| 163 | } |
murgatroid99 | 2d6d330 | 2015-09-21 13:29:40 -0700 | [diff] [blame] | 164 | ] |
| 165 | } |