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