|
@ -1,11 +1,14 @@ |
|
|
#!/usr/bin/env python |
|
|
#!/usr/bin/env python |
|
|
|
|
|
|
|
|
import glob |
|
|
import glob |
|
|
import os |
|
|
import os |
|
|
import shlex |
|
|
import subprocess |
|
|
import sys |
|
|
import sys |
|
|
|
|
|
|
|
|
|
|
|
CC = os.environ.get('CC', 'cc') |
|
|
script_dir = os.path.dirname(__file__) |
|
|
script_dir = os.path.dirname(__file__) |
|
|
uv_root = os.path.normpath(script_dir) |
|
|
uv_root = os.path.normpath(script_dir) |
|
|
|
|
|
output_dir = os.path.join(os.path.abspath(uv_root), 'out') |
|
|
|
|
|
|
|
|
sys.path.insert(0, os.path.join(uv_root, 'build', 'gyp', 'pylib')) |
|
|
sys.path.insert(0, os.path.join(uv_root, 'build', 'gyp', 'pylib')) |
|
|
try: |
|
|
try: |
|
@ -14,9 +17,14 @@ except ImportError: |
|
|
print('You need to install gyp in build/gyp first. See the README.') |
|
|
print('You need to install gyp in build/gyp first. See the README.') |
|
|
sys.exit(42) |
|
|
sys.exit(42) |
|
|
|
|
|
|
|
|
# Directory within which we want all generated files (including Makefiles) |
|
|
|
|
|
# to be written. |
|
|
def compiler_version(): |
|
|
output_dir = os.path.join(os.path.abspath(uv_root), 'out') |
|
|
proc = subprocess.Popen(CC.split() + ['--version'], stdout=subprocess.PIPE) |
|
|
|
|
|
is_clang = 'clang' in proc.communicate()[0].split('\n')[0] |
|
|
|
|
|
proc = subprocess.Popen(CC.split() + ['-dumpversion'], stdout=subprocess.PIPE) |
|
|
|
|
|
version = tuple(map(int, proc.communicate()[0].split('.'))) |
|
|
|
|
|
return (version, is_clang) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def run_gyp(args): |
|
|
def run_gyp(args): |
|
|
rc = gyp.main(args) |
|
|
rc = gyp.main(args) |
|
@ -24,6 +32,7 @@ def run_gyp(args): |
|
|
print 'Error running GYP' |
|
|
print 'Error running GYP' |
|
|
sys.exit(rc) |
|
|
sys.exit(rc) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__': |
|
|
if __name__ == '__main__': |
|
|
args = sys.argv[1:] |
|
|
args = sys.argv[1:] |
|
|
|
|
|
|
|
@ -49,12 +58,12 @@ if __name__ == '__main__': |
|
|
|
|
|
|
|
|
# There's a bug with windows which doesn't allow this feature. |
|
|
# There's a bug with windows which doesn't allow this feature. |
|
|
if sys.platform != 'win32': |
|
|
if sys.platform != 'win32': |
|
|
# Tell gyp to write the Makefiles into output_dir |
|
|
|
|
|
args.extend(['--generator-output', output_dir]) |
|
|
args.extend(['--generator-output', output_dir]) |
|
|
# Tell make to write its output into the same dir |
|
|
|
|
|
args.extend(['-Goutput_dir=' + output_dir]) |
|
|
args.extend(['-Goutput_dir=' + output_dir]) |
|
|
# Create Makefiles, not XCode projects |
|
|
|
|
|
args.extend('-f make'.split()) |
|
|
args.extend('-f make'.split()) |
|
|
|
|
|
(major, minor), is_clang = compiler_version() |
|
|
|
|
|
args.append('-Dgcc_version=%d' % (10 * major + minor)) |
|
|
|
|
|
args.append('-Dclang=%d' % int(is_clang)) |
|
|
|
|
|
|
|
|
args.append('-Dtarget_arch=ia32') |
|
|
args.append('-Dtarget_arch=ia32') |
|
|
args.append('-Dcomponent=static_library') |
|
|
args.append('-Dcomponent=static_library') |
|
|