Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 61 lines (47 sloc) 1.786 kb
bef9f56 ry Bring gyp into the tools directory; handwritten makefile
ry authored
1 #!/usr/bin/env python
2 import glob
3 import os
4 import shlex
5 import sys
6
71333b3 Peter Bright Modify GYP scripts for VC build
DrPizza authored
7 script_dir = os.path.dirname(__file__)
8 node_root = os.path.normpath(os.path.join(script_dir, os.pardir))
bef9f56 ry Bring gyp into the tools directory; handwritten makefile
ry authored
9
71333b3 Peter Bright Modify GYP scripts for VC build
DrPizza authored
10 sys.path.insert(0, os.path.join(node_root, 'tools', 'gyp', 'pylib'))
bef9f56 ry Bring gyp into the tools directory; handwritten makefile
ry authored
11 import gyp
12
13 # Directory within which we want all generated files (including Makefiles)
14 # to be written.
15 output_dir = os.path.join(os.path.abspath(node_root), 'out')
16
17 def run_gyp(args):
18 rc = gyp.main(args)
19 if rc != 0:
20 print 'Error running GYP'
21 sys.exit(rc)
22
23 if __name__ == '__main__':
24 args = sys.argv[1:]
f57d70d ry sketch out configure support
ry authored
25
d53fccb ry Fix MSVS build
ry authored
26 # GYP bug.
27 # On msvs it will crash if it gets an absolute path.
28 # On Mac/make it will crash if it doesn't get an absolute path.
29 if sys.platform == 'win32':
30 args.append(os.path.join(node_root, 'node.gyp'))
16788f4 Peter Bright Rename gyp files to produce useful solution names.
DrPizza authored
31 common_fn = os.path.join(node_root, 'common.gypi')
d53fccb ry Fix MSVS build
ry authored
32 options_fn = os.path.join(node_root, 'options.gypi')
33 else:
34 args.append(os.path.join(os.path.abspath(node_root), 'node.gyp'))
16788f4 Peter Bright Rename gyp files to produce useful solution names.
DrPizza authored
35 common_fn = os.path.join(os.path.abspath(node_root), 'common.gypi')
d53fccb ry Fix MSVS build
ry authored
36 options_fn = os.path.join(os.path.abspath(node_root), 'options.gypi')
37
16788f4 Peter Bright Rename gyp files to produce useful solution names.
DrPizza authored
38 if os.path.exists(common_fn):
39 args.extend(['-I', common_fn])
40
f57d70d ry sketch out configure support
ry authored
41 if os.path.exists(options_fn):
42 args.extend(['-I', options_fn])
43
bef9f56 ry Bring gyp into the tools directory; handwritten makefile
ry authored
44 args.append('--depth=' + node_root)
45
16788f4 Peter Bright Rename gyp files to produce useful solution names.
DrPizza authored
46 # There's a bug with windows which doesn't allow this feature.
71333b3 Peter Bright Modify GYP scripts for VC build
DrPizza authored
47 if sys.platform != 'win32':
16788f4 Peter Bright Rename gyp files to produce useful solution names.
DrPizza authored
48
49 # Tell gyp to write the Makefiles into output_dir
50 args.extend(['--generator-output', output_dir])
51
71333b3 Peter Bright Modify GYP scripts for VC build
DrPizza authored
52 # Tell make to write its output into the same dir
53 args.extend(['-Goutput_dir=' + output_dir])
bef9f56 ry Bring gyp into the tools directory; handwritten makefile
ry authored
54
71333b3 Peter Bright Modify GYP scripts for VC build
DrPizza authored
55 args.append('-Dtarget_arch=ia32')
bef9f56 ry Bring gyp into the tools directory; handwritten makefile
ry authored
56 args.append('-Dcomponent=static_library')
57 args.append('-Dlibrary=static_library')
58 gyp_args = list(args)
f57d70d ry sketch out configure support
ry authored
59 print gyp_args
bef9f56 ry Bring gyp into the tools directory; handwritten makefile
ry authored
60 run_gyp(gyp_args)
Something went wrong with that request. Please try again.