blob: 60a64273bfe3830cc02fea061082469fb42299c2 [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',
60 '<(node_root_dir)/deps/openssl/openssl/include'
murgatroid99a89d9e72015-10-13 16:03:16 -070061 ],
62 'conditions': [
63 ['OS != "win"', {
64 'conditions': [
65 ['config=="gcov"', {
66 'cflags': [
67 '-ftest-coverage',
68 '-fprofile-arcs',
69 '-O0'
70 ],
71 'ldflags': [
72 '-ftest-coverage',
73 '-fprofile-arcs'
74 ]
75 }
76 ]
77 ]
78 }],
murgatroid99afe46982015-10-23 10:17:26 -070079 ["target_arch=='ia32'", {
80 "include_dirs": [ "<(node_root_dir)/deps/openssl/config/piii" ]
81 }],
82 ["target_arch=='x64'", {
83 "include_dirs": [ "<(node_root_dir)/deps/openssl/config/k8" ]
84 }],
85 ["target_arch=='arm'", {
86 "include_dirs": [ "<(node_root_dir)/deps/openssl/config/arm" ]
87 }]
murgatroid99fd994f12015-10-09 14:02:28 -070088 ]
murgatroid992d6d3302015-09-21 13:29:40 -070089 },
90 'targets': [
91 % for lib in libs:
murgatroid99db5b1602015-10-01 13:20:11 -070092 % if lib.name == 'gpr' or lib.name == 'grpc':
murgatroid992d6d3302015-09-21 13:29:40 -070093 {
94 'target_name': '${lib.name}',
95 'product_prefix': 'lib',
96 'type': 'static_library',
97 'dependencies': [
98 % for dep in getattr(lib, 'deps', []):
99 '${dep}',
100 % endfor
101 ],
102 'sources': [
103 % for source in lib.src:
murgatroid99ca9db402015-09-21 14:39:09 -0700104 '${source}',
murgatroid992d6d3302015-09-21 13:29:40 -0700105 % endfor
murgatroid99ca9db402015-09-21 14:39:09 -0700106 ],
murgatroid996ffdb942015-10-22 16:10:05 -0700107 "conditions": [
108 ['OS == "mac"', {
109 'xcode_settings': {
murgatroid9922c448b2015-10-23 10:25:30 -0700110 'MACOSX_DEPLOYMENT_TARGET': '10.9'
murgatroid996ffdb942015-10-22 16:10:05 -0700111 }
112 }]
113 ],
murgatroid992d6d3302015-09-21 13:29:40 -0700114 },
murgatroid99ca9db402015-09-21 14:39:09 -0700115 % endif
murgatroid992d6d3302015-09-21 13:29:40 -0700116 % endfor
murgatroid99fd994f12015-10-09 14:02:28 -0700117 {
118 'include_dirs': [
119 "<!(node -e \"require('nan')\")"
120 ],
121 'cflags': [
122 '-std=c++0x',
123 '-Wall',
124 '-pthread',
125 '-g',
126 '-zdefs',
127 '-Werror',
128 '-Wno-error=deprecated-declarations'
129 ],
130 'ldflags': [
131 '-g'
132 ],
133 "conditions": [
murgatroid99fd994f12015-10-09 14:02:28 -0700134 ['OS == "mac"', {
135 'xcode_settings': {
136 'MACOSX_DEPLOYMENT_TARGET': '10.9',
137 'OTHER_CFLAGS': [
138 '-std=c++11',
139 '-stdlib=libc++'
140 ]
141 }
142 }]
143 ],
144 "target_name": "grpc_node",
145 "sources": [
146 "src/node/ext/byte_buffer.cc",
147 "src/node/ext/call.cc",
148 "src/node/ext/call_credentials.cc",
149 "src/node/ext/channel.cc",
150 "src/node/ext/channel_credentials.cc",
151 "src/node/ext/completion_queue_async_worker.cc",
152 "src/node/ext/node_grpc.cc",
153 "src/node/ext/server.cc",
154 "src/node/ext/server_credentials.cc",
155 "src/node/ext/timeval.cc"
156 ],
157 "dependencies": [
158 "grpc"
159 ]
160 }
murgatroid992d6d3302015-09-21 13:29:40 -0700161 ]
162 }