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', |
murgatroid99 | 795d15e | 2015-10-26 11:32:18 -0700 | [diff] [blame] | 60 | '<(node_root_dir)/deps/openssl/openssl/include', |
| 61 | '<(node_root_dir)/deps/zlib' |
murgatroid99 | a89d9e7 | 2015-10-13 16:03:16 -0700 | [diff] [blame] | 62 | ], |
| 63 | 'conditions': [ |
| 64 | ['OS != "win"', { |
| 65 | 'conditions': [ |
| 66 | ['config=="gcov"', { |
| 67 | 'cflags': [ |
| 68 | '-ftest-coverage', |
| 69 | '-fprofile-arcs', |
| 70 | '-O0' |
| 71 | ], |
| 72 | 'ldflags': [ |
| 73 | '-ftest-coverage', |
| 74 | '-fprofile-arcs' |
| 75 | ] |
| 76 | } |
| 77 | ] |
| 78 | ] |
| 79 | }], |
murgatroid99 | afe4698 | 2015-10-23 10:17:26 -0700 | [diff] [blame] | 80 | ["target_arch=='ia32'", { |
| 81 | "include_dirs": [ "<(node_root_dir)/deps/openssl/config/piii" ] |
| 82 | }], |
| 83 | ["target_arch=='x64'", { |
| 84 | "include_dirs": [ "<(node_root_dir)/deps/openssl/config/k8" ] |
| 85 | }], |
| 86 | ["target_arch=='arm'", { |
| 87 | "include_dirs": [ "<(node_root_dir)/deps/openssl/config/arm" ] |
| 88 | }] |
murgatroid99 | fd994f1 | 2015-10-09 14:02:28 -0700 | [diff] [blame] | 89 | ] |
murgatroid99 | 2d6d330 | 2015-09-21 13:29:40 -0700 | [diff] [blame] | 90 | }, |
| 91 | 'targets': [ |
murgatroid99 | 879bc4f | 2015-11-05 10:35:04 -0800 | [diff] [blame] | 92 | % for module in node_modules: |
murgatroid99 | 2d6d330 | 2015-09-21 13:29:40 -0700 | [diff] [blame] | 93 | % for lib in libs: |
murgatroid99 | 879bc4f | 2015-11-05 10:35:04 -0800 | [diff] [blame] | 94 | % if lib.name in module.transitive_deps: |
murgatroid99 | 2d6d330 | 2015-09-21 13:29:40 -0700 | [diff] [blame] | 95 | { |
murgatroid99 | 3abed31 | 2016-01-07 17:16:46 -0800 | [diff] [blame^] | 96 | 'cflags': [ |
| 97 | '-std=c99', |
| 98 | '-Wall', |
| 99 | '-Werror' |
| 100 | ], |
murgatroid99 | 2d6d330 | 2015-09-21 13:29:40 -0700 | [diff] [blame] | 101 | 'target_name': '${lib.name}', |
| 102 | 'product_prefix': 'lib', |
| 103 | 'type': 'static_library', |
| 104 | 'dependencies': [ |
| 105 | % for dep in getattr(lib, 'deps', []): |
| 106 | '${dep}', |
| 107 | % endfor |
| 108 | ], |
| 109 | 'sources': [ |
| 110 | % for source in lib.src: |
murgatroid99 | ca9db40 | 2015-09-21 14:39:09 -0700 | [diff] [blame] | 111 | '${source}', |
murgatroid99 | 2d6d330 | 2015-09-21 13:29:40 -0700 | [diff] [blame] | 112 | % endfor |
murgatroid99 | ca9db40 | 2015-09-21 14:39:09 -0700 | [diff] [blame] | 113 | ], |
murgatroid99 | 6ffdb94 | 2015-10-22 16:10:05 -0700 | [diff] [blame] | 114 | "conditions": [ |
| 115 | ['OS == "mac"', { |
| 116 | 'xcode_settings': { |
murgatroid99 | 22c448b | 2015-10-23 10:25:30 -0700 | [diff] [blame] | 117 | 'MACOSX_DEPLOYMENT_TARGET': '10.9' |
murgatroid99 | 6ffdb94 | 2015-10-22 16:10:05 -0700 | [diff] [blame] | 118 | } |
| 119 | }] |
| 120 | ], |
murgatroid99 | 2d6d330 | 2015-09-21 13:29:40 -0700 | [diff] [blame] | 121 | }, |
murgatroid99 | ca9db40 | 2015-09-21 14:39:09 -0700 | [diff] [blame] | 122 | % endif |
murgatroid99 | 2d6d330 | 2015-09-21 13:29:40 -0700 | [diff] [blame] | 123 | % endfor |
murgatroid99 | fd994f1 | 2015-10-09 14:02:28 -0700 | [diff] [blame] | 124 | { |
| 125 | 'include_dirs': [ |
| 126 | "<!(node -e \"require('nan')\")" |
| 127 | ], |
| 128 | 'cflags': [ |
murgatroid99 | 3abed31 | 2016-01-07 17:16:46 -0800 | [diff] [blame^] | 129 | '-std=c++11', |
murgatroid99 | fd994f1 | 2015-10-09 14:02:28 -0700 | [diff] [blame] | 130 | '-Wall', |
| 131 | '-pthread', |
| 132 | '-g', |
| 133 | '-zdefs', |
| 134 | '-Werror', |
| 135 | '-Wno-error=deprecated-declarations' |
| 136 | ], |
| 137 | 'ldflags': [ |
| 138 | '-g' |
| 139 | ], |
| 140 | "conditions": [ |
murgatroid99 | fd994f1 | 2015-10-09 14:02:28 -0700 | [diff] [blame] | 141 | ['OS == "mac"', { |
| 142 | 'xcode_settings': { |
| 143 | 'MACOSX_DEPLOYMENT_TARGET': '10.9', |
| 144 | 'OTHER_CFLAGS': [ |
| 145 | '-std=c++11', |
| 146 | '-stdlib=libc++' |
| 147 | ] |
| 148 | } |
| 149 | }] |
| 150 | ], |
murgatroid99 | 879bc4f | 2015-11-05 10:35:04 -0800 | [diff] [blame] | 151 | "target_name": "${module.name}", |
murgatroid99 | fd994f1 | 2015-10-09 14:02:28 -0700 | [diff] [blame] | 152 | "sources": [ |
murgatroid99 | 879bc4f | 2015-11-05 10:35:04 -0800 | [diff] [blame] | 153 | % for source in module.src: |
| 154 | "${source}", |
| 155 | % endfor |
murgatroid99 | fd994f1 | 2015-10-09 14:02:28 -0700 | [diff] [blame] | 156 | ], |
| 157 | "dependencies": [ |
murgatroid99 | 879bc4f | 2015-11-05 10:35:04 -0800 | [diff] [blame] | 158 | % for dep in getattr(module, 'deps', []): |
| 159 | "${dep}", |
| 160 | % endfor |
murgatroid99 | fd994f1 | 2015-10-09 14:02:28 -0700 | [diff] [blame] | 161 | ] |
murgatroid99 | 879bc4f | 2015-11-05 10:35:04 -0800 | [diff] [blame] | 162 | }, |
| 163 | % endfor |
murgatroid99 | 2d6d330 | 2015-09-21 13:29:40 -0700 | [diff] [blame] | 164 | ] |
| 165 | } |