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