From 4f5b746a52fadc110604e7794a51e99532817a26 Mon Sep 17 00:00:00 2001 From: Nathan Schulte Date: Wed, 11 Jan 2017 19:27:19 -0600 Subject: [PATCH] build: support out-of-tree build in configure updates the configure script to differentiate between the src (project; previously 'root_dir') and the build directories, which may be different --- configure | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/configure b/configure index d926cec7d5d7..43b5c68cd230 100755 --- a/configure +++ b/configure @@ -20,16 +20,17 @@ import string CC = os.environ.get('CC', 'cc' if sys.platform == 'darwin' else 'gcc') CXX = os.environ.get('CXX', 'c++' if sys.platform == 'darwin' else 'g++') -root_dir = os.path.dirname(__file__) -sys.path.insert(0, os.path.join(root_dir, 'tools', 'gyp', 'pylib')) +build_dir = os.getcwd() +src_dir = os.path.dirname(__file__) +sys.path.insert(0, os.path.join(src_dir, 'tools', 'gyp', 'pylib')) from gyp.common import GetFlavor # imports in tools/configure.d -sys.path.insert(0, os.path.join(root_dir, 'tools', 'configure.d')) +sys.path.insert(0, os.path.join(src_dir, 'tools', 'configure.d')) import nodedownload # imports in tools/ -sys.path.insert(0, os.path.join(root_dir, 'tools')) +sys.path.insert(0, os.path.join(src_dir, 'tools')) import getmoduleversion # parse our options @@ -372,7 +373,7 @@ intl_optgroup.add_option('--download', intl_optgroup.add_option('--download-path', action='store', dest='download_path', - default=os.path.join(root_dir, 'deps'), + default=os.path.join(build_dir, 'deps'), help='Download directory [default: %default]') parser.add_option_group(intl_optgroup) @@ -942,7 +943,7 @@ def configure_openssl(o): o['variables']['openssl_no_asm'] = 1 if options.openssl_no_asm else 0 if options.openssl_fips: o['variables']['openssl_fips'] = options.openssl_fips - fips_dir = os.path.join(root_dir, 'deps', 'openssl', 'fips') + fips_dir = os.path.join(build_dir, 'deps', 'openssl', 'fips') fips_ld = os.path.abspath(os.path.join(fips_dir, 'fipsld')) o['make_fips_settings'] = [ ['LINK', fips_ld + ' <(openssl_fips)/bin/fipsld'], @@ -972,7 +973,7 @@ def configure_static(o): def write(filename, data): - filename = os.path.join(root_dir, filename) + filename = os.path.join(build_dir, filename) print('creating %s' % filename) f = open(filename, 'w+') f.write(data) @@ -1094,7 +1095,7 @@ def configure_intl(o): return # this is just the 'deps' dir. Used for unpacking. - icu_parent_path = os.path.join(root_dir, 'deps') + icu_parent_path = os.path.join(build_dir, 'deps') # The full path to the ICU source directory. Should not include './'. icu_full_path = 'deps/icu' @@ -1339,7 +1340,7 @@ config = '\n'.join(map('='.join, config.iteritems())) + '\n' write('config.mk', '# Do not edit. Generated by the configure script.\n' + config) -gyp_args = [sys.executable, 'tools/gyp_node.py', '--no-parallel'] +gyp_args = [sys.executable, os.path.join(src_dir, 'tools/gyp_node.py'), '--no-parallel'] if options.use_xcode: gyp_args += ['-f', 'xcode']