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 | |
Craig Tiller | 6169d5f | 2016-03-31 07:46:18 -0700 | [diff] [blame] | 10 | # Copyright 2015, Google Inc. |
murgatroid99 | 2d6d330 | 2015-09-21 13:29:40 -0700 | [diff] [blame] | 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 | dc23046 | 2016-10-25 14:12:42 -0700 | [diff] [blame] | 42 | 'variables': { |
murgatroid99 | 1191b72 | 2017-02-08 11:56:52 -0800 | [diff] [blame] | 43 | 'runtime%': 'node', |
| 44 | # UV integration in C core is disabled by default while bugs are ironed |
| 45 | # out. It can be re-enabled for one build by setting the npm config |
| 46 | # variable grpc_uv to true, and it can be re-enabled permanently by |
| 47 | # setting it to true here. |
| 48 | 'grpc_uv%': 'false' |
murgatroid99 | dc23046 | 2016-10-25 14:12:42 -0700 | [diff] [blame] | 49 | }, |
murgatroid99 | 2d6d330 | 2015-09-21 13:29:40 -0700 | [diff] [blame] | 50 | 'target_defaults': { |
murgatroid99 | 2d6d330 | 2015-09-21 13:29:40 -0700 | [diff] [blame] | 51 | 'include_dirs': [ |
murgatroid99 | ca9db40 | 2015-09-21 14:39:09 -0700 | [diff] [blame] | 52 | '.', |
murgatroid99 | 5c56c92 | 2016-01-25 13:32:52 -0800 | [diff] [blame] | 53 | 'include' |
murgatroid99 | a89d9e7 | 2015-10-13 16:03:16 -0700 | [diff] [blame] | 54 | ], |
murgatroid99 | dc23046 | 2016-10-25 14:12:42 -0700 | [diff] [blame] | 55 | 'defines': [ |
murgatroid99 | cb4b2b5 | 2016-10-27 11:30:50 -0700 | [diff] [blame] | 56 | 'GPR_BACKWARDS_COMPATIBILITY_MODE' |
murgatroid99 | dc23046 | 2016-10-25 14:12:42 -0700 | [diff] [blame] | 57 | ], |
murgatroid99 | a89d9e7 | 2015-10-13 16:03:16 -0700 | [diff] [blame] | 58 | 'conditions': [ |
murgatroid99 | 8c2946a | 2017-02-27 10:19:21 -0800 | [diff] [blame] | 59 | ['grpc_uv=="true"', { |
murgatroid99 | cb4b2b5 | 2016-10-27 11:30:50 -0700 | [diff] [blame] | 60 | 'defines': [ |
murgatroid99 | 1191b72 | 2017-02-08 11:56:52 -0800 | [diff] [blame] | 61 | 'GRPC_UV' |
murgatroid99 | cb4b2b5 | 2016-10-27 11:30:50 -0700 | [diff] [blame] | 62 | ] |
| 63 | }], |
murgatroid99 | e8ec16d | 2017-01-13 11:00:53 -0800 | [diff] [blame] | 64 | ['OS!="win" and runtime=="electron"', { |
Michael Lumish | 88162f8 | 2017-01-12 17:37:58 -0800 | [diff] [blame] | 65 | "defines": [ |
| 66 | 'OPENSSL_NO_THREADS' |
| 67 | ] |
| 68 | }], |
murgatroid99 | dc23046 | 2016-10-25 14:12:42 -0700 | [diff] [blame] | 69 | # This is the condition for using boringssl |
| 70 | ['OS=="win" or runtime=="electron"', { |
| 71 | "include_dirs": [ |
| 72 | "third_party/boringssl/include" |
| 73 | ], |
| 74 | "defines": [ |
Michael Lumish | 88162f8 | 2017-01-12 17:37:58 -0800 | [diff] [blame] | 75 | 'OPENSSL_NO_ASM' |
murgatroid99 | dc23046 | 2016-10-25 14:12:42 -0700 | [diff] [blame] | 76 | ] |
| 77 | }, { |
murgatroid99 | 1191b72 | 2017-02-08 11:56:52 -0800 | [diff] [blame] | 78 | # As of the beginning of 2017, we only support versions of Node with |
| 79 | # embedded versions of OpenSSL that support ALPN |
murgatroid99 | dc23046 | 2016-10-25 14:12:42 -0700 | [diff] [blame] | 80 | 'defines': [ |
murgatroid99 | 1191b72 | 2017-02-08 11:56:52 -0800 | [diff] [blame] | 81 | 'TSI_OPENSSL_ALPN_SUPPORT=1' |
murgatroid99 | dc23046 | 2016-10-25 14:12:42 -0700 | [diff] [blame] | 82 | ], |
| 83 | 'include_dirs': [ |
| 84 | '<(node_root_dir)/deps/openssl/openssl/include', |
| 85 | ], |
| 86 | 'conditions': [ |
| 87 | ["target_arch=='ia32'", { |
| 88 | "include_dirs": [ "<(node_root_dir)/deps/openssl/config/piii" ] |
| 89 | }], |
| 90 | ["target_arch=='x64'", { |
| 91 | "include_dirs": [ "<(node_root_dir)/deps/openssl/config/k8" ] |
| 92 | }], |
| 93 | ["target_arch=='arm'", { |
| 94 | "include_dirs": [ "<(node_root_dir)/deps/openssl/config/arm" ] |
| 95 | }] |
| 96 | ] |
| 97 | }], |
murgatroid99 | 5c56c92 | 2016-01-25 13:32:52 -0800 | [diff] [blame] | 98 | ['OS == "win"', { |
murgatroid99 | 673f65b | 2016-02-01 11:19:07 -0800 | [diff] [blame] | 99 | "include_dirs": [ |
murgatroid99 | 673f65b | 2016-02-01 11:19:07 -0800 | [diff] [blame] | 100 | "third_party/zlib" |
| 101 | ], |
murgatroid99 | af6c178 | 2016-01-28 13:14:24 -0800 | [diff] [blame] | 102 | "defines": [ |
| 103 | '_WIN32_WINNT=0x0600', |
| 104 | 'WIN32_LEAN_AND_MEAN', |
| 105 | '_HAS_EXCEPTIONS=0', |
| 106 | 'UNICODE', |
| 107 | '_UNICODE', |
| 108 | 'NOMINMAX', |
murgatroid99 | af6c178 | 2016-01-28 13:14:24 -0800 | [diff] [blame] | 109 | ], |
| 110 | "msvs_settings": { |
| 111 | 'VCCLCompilerTool': { |
| 112 | 'RuntimeLibrary': 1, # static debug |
| 113 | } |
| 114 | }, |
| 115 | "libraries": [ |
| 116 | "ws2_32" |
| 117 | ] |
| 118 | }, { # OS != "win" |
murgatroid99 | 673f65b | 2016-02-01 11:19:07 -0800 | [diff] [blame] | 119 | 'variables': { |
| 120 | 'config': '<!(echo $CONFIG)', |
murgatroid99 | 673f65b | 2016-02-01 11:19:07 -0800 | [diff] [blame] | 121 | }, |
murgatroid99 | 5c56c92 | 2016-01-25 13:32:52 -0800 | [diff] [blame] | 122 | 'include_dirs': [ |
murgatroid99 | 5c56c92 | 2016-01-25 13:32:52 -0800 | [diff] [blame] | 123 | '<(node_root_dir)/deps/zlib' |
| 124 | ], |
murgatroid99 | a89d9e7 | 2015-10-13 16:03:16 -0700 | [diff] [blame] | 125 | 'conditions': [ |
| 126 | ['config=="gcov"', { |
| 127 | 'cflags': [ |
| 128 | '-ftest-coverage', |
| 129 | '-fprofile-arcs', |
| 130 | '-O0' |
| 131 | ], |
| 132 | 'ldflags': [ |
| 133 | '-ftest-coverage', |
| 134 | '-fprofile-arcs' |
| 135 | ] |
| 136 | } |
murgatroid99 | dc23046 | 2016-10-25 14:12:42 -0700 | [diff] [blame] | 137 | ] |
murgatroid99 | a89d9e7 | 2015-10-13 16:03:16 -0700 | [diff] [blame] | 138 | ] |
murgatroid99 | afe4698 | 2015-10-23 10:17:26 -0700 | [diff] [blame] | 139 | }] |
murgatroid99 | fd994f1 | 2015-10-09 14:02:28 -0700 | [diff] [blame] | 140 | ] |
murgatroid99 | 2d6d330 | 2015-09-21 13:29:40 -0700 | [diff] [blame] | 141 | }, |
murgatroid99 | 5c56c92 | 2016-01-25 13:32:52 -0800 | [diff] [blame] | 142 | 'conditions': [ |
murgatroid99 | dc23046 | 2016-10-25 14:12:42 -0700 | [diff] [blame] | 143 | ['OS=="win" or runtime=="electron"', { |
| 144 | 'targets': [ |
| 145 | % for module in node_modules: |
| 146 | % for lib in libs: |
| 147 | % if lib.name in module.transitive_deps and lib.name == 'boringssl': |
| 148 | { |
| 149 | 'cflags': [ |
| 150 | '-std=c99', |
| 151 | '-Wall', |
| 152 | '-Werror' |
| 153 | ], |
| 154 | 'target_name': '${lib.name}', |
| 155 | 'product_prefix': 'lib', |
| 156 | 'type': 'static_library', |
| 157 | 'dependencies': [ |
| 158 | % for dep in getattr(lib, 'deps', []): |
| 159 | '${dep}', |
| 160 | % endfor |
| 161 | ], |
| 162 | 'sources': [ |
| 163 | % for source in lib.src: |
| 164 | '${source}', |
| 165 | % endfor |
| 166 | ] |
| 167 | }, |
| 168 | % endif |
| 169 | % endfor |
| 170 | % endfor |
| 171 | ] |
| 172 | }], |
murgatroid99 | 5c56c92 | 2016-01-25 13:32:52 -0800 | [diff] [blame] | 173 | ['OS == "win"', { |
| 174 | 'targets': [ |
murgatroid99 | af6c178 | 2016-01-28 13:14:24 -0800 | [diff] [blame] | 175 | { |
| 176 | # IMPORTANT WINDOWS BUILD INFORMATION |
| 177 | # This library does not build on Windows without modifying the Node |
| 178 | # development packages that node-gyp downloads in order to build. |
| 179 | # Due to https://github.com/nodejs/node/issues/4932, the headers for |
| 180 | # BoringSSL conflict with the OpenSSL headers included by default |
| 181 | # when including the Node headers. The remedy for this is to remove |
| 182 | # the OpenSSL headers, from the downloaded Node development package, |
| 183 | # which is typically located in `.node-gyp` in your home directory. |
murgatroid99 | 8e4103e | 2016-01-28 14:53:33 -0800 | [diff] [blame] | 184 | 'target_name': 'WINDOWS_BUILD_WARNING', |
murgatroid99 | af6c178 | 2016-01-28 13:14:24 -0800 | [diff] [blame] | 185 | 'actions': [ |
| 186 | { |
murgatroid99 | 8e4103e | 2016-01-28 14:53:33 -0800 | [diff] [blame] | 187 | 'action_name': 'WINDOWS_BUILD_WARNING', |
| 188 | 'inputs': [ |
| 189 | 'package.json' |
| 190 | ], |
| 191 | 'outputs': [ |
| 192 | 'ignore_this_part' |
| 193 | ], |
| 194 | 'action': ['echo', 'IMPORTANT: Due to https://github.com/nodejs/node/issues/4932, to build this library on Windows, you must first remove <(node_root_dir)/include/node/openssl/'] |
murgatroid99 | af6c178 | 2016-01-28 13:14:24 -0800 | [diff] [blame] | 195 | } |
| 196 | ] |
| 197 | }, |
murgatroid99 | dc23046 | 2016-10-25 14:12:42 -0700 | [diff] [blame] | 198 | # Only want to compile zlib under Windows |
murgatroid99 | 5c56c92 | 2016-01-25 13:32:52 -0800 | [diff] [blame] | 199 | % for module in node_modules: |
| 200 | % for lib in libs: |
murgatroid99 | dc23046 | 2016-10-25 14:12:42 -0700 | [diff] [blame] | 201 | % if lib.name in module.transitive_deps and lib.name == 'z': |
murgatroid99 | 5c56c92 | 2016-01-25 13:32:52 -0800 | [diff] [blame] | 202 | { |
| 203 | 'cflags': [ |
| 204 | '-std=c99', |
| 205 | '-Wall', |
| 206 | '-Werror' |
| 207 | ], |
| 208 | 'target_name': '${lib.name}', |
| 209 | 'product_prefix': 'lib', |
| 210 | 'type': 'static_library', |
| 211 | 'dependencies': [ |
| 212 | % for dep in getattr(lib, 'deps', []): |
| 213 | '${dep}', |
| 214 | % endfor |
| 215 | ], |
| 216 | 'sources': [ |
| 217 | % for source in lib.src: |
| 218 | '${source}', |
| 219 | % endfor |
murgatroid99 | af6c178 | 2016-01-28 13:14:24 -0800 | [diff] [blame] | 220 | ] |
murgatroid99 | 5c56c92 | 2016-01-25 13:32:52 -0800 | [diff] [blame] | 221 | }, |
| 222 | % endif |
| 223 | % endfor |
| 224 | % endfor |
| 225 | ] |
| 226 | }] |
| 227 | ], |
murgatroid99 | 2d6d330 | 2015-09-21 13:29:40 -0700 | [diff] [blame] | 228 | 'targets': [ |
murgatroid99 | 879bc4f | 2015-11-05 10:35:04 -0800 | [diff] [blame] | 229 | % for module in node_modules: |
murgatroid99 | 2d6d330 | 2015-09-21 13:29:40 -0700 | [diff] [blame] | 230 | % for lib in libs: |
murgatroid99 | 5c56c92 | 2016-01-25 13:32:52 -0800 | [diff] [blame] | 231 | % if lib.name in module.transitive_deps and lib.name not in ('boringssl', 'z'): |
murgatroid99 | 2d6d330 | 2015-09-21 13:29:40 -0700 | [diff] [blame] | 232 | { |
murgatroid99 | 3abed31 | 2016-01-07 17:16:46 -0800 | [diff] [blame] | 233 | 'cflags': [ |
| 234 | '-std=c99', |
| 235 | '-Wall', |
| 236 | '-Werror' |
| 237 | ], |
murgatroid99 | 2d6d330 | 2015-09-21 13:29:40 -0700 | [diff] [blame] | 238 | 'target_name': '${lib.name}', |
| 239 | 'product_prefix': 'lib', |
| 240 | 'type': 'static_library', |
| 241 | 'dependencies': [ |
| 242 | % for dep in getattr(lib, 'deps', []): |
| 243 | '${dep}', |
| 244 | % endfor |
| 245 | ], |
| 246 | 'sources': [ |
| 247 | % for source in lib.src: |
murgatroid99 | ca9db40 | 2015-09-21 14:39:09 -0700 | [diff] [blame] | 248 | '${source}', |
murgatroid99 | 2d6d330 | 2015-09-21 13:29:40 -0700 | [diff] [blame] | 249 | % endfor |
murgatroid99 | ca9db40 | 2015-09-21 14:39:09 -0700 | [diff] [blame] | 250 | ], |
murgatroid99 | 6ffdb94 | 2015-10-22 16:10:05 -0700 | [diff] [blame] | 251 | "conditions": [ |
| 252 | ['OS == "mac"', { |
| 253 | 'xcode_settings': { |
murgatroid99 | 22c448b | 2015-10-23 10:25:30 -0700 | [diff] [blame] | 254 | 'MACOSX_DEPLOYMENT_TARGET': '10.9' |
murgatroid99 | 6ffdb94 | 2015-10-22 16:10:05 -0700 | [diff] [blame] | 255 | } |
| 256 | }] |
murgatroid99 | 5c56c92 | 2016-01-25 13:32:52 -0800 | [diff] [blame] | 257 | ] |
murgatroid99 | 2d6d330 | 2015-09-21 13:29:40 -0700 | [diff] [blame] | 258 | }, |
murgatroid99 | ca9db40 | 2015-09-21 14:39:09 -0700 | [diff] [blame] | 259 | % endif |
murgatroid99 | 2d6d330 | 2015-09-21 13:29:40 -0700 | [diff] [blame] | 260 | % endfor |
murgatroid99 | fd994f1 | 2015-10-09 14:02:28 -0700 | [diff] [blame] | 261 | { |
| 262 | 'include_dirs': [ |
| 263 | "<!(node -e \"require('nan')\")" |
| 264 | ], |
| 265 | 'cflags': [ |
murgatroid99 | 3abed31 | 2016-01-07 17:16:46 -0800 | [diff] [blame] | 266 | '-std=c++11', |
murgatroid99 | fd994f1 | 2015-10-09 14:02:28 -0700 | [diff] [blame] | 267 | '-Wall', |
| 268 | '-pthread', |
| 269 | '-g', |
| 270 | '-zdefs', |
| 271 | '-Werror', |
| 272 | '-Wno-error=deprecated-declarations' |
| 273 | ], |
| 274 | 'ldflags': [ |
| 275 | '-g' |
| 276 | ], |
| 277 | "conditions": [ |
murgatroid99 | dc23046 | 2016-10-25 14:12:42 -0700 | [diff] [blame] | 278 | ['OS=="win" or runtime=="electron"', { |
| 279 | 'dependencies': [ |
| 280 | % for dep in getattr(module, 'deps', []): |
| 281 | % if dep == 'boringssl': |
| 282 | "${dep}", |
| 283 | % endif |
| 284 | % endfor |
| 285 | ] |
| 286 | }], |
murgatroid99 | 5c56c92 | 2016-01-25 13:32:52 -0800 | [diff] [blame] | 287 | ['OS=="mac"', { |
murgatroid99 | fd994f1 | 2015-10-09 14:02:28 -0700 | [diff] [blame] | 288 | 'xcode_settings': { |
| 289 | 'MACOSX_DEPLOYMENT_TARGET': '10.9', |
| 290 | 'OTHER_CFLAGS': [ |
murgatroid99 | 673f65b | 2016-02-01 11:19:07 -0800 | [diff] [blame] | 291 | '-stdlib=libc++', |
| 292 | '-std=c++11' |
murgatroid99 | fd994f1 | 2015-10-09 14:02:28 -0700 | [diff] [blame] | 293 | ] |
| 294 | } |
murgatroid99 | 5c56c92 | 2016-01-25 13:32:52 -0800 | [diff] [blame] | 295 | }], |
| 296 | ['OS=="win"', { |
| 297 | 'dependencies': [ |
| 298 | % for dep in getattr(module, 'deps', []): |
murgatroid99 | dc23046 | 2016-10-25 14:12:42 -0700 | [diff] [blame] | 299 | % if dep == 'z': |
murgatroid99 | 5c56c92 | 2016-01-25 13:32:52 -0800 | [diff] [blame] | 300 | "${dep}", |
| 301 | % endif |
| 302 | % endfor |
| 303 | ] |
Craig Tiller | 4bef7ce | 2016-02-02 08:38:43 -0800 | [diff] [blame] | 304 | }], |
| 305 | ['OS=="linux"', { |
| 306 | 'ldflags': [ |
| 307 | '-Wl,-wrap,memcpy' |
| 308 | ] |
murgatroid99 | fd994f1 | 2015-10-09 14:02:28 -0700 | [diff] [blame] | 309 | }] |
| 310 | ], |
murgatroid99 | 879bc4f | 2015-11-05 10:35:04 -0800 | [diff] [blame] | 311 | "target_name": "${module.name}", |
murgatroid99 | fd994f1 | 2015-10-09 14:02:28 -0700 | [diff] [blame] | 312 | "sources": [ |
murgatroid99 | 879bc4f | 2015-11-05 10:35:04 -0800 | [diff] [blame] | 313 | % for source in module.src: |
| 314 | "${source}", |
| 315 | % endfor |
murgatroid99 | fd994f1 | 2015-10-09 14:02:28 -0700 | [diff] [blame] | 316 | ], |
| 317 | "dependencies": [ |
murgatroid99 | 879bc4f | 2015-11-05 10:35:04 -0800 | [diff] [blame] | 318 | % for dep in getattr(module, 'deps', []): |
murgatroid99 | 5c56c92 | 2016-01-25 13:32:52 -0800 | [diff] [blame] | 319 | % if dep not in ('boringssl', 'z'): |
murgatroid99 | 879bc4f | 2015-11-05 10:35:04 -0800 | [diff] [blame] | 320 | "${dep}", |
murgatroid99 | 5c56c92 | 2016-01-25 13:32:52 -0800 | [diff] [blame] | 321 | % endif |
murgatroid99 | 879bc4f | 2015-11-05 10:35:04 -0800 | [diff] [blame] | 322 | % endfor |
murgatroid99 | fd994f1 | 2015-10-09 14:02:28 -0700 | [diff] [blame] | 323 | ] |
murgatroid99 | 879bc4f | 2015-11-05 10:35:04 -0800 | [diff] [blame] | 324 | }, |
| 325 | % endfor |
murgatroid99 | e190f35 | 2016-01-20 13:52:08 -0800 | [diff] [blame] | 326 | { |
| 327 | "target_name": "action_after_build", |
| 328 | "type": "none", |
| 329 | "dependencies": [ "<(module_name)" ], |
| 330 | "copies": [ |
| 331 | { |
| 332 | "files": [ "<(PRODUCT_DIR)/<(module_name).node"], |
| 333 | "destination": "<(module_path)" |
| 334 | } |
| 335 | ] |
| 336 | } |
murgatroid99 | 2d6d330 | 2015-09-21 13:29:40 -0700 | [diff] [blame] | 337 | ] |
| 338 | } |