blob: bf01cad34c168467eff604ca59274dd91a8c6ceb [file] [log] [blame]
murgatroid992d6d3302015-09-21 13:29:40 -07001%YAML 1.2
2--- |
murgatroid99fd994f12015-10-09 14:02:28 -07003 # GRPC Node gyp file
4 # This currently builds the Node extension and dependencies
murgatroid992d6d3302015-09-21 13:29:40 -07005 # 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 {
murgatroid99fd994f12015-10-09 14:02:28 -070042 'variables': {
43 'config': '<!(echo $CONFIG)'
44 },
murgatroid9938745ef2015-09-21 16:39:37 -070045 # TODO: Finish windows support
murgatroid992d6d3302015-09-21 13:29:40 -070046 'target_defaults': {
murgatroid99e7540792015-10-09 15:43:14 -070047 # Empirically, Node only exports ALPN symbols if its major version is >0.
murgatroid99fd994f12015-10-09 14:02:28 -070048 # io.js always reports versions >0 and always exports ALPN symbols.
murgatroid9915def982015-10-09 14:11:02 -070049 # 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],
murgatroid99c07c7342015-10-19 17:41:03 -070051 # 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".
murgatroid99ca9db402015-09-21 14:39:09 -070054 'defines': [
murgatroid99c07c7342015-10-19 17:41:03 -070055 'TSI_OPENSSL_ALPN_SUPPORT=<!(node --version | cut -d. -f1 | cut -c2-)'
murgatroid99ca9db402015-09-21 14:39:09 -070056 ],
murgatroid992d6d3302015-09-21 13:29:40 -070057 'include_dirs': [
murgatroid99ca9db402015-09-21 14:39:09 -070058 '.',
murgatroid99afe46982015-10-23 10:17:26 -070059 'include',
murgatroid99795d15e2015-10-26 11:32:18 -070060 '<(node_root_dir)/deps/openssl/openssl/include',
61 '<(node_root_dir)/deps/zlib'
murgatroid99a89d9e72015-10-13 16:03:16 -070062 ],
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 }],
murgatroid99afe46982015-10-23 10:17:26 -070080 ["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 }]
murgatroid99fd994f12015-10-09 14:02:28 -070089 ]
murgatroid992d6d3302015-09-21 13:29:40 -070090 },
91 'targets': [
murgatroid99879bc4f2015-11-05 10:35:04 -080092 % for module in node_modules:
murgatroid992d6d3302015-09-21 13:29:40 -070093 % for lib in libs:
murgatroid99879bc4f2015-11-05 10:35:04 -080094 % if lib.name in module.transitive_deps:
murgatroid992d6d3302015-09-21 13:29:40 -070095 {
murgatroid993abed312016-01-07 17:16:46 -080096 'cflags': [
97 '-std=c99',
98 '-Wall',
99 '-Werror'
100 ],
murgatroid992d6d3302015-09-21 13:29:40 -0700101 '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:
murgatroid99ca9db402015-09-21 14:39:09 -0700111 '${source}',
murgatroid992d6d3302015-09-21 13:29:40 -0700112 % endfor
murgatroid99ca9db402015-09-21 14:39:09 -0700113 ],
murgatroid996ffdb942015-10-22 16:10:05 -0700114 "conditions": [
115 ['OS == "mac"', {
116 'xcode_settings': {
murgatroid9922c448b2015-10-23 10:25:30 -0700117 'MACOSX_DEPLOYMENT_TARGET': '10.9'
murgatroid996ffdb942015-10-22 16:10:05 -0700118 }
119 }]
120 ],
murgatroid992d6d3302015-09-21 13:29:40 -0700121 },
murgatroid99ca9db402015-09-21 14:39:09 -0700122 % endif
murgatroid992d6d3302015-09-21 13:29:40 -0700123 % endfor
murgatroid99fd994f12015-10-09 14:02:28 -0700124 {
125 'include_dirs': [
126 "<!(node -e \"require('nan')\")"
127 ],
128 'cflags': [
murgatroid993abed312016-01-07 17:16:46 -0800129 '-std=c++11',
murgatroid99fd994f12015-10-09 14:02:28 -0700130 '-Wall',
131 '-pthread',
132 '-g',
133 '-zdefs',
134 '-Werror',
135 '-Wno-error=deprecated-declarations'
136 ],
137 'ldflags': [
138 '-g'
139 ],
140 "conditions": [
murgatroid99fd994f12015-10-09 14:02:28 -0700141 ['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 ],
murgatroid99879bc4f2015-11-05 10:35:04 -0800151 "target_name": "${module.name}",
murgatroid99fd994f12015-10-09 14:02:28 -0700152 "sources": [
murgatroid99879bc4f2015-11-05 10:35:04 -0800153 % for source in module.src:
154 "${source}",
155 % endfor
murgatroid99fd994f12015-10-09 14:02:28 -0700156 ],
157 "dependencies": [
murgatroid99879bc4f2015-11-05 10:35:04 -0800158 % for dep in getattr(module, 'deps', []):
159 "${dep}",
160 % endfor
murgatroid99fd994f12015-10-09 14:02:28 -0700161 ]
murgatroid99879bc4f2015-11-05 10:35:04 -0800162 },
163 % endfor
murgatroid992d6d3302015-09-21 13:29:40 -0700164 ]
165 }