build: support shared zlib
[platform/upstream/nodejs.git] / node.gyp
1 {
2   'variables': {
3     'v8_use_snapshot%': 'true',
4     # Turn off -Werror in V8
5     # See http://codereview.chromium.org/8159015
6     'werror': '',
7     'node_use_dtrace': 'false',
8     'node_shared_v8%': 'false',
9     'node_shared_zlib%': 'false',
10     'node_use_openssl%': 'true',
11     'node_use_system_openssl%': 'false',
12     'library_files': [
13       'src/node.js',
14       'lib/_debugger.js',
15       'lib/_linklist.js',
16       'lib/assert.js',
17       'lib/buffer.js',
18       'lib/buffer_ieee754.js',
19       'lib/child_process.js',
20       'lib/console.js',
21       'lib/constants.js',
22       'lib/crypto.js',
23       'lib/cluster.js',
24       'lib/dgram.js',
25       'lib/dns.js',
26       'lib/events.js',
27       'lib/freelist.js',
28       'lib/fs.js',
29       'lib/http.js',
30       'lib/https.js',
31       'lib/module.js',
32       'lib/net.js',
33       'lib/os.js',
34       'lib/path.js',
35       'lib/punycode.js',
36       'lib/querystring.js',
37       'lib/readline.js',
38       'lib/repl.js',
39       'lib/stream.js',
40       'lib/string_decoder.js',
41       'lib/sys.js',
42       'lib/timers.js',
43       'lib/tls.js',
44       'lib/tty.js',
45       'lib/url.js',
46       'lib/util.js',
47       'lib/vm.js',
48       'lib/zlib.js',
49     ],
50   },
51
52   'targets': [
53     {
54       'target_name': 'node',
55       'type': 'executable',
56
57       'dependencies': [
58         'deps/http_parser/http_parser.gyp:http_parser',
59         'deps/uv/uv.gyp:uv',
60         'node_js2c#host',
61       ],
62
63       'include_dirs': [
64         'src',
65         'deps/uv/src/ares',
66         '<(SHARED_INTERMEDIATE_DIR)' # for node_natives.h
67       ],
68
69       'sources': [
70         'src/fs_event_wrap.cc',
71         'src/cares_wrap.cc',
72         'src/handle_wrap.cc',
73         'src/node.cc',
74         'src/node_buffer.cc',
75         'src/node_constants.cc',
76         'src/node_extensions.cc',
77         'src/node_file.cc',
78         'src/node_http_parser.cc',
79         'src/node_javascript.cc',
80         'src/node_main.cc',
81         'src/node_os.cc',
82         'src/node_script.cc',
83         'src/node_string.cc',
84         'src/node_zlib.cc',
85         'src/pipe_wrap.cc',
86         'src/stream_wrap.cc',
87         'src/tcp_wrap.cc',
88         'src/timer_wrap.cc',
89         'src/tty_wrap.cc',
90         'src/process_wrap.cc',
91         'src/v8_typed_array.cc',
92         'src/udp_wrap.cc',
93         # headers to make for a more pleasant IDE experience
94         'src/handle_wrap.h',
95         'src/node.h',
96         'src/node_buffer.h',
97         'src/node_constants.h',
98         'src/node_crypto.h',
99         'src/node_extensions.h',
100         'src/node_file.h',
101         'src/node_http_parser.h',
102         'src/node_javascript.h',
103         'src/node_os.h',
104         'src/node_root_certs.h',
105         'src/node_script.h',
106         'src/node_string.h',
107         'src/node_version.h',
108         'src/pipe_wrap.h',
109         'src/req_wrap.h',
110         'src/stream_wrap.h',
111         'src/v8_typed_array.h',
112         'deps/http_parser/http_parser.h',
113         '<(SHARED_INTERMEDIATE_DIR)/node_natives.h',
114         # javascript files to make for an even more pleasant IDE experience
115         '<@(library_files)',
116         # node.gyp is added to the project by default.
117         'common.gypi',
118       ],
119
120       'defines': [
121         'NODE_WANT_INTERNALS=1',
122         'ARCH="<(target_arch)"',
123         'PLATFORM="<(OS)"',
124       ],
125
126       'conditions': [
127         [ 'node_use_openssl=="true"', {
128           'defines': [ 'HAVE_OPENSSL=1' ],
129           'sources': [ 'src/node_crypto.cc' ],
130           'conditions': [
131             [ 'node_use_system_openssl=="false"', {
132               'dependencies': [ './deps/openssl/openssl.gyp:openssl' ],
133             }]]
134         }, {
135           'defines': [ 'HAVE_OPENSSL=0' ]
136         }],
137
138         [ 'node_use_dtrace=="true"', {
139           'sources': [
140             'src/node_dtrace.cc',
141             'src/node_dtrace.h',
142             # why does node_provider.h get generated into src and not
143             # SHARED_INTERMEDIATE_DIR?
144             'src/node_provider.h',
145           ],
146         }],
147
148         [ 'node_shared_v8=="true"', {
149           'sources': [
150             '<(node_shared_v8_includes)/v8.h',
151             '<(node_shared_v8_includes)/v8-debug.h',
152           ],
153         }, {
154           'sources': [
155             'deps/v8/include/v8.h',
156             'deps/v8/include/v8-debug.h',
157           ],
158           'dependencies': [ 'deps/v8/tools/gyp/v8.gyp:v8' ],
159         }],
160
161         [ 'node_shared_zlib=="false"', {
162           'dependencies': [ 'deps/zlib/zlib.gyp:zlib' ],
163         }],
164
165         [ 'OS=="win"', {
166           'sources': [
167             'tools/msvs/res/node.rc',
168           ],
169           'defines': [
170             'FD_SETSIZE=1024',
171             # we need to use node's preferred "win32" rather than gyp's preferred "win"
172             'PLATFORM="win32"',
173             '_UNICODE=1',
174           ],
175           'libraries': [ '-lpsapi.lib' ]
176         },{ # POSIX
177           'defines': [ '__POSIX__' ],
178           'sources': [
179             'src/node_signal_watcher.cc',
180             'src/node_stat_watcher.cc',
181             'src/node_io_watcher.cc',
182           ]
183         }],
184         [ 'OS=="mac"', {
185           'libraries': [ '-framework Carbon' ],
186           'defines!': [
187             'PLATFORM="mac"',
188           ],
189           'defines': [
190             # we need to use node's preferred "darwin" rather than gyp's preferred "mac"
191             'PLATFORM="darwin"',
192           ],
193         }],
194         [ 'OS=="linux"', {
195           'libraries': [
196             '-ldl',
197             '-lutil' # needed for openpty
198           ],
199         }],
200         [ 'OS=="freebsd"', {
201           'libraries': [
202             '-lutil',
203             '-lkvm',
204           ],
205         }],
206         [ 'OS=="solaris"', {
207           'libraries': [
208             '-lkstat',
209           ],
210         }],
211       ],
212       'msvs-settings': {
213         'VCLinkerTool': {
214           'SubSystem': 1, # /subsystem:console
215         },
216       },
217     },
218
219     {
220       'target_name': 'node_js2c',
221       'type': 'none',
222       'toolsets': ['host'],
223       'actions': [
224         {
225           'action_name': 'node_js2c',
226
227           'inputs': [
228             './tools/js2c.py',
229             '<@(library_files)',
230           ],
231
232           'outputs': [
233             '<(SHARED_INTERMEDIATE_DIR)/node_natives.h',
234           ],
235
236           # FIXME can the following conditions be shorted by just setting
237           # macros.py into some variable which then gets included in the
238           # action?
239
240           'conditions': [
241             [ 'node_use_dtrace=="true"', {
242               'action': [
243                 'python',
244                 'tools/js2c.py',
245                 '<@(_outputs)',
246                 '<@(library_files)'
247               ],
248             }, { # No Dtrace
249               'action': [
250                 'python',
251                 'tools/js2c.py',
252                 '<@(_outputs)',
253                 '<@(library_files)',
254                 'src/macros.py'
255               ],
256             }]
257           ],
258         },
259       ],
260     }, # end node_js2c
261   ] # end targets
262 }
263