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 | |
murgatroid99 | 7586db8 | 2016-01-20 14:02:42 -0800 | [diff] [blame] | 10 | # Copyright 2015-2016, 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 | { |
| 42 | 'target_defaults': { |
murgatroid99 | 2d6d330 | 2015-09-21 13:29:40 -0700 | [diff] [blame] | 43 | 'include_dirs': [ |
murgatroid99 | ca9db40 | 2015-09-21 14:39:09 -0700 | [diff] [blame] | 44 | '.', |
murgatroid99 | 5c56c92 | 2016-01-25 13:32:52 -0800 | [diff] [blame] | 45 | 'include' |
murgatroid99 | a89d9e7 | 2015-10-13 16:03:16 -0700 | [diff] [blame] | 46 | ], |
| 47 | 'conditions': [ |
murgatroid99 | 5c56c92 | 2016-01-25 13:32:52 -0800 | [diff] [blame] | 48 | ['OS == "win"', { |
murgatroid99 | 673f65b | 2016-02-01 11:19:07 -0800 | [diff] [blame] | 49 | "include_dirs": [ |
| 50 | "third_party/boringssl/include", |
| 51 | "third_party/zlib" |
| 52 | ], |
murgatroid99 | af6c178 | 2016-01-28 13:14:24 -0800 | [diff] [blame] | 53 | "defines": [ |
| 54 | '_WIN32_WINNT=0x0600', |
| 55 | 'WIN32_LEAN_AND_MEAN', |
| 56 | '_HAS_EXCEPTIONS=0', |
| 57 | 'UNICODE', |
| 58 | '_UNICODE', |
| 59 | 'NOMINMAX', |
| 60 | 'OPENSSL_NO_ASM' |
| 61 | ], |
| 62 | "msvs_settings": { |
| 63 | 'VCCLCompilerTool': { |
| 64 | 'RuntimeLibrary': 1, # static debug |
| 65 | } |
| 66 | }, |
| 67 | "libraries": [ |
| 68 | "ws2_32" |
| 69 | ] |
| 70 | }, { # OS != "win" |
murgatroid99 | 673f65b | 2016-02-01 11:19:07 -0800 | [diff] [blame] | 71 | 'variables': { |
| 72 | 'config': '<!(echo $CONFIG)', |
| 73 | # The output of "node --version" is "v[version]". We use cut to |
| 74 | # remove the first character. |
| 75 | 'target%': '<!(node --version | cut -c2-)' |
| 76 | }, |
murgatroid99 | af6c178 | 2016-01-28 13:14:24 -0800 | [diff] [blame] | 77 | # Empirically, Node only exports ALPN symbols if its major version is >0. |
| 78 | # io.js always reports versions >0 and always exports ALPN symbols. |
| 79 | # Therefore, Node's major version will be truthy if and only if it |
murgatroid99 | 673f65b | 2016-02-01 11:19:07 -0800 | [diff] [blame] | 80 | # supports ALPN. The target is "[major].[minor].[patch]". We split by |
| 81 | # periods and take the first field to get the major version. |
murgatroid99 | af6c178 | 2016-01-28 13:14:24 -0800 | [diff] [blame] | 82 | 'defines': [ |
murgatroid99 | 673f65b | 2016-02-01 11:19:07 -0800 | [diff] [blame] | 83 | 'TSI_OPENSSL_ALPN_SUPPORT=<!(echo <(target) | cut -d. -f1)' |
murgatroid99 | af6c178 | 2016-01-28 13:14:24 -0800 | [diff] [blame] | 84 | ], |
murgatroid99 | 5c56c92 | 2016-01-25 13:32:52 -0800 | [diff] [blame] | 85 | 'include_dirs': [ |
| 86 | '<(node_root_dir)/deps/openssl/openssl/include', |
| 87 | '<(node_root_dir)/deps/zlib' |
| 88 | ], |
murgatroid99 | a89d9e7 | 2015-10-13 16:03:16 -0700 | [diff] [blame] | 89 | 'conditions': [ |
| 90 | ['config=="gcov"', { |
| 91 | 'cflags': [ |
| 92 | '-ftest-coverage', |
| 93 | '-fprofile-arcs', |
| 94 | '-O0' |
| 95 | ], |
| 96 | 'ldflags': [ |
| 97 | '-ftest-coverage', |
| 98 | '-fprofile-arcs' |
| 99 | ] |
| 100 | } |
murgatroid99 | 5c56c92 | 2016-01-25 13:32:52 -0800 | [diff] [blame] | 101 | ], |
| 102 | ["target_arch=='ia32'", { |
| 103 | "include_dirs": [ "<(node_root_dir)/deps/openssl/config/piii" ] |
| 104 | }], |
| 105 | ["target_arch=='x64'", { |
| 106 | "include_dirs": [ "<(node_root_dir)/deps/openssl/config/k8" ] |
| 107 | }], |
| 108 | ["target_arch=='arm'", { |
| 109 | "include_dirs": [ "<(node_root_dir)/deps/openssl/config/arm" ] |
| 110 | }] |
murgatroid99 | a89d9e7 | 2015-10-13 16:03:16 -0700 | [diff] [blame] | 111 | ] |
murgatroid99 | afe4698 | 2015-10-23 10:17:26 -0700 | [diff] [blame] | 112 | }] |
murgatroid99 | fd994f1 | 2015-10-09 14:02:28 -0700 | [diff] [blame] | 113 | ] |
murgatroid99 | 2d6d330 | 2015-09-21 13:29:40 -0700 | [diff] [blame] | 114 | }, |
murgatroid99 | 5c56c92 | 2016-01-25 13:32:52 -0800 | [diff] [blame] | 115 | 'conditions': [ |
| 116 | ['OS == "win"', { |
| 117 | 'targets': [ |
murgatroid99 | af6c178 | 2016-01-28 13:14:24 -0800 | [diff] [blame] | 118 | { |
| 119 | # IMPORTANT WINDOWS BUILD INFORMATION |
| 120 | # This library does not build on Windows without modifying the Node |
| 121 | # development packages that node-gyp downloads in order to build. |
| 122 | # Due to https://github.com/nodejs/node/issues/4932, the headers for |
| 123 | # BoringSSL conflict with the OpenSSL headers included by default |
| 124 | # when including the Node headers. The remedy for this is to remove |
| 125 | # the OpenSSL headers, from the downloaded Node development package, |
| 126 | # which is typically located in `.node-gyp` in your home directory. |
murgatroid99 | 8e4103e | 2016-01-28 14:53:33 -0800 | [diff] [blame] | 127 | 'target_name': 'WINDOWS_BUILD_WARNING', |
murgatroid99 | af6c178 | 2016-01-28 13:14:24 -0800 | [diff] [blame] | 128 | 'actions': [ |
| 129 | { |
murgatroid99 | 8e4103e | 2016-01-28 14:53:33 -0800 | [diff] [blame] | 130 | 'action_name': 'WINDOWS_BUILD_WARNING', |
| 131 | 'inputs': [ |
| 132 | 'package.json' |
| 133 | ], |
| 134 | 'outputs': [ |
| 135 | 'ignore_this_part' |
| 136 | ], |
| 137 | '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] | 138 | } |
| 139 | ] |
| 140 | }, |
murgatroid99 | 5c56c92 | 2016-01-25 13:32:52 -0800 | [diff] [blame] | 141 | # Only want to compile BoringSSL and zlib under Windows |
| 142 | % for module in node_modules: |
| 143 | % for lib in libs: |
| 144 | % if lib.name in module.transitive_deps and lib.name in ('boringssl', 'z'): |
| 145 | { |
| 146 | 'cflags': [ |
| 147 | '-std=c99', |
| 148 | '-Wall', |
| 149 | '-Werror' |
| 150 | ], |
| 151 | 'target_name': '${lib.name}', |
| 152 | 'product_prefix': 'lib', |
| 153 | 'type': 'static_library', |
| 154 | 'dependencies': [ |
| 155 | % for dep in getattr(lib, 'deps', []): |
| 156 | '${dep}', |
| 157 | % endfor |
| 158 | ], |
| 159 | 'sources': [ |
| 160 | % for source in lib.src: |
| 161 | '${source}', |
| 162 | % endfor |
murgatroid99 | af6c178 | 2016-01-28 13:14:24 -0800 | [diff] [blame] | 163 | ] |
murgatroid99 | 5c56c92 | 2016-01-25 13:32:52 -0800 | [diff] [blame] | 164 | }, |
| 165 | % endif |
| 166 | % endfor |
| 167 | % endfor |
| 168 | ] |
| 169 | }] |
| 170 | ], |
murgatroid99 | 2d6d330 | 2015-09-21 13:29:40 -0700 | [diff] [blame] | 171 | 'targets': [ |
murgatroid99 | 879bc4f | 2015-11-05 10:35:04 -0800 | [diff] [blame] | 172 | % for module in node_modules: |
murgatroid99 | 2d6d330 | 2015-09-21 13:29:40 -0700 | [diff] [blame] | 173 | % for lib in libs: |
murgatroid99 | 5c56c92 | 2016-01-25 13:32:52 -0800 | [diff] [blame] | 174 | % 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] | 175 | { |
murgatroid99 | 3abed31 | 2016-01-07 17:16:46 -0800 | [diff] [blame] | 176 | 'cflags': [ |
| 177 | '-std=c99', |
| 178 | '-Wall', |
| 179 | '-Werror' |
| 180 | ], |
murgatroid99 | 2d6d330 | 2015-09-21 13:29:40 -0700 | [diff] [blame] | 181 | 'target_name': '${lib.name}', |
| 182 | 'product_prefix': 'lib', |
| 183 | 'type': 'static_library', |
| 184 | 'dependencies': [ |
| 185 | % for dep in getattr(lib, 'deps', []): |
| 186 | '${dep}', |
| 187 | % endfor |
| 188 | ], |
| 189 | 'sources': [ |
| 190 | % for source in lib.src: |
murgatroid99 | ca9db40 | 2015-09-21 14:39:09 -0700 | [diff] [blame] | 191 | '${source}', |
murgatroid99 | 2d6d330 | 2015-09-21 13:29:40 -0700 | [diff] [blame] | 192 | % endfor |
murgatroid99 | ca9db40 | 2015-09-21 14:39:09 -0700 | [diff] [blame] | 193 | ], |
murgatroid99 | 6ffdb94 | 2015-10-22 16:10:05 -0700 | [diff] [blame] | 194 | "conditions": [ |
| 195 | ['OS == "mac"', { |
| 196 | 'xcode_settings': { |
murgatroid99 | 22c448b | 2015-10-23 10:25:30 -0700 | [diff] [blame] | 197 | 'MACOSX_DEPLOYMENT_TARGET': '10.9' |
murgatroid99 | 6ffdb94 | 2015-10-22 16:10:05 -0700 | [diff] [blame] | 198 | } |
| 199 | }] |
murgatroid99 | 5c56c92 | 2016-01-25 13:32:52 -0800 | [diff] [blame] | 200 | ] |
murgatroid99 | 2d6d330 | 2015-09-21 13:29:40 -0700 | [diff] [blame] | 201 | }, |
murgatroid99 | ca9db40 | 2015-09-21 14:39:09 -0700 | [diff] [blame] | 202 | % endif |
murgatroid99 | 2d6d330 | 2015-09-21 13:29:40 -0700 | [diff] [blame] | 203 | % endfor |
murgatroid99 | fd994f1 | 2015-10-09 14:02:28 -0700 | [diff] [blame] | 204 | { |
| 205 | 'include_dirs': [ |
| 206 | "<!(node -e \"require('nan')\")" |
| 207 | ], |
| 208 | 'cflags': [ |
murgatroid99 | 3abed31 | 2016-01-07 17:16:46 -0800 | [diff] [blame] | 209 | '-std=c++11', |
murgatroid99 | fd994f1 | 2015-10-09 14:02:28 -0700 | [diff] [blame] | 210 | '-Wall', |
| 211 | '-pthread', |
| 212 | '-g', |
| 213 | '-zdefs', |
| 214 | '-Werror', |
| 215 | '-Wno-error=deprecated-declarations' |
| 216 | ], |
| 217 | 'ldflags': [ |
| 218 | '-g' |
| 219 | ], |
| 220 | "conditions": [ |
murgatroid99 | 5c56c92 | 2016-01-25 13:32:52 -0800 | [diff] [blame] | 221 | ['OS=="mac"', { |
murgatroid99 | fd994f1 | 2015-10-09 14:02:28 -0700 | [diff] [blame] | 222 | 'xcode_settings': { |
| 223 | 'MACOSX_DEPLOYMENT_TARGET': '10.9', |
| 224 | 'OTHER_CFLAGS': [ |
murgatroid99 | 673f65b | 2016-02-01 11:19:07 -0800 | [diff] [blame] | 225 | '-stdlib=libc++', |
| 226 | '-std=c++11' |
murgatroid99 | fd994f1 | 2015-10-09 14:02:28 -0700 | [diff] [blame] | 227 | ] |
| 228 | } |
murgatroid99 | 5c56c92 | 2016-01-25 13:32:52 -0800 | [diff] [blame] | 229 | }], |
| 230 | ['OS=="win"', { |
| 231 | 'dependencies': [ |
| 232 | % for dep in getattr(module, 'deps', []): |
| 233 | % if dep in ('boringssl', 'z'): |
| 234 | "${dep}", |
| 235 | % endif |
| 236 | % endfor |
| 237 | ] |
Craig Tiller | 4bef7ce | 2016-02-02 08:38:43 -0800 | [diff] [blame] | 238 | }], |
| 239 | ['OS=="linux"', { |
| 240 | 'ldflags': [ |
| 241 | '-Wl,-wrap,memcpy' |
| 242 | ] |
murgatroid99 | fd994f1 | 2015-10-09 14:02:28 -0700 | [diff] [blame] | 243 | }] |
| 244 | ], |
murgatroid99 | 879bc4f | 2015-11-05 10:35:04 -0800 | [diff] [blame] | 245 | "target_name": "${module.name}", |
murgatroid99 | fd994f1 | 2015-10-09 14:02:28 -0700 | [diff] [blame] | 246 | "sources": [ |
murgatroid99 | 879bc4f | 2015-11-05 10:35:04 -0800 | [diff] [blame] | 247 | % for source in module.src: |
| 248 | "${source}", |
| 249 | % endfor |
murgatroid99 | fd994f1 | 2015-10-09 14:02:28 -0700 | [diff] [blame] | 250 | ], |
| 251 | "dependencies": [ |
murgatroid99 | 879bc4f | 2015-11-05 10:35:04 -0800 | [diff] [blame] | 252 | % for dep in getattr(module, 'deps', []): |
murgatroid99 | 5c56c92 | 2016-01-25 13:32:52 -0800 | [diff] [blame] | 253 | % if dep not in ('boringssl', 'z'): |
murgatroid99 | 879bc4f | 2015-11-05 10:35:04 -0800 | [diff] [blame] | 254 | "${dep}", |
murgatroid99 | 5c56c92 | 2016-01-25 13:32:52 -0800 | [diff] [blame] | 255 | % endif |
murgatroid99 | 879bc4f | 2015-11-05 10:35:04 -0800 | [diff] [blame] | 256 | % endfor |
murgatroid99 | fd994f1 | 2015-10-09 14:02:28 -0700 | [diff] [blame] | 257 | ] |
murgatroid99 | 879bc4f | 2015-11-05 10:35:04 -0800 | [diff] [blame] | 258 | }, |
| 259 | % endfor |
murgatroid99 | e190f35 | 2016-01-20 13:52:08 -0800 | [diff] [blame] | 260 | { |
| 261 | "target_name": "action_after_build", |
| 262 | "type": "none", |
| 263 | "dependencies": [ "<(module_name)" ], |
| 264 | "copies": [ |
| 265 | { |
| 266 | "files": [ "<(PRODUCT_DIR)/<(module_name).node"], |
| 267 | "destination": "<(module_path)" |
| 268 | } |
| 269 | ] |
| 270 | } |
murgatroid99 | 2d6d330 | 2015-09-21 13:29:40 -0700 | [diff] [blame] | 271 | ] |
| 272 | } |