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