diff options
author | binji <binji@chromium.org> | 2015-01-27 10:58:56 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-01-27 19:01:50 +0000 |
commit | dcdde1cd950b05f33520c40b63de24410d7deab4 (patch) | |
tree | d46f2107b0f15a6b48e09011e5bf747679fb3f58 /native_client_sdk | |
parent | 599be60af8d7643966e26fe631768e4a5c99e991 (diff) | |
download | chromium_src-dcdde1cd950b05f33520c40b63de24410d7deab4.zip chromium_src-dcdde1cd950b05f33520c40b63de24410d7deab4.tar.gz chromium_src-dcdde1cd950b05f33520c40b63de24410d7deab4.tar.bz2 |
[NaCl SDK] Update Windows build to use vs2013 from depot_tools.
I'm not sure why this was working on the bots, but the sdk build was no longer
working on my Windows machine. After some research, I found that Chromium must
be built with vs2013, which was not supported by build_sdk, or by the Native
Client build (see https://code.google.com/p/nativeclient/issues/detail?id=4022)
This change modifies build_sdk.py (and build_artifacts.py) to use VS2013 from
depot_tools if it is available, as well as switching to using gyp_chromium
instead of gyp_nacl for building Native Client host binaries.
BUG=none
R=bradnelson@chromium.org
Review URL: https://codereview.chromium.org/811533002
Cr-Commit-Position: refs/heads/master@{#313319}
Diffstat (limited to 'native_client_sdk')
4 files changed, 58 insertions, 49 deletions
diff --git a/native_client_sdk/src/build_tools/build_artifacts.py b/native_client_sdk/src/build_tools/build_artifacts.py index d412230..ad22c33 100755 --- a/native_client_sdk/src/build_tools/build_artifacts.py +++ b/native_client_sdk/src/build_tools/build_artifacts.py @@ -209,15 +209,8 @@ def GypNinjaBuild(arch, gyp_py_script, gyp_file, targets, out_dir): if arch: gyp_defines.append('target_arch=%s' % arch) if arch == 'arm': - if PLATFORM == 'linux': - gyp_env['CC'] = 'arm-linux-gnueabihf-gcc' - gyp_env['CXX'] = 'arm-linux-gnueabihf-g++' - gyp_env['AR'] = 'arm-linux-gnueabihf-ar' - gyp_env['AS'] = 'arm-linux-gnueabihf-as' - gyp_env['CC_host'] = 'cc' - gyp_env['CXX_host'] = 'c++' - gyp_defines += ['armv7=1', 'arm_thumb=0', 'arm_neon=1', - 'arm_float_abi=hard', 'nacl_enable_arm_gcc=1'] + gyp_env['GYP_CROSSCOMPILE'] = '1' + gyp_defines += ['arm_float_abi=hard'] if options.no_arm_trusted: gyp_defines.append('disable_cross_trusted=1') if PLATFORM == 'mac': @@ -360,8 +353,17 @@ def GetGypToolchainLib(root, tcname, xarch): def MakeGypArchives(): join = os.path.join - gyp_nacl = join(NACL_DIR, 'build', 'gyp_nacl') gyp_chromium = join(SRC_DIR, 'build', 'gyp_chromium') + # TODO(binji): gyp_nacl doesn't build properly on Windows anymore; it only + # can use VS2010, not VS2013 which is now required by the Chromium repo. NaCl + # needs to be updated to perform the same logic as Chromium in detecting VS, + # which can now exist in the depot_tools directory. + # See https://code.google.com/p/nativeclient/issues/detail?id=4022 + # + # For now, let's use gyp_chromium to build these components. + # gyp_nacl = join(NACL_DIR, 'build', 'gyp_nacl') + gyp_nacl = gyp_chromium + nacl_core_sdk_gyp = join(NACL_DIR, 'build', 'nacl_core_sdk.gyp') all_gyp = join(NACL_DIR, 'build', 'all.gyp') breakpad_gyp = join(SRC_DIR, 'breakpad', 'breakpad.gyp') diff --git a/native_client_sdk/src/build_tools/build_sdk.py b/native_client_sdk/src/build_tools/build_sdk.py index bee0f3a..503dda1 100755 --- a/native_client_sdk/src/build_tools/build_sdk.py +++ b/native_client_sdk/src/build_tools/build_sdk.py @@ -450,7 +450,15 @@ def GypNinjaInstall(pepperdir, toolchains): def GypNinjaBuild_NaCl(rel_out_dir): - gyp_py = os.path.join(NACL_DIR, 'build', 'gyp_nacl') + # TODO(binji): gyp_nacl doesn't build properly on Windows anymore; it only + # can use VS2010, not VS2013 which is now required by the Chromium repo. NaCl + # needs to be updated to perform the same logic as Chromium in detecting VS, + # which can now exist in the depot_tools directory. + # See https://code.google.com/p/nativeclient/issues/detail?id=4022 + # + # For now, let's use gyp_chromium to build these components. +# gyp_py = os.path.join(NACL_DIR, 'build', 'gyp_nacl') + gyp_py = os.path.join(SRC_DIR, 'build', 'gyp_chromium') nacl_core_sdk_gyp = os.path.join(NACL_DIR, 'build', 'nacl_core_sdk.gyp') all_gyp = os.path.join(NACL_DIR, 'build', 'all.gyp') @@ -510,11 +518,10 @@ def GypNinjaBuild_Pnacl(rel_out_dir, target_arch): gyp_file = os.path.join(SRC_DIR, 'ppapi', 'native_client', 'src', 'untrusted', 'pnacl_irt_shim', 'pnacl_irt_shim.gyp') targets = ['aot'] - GypNinjaBuild(target_arch, gyp_py, gyp_file, targets, out_dir, False) + GypNinjaBuild(target_arch, gyp_py, gyp_file, targets, out_dir) -def GypNinjaBuild(arch, gyp_py_script, gyp_file, targets, - out_dir, force_arm_gcc=True): +def GypNinjaBuild(arch, gyp_py_script, gyp_file, targets, out_dir): gyp_env = dict(os.environ) gyp_env['GYP_GENERATORS'] = 'ninja' gyp_defines = [] @@ -523,18 +530,8 @@ def GypNinjaBuild(arch, gyp_py_script, gyp_file, targets, if arch is not None: gyp_defines.append('target_arch=%s' % arch) if arch == 'arm': - if getos.GetPlatform() == 'linux': - gyp_env['CC'] = 'arm-linux-gnueabihf-gcc' - gyp_env['CXX'] = 'arm-linux-gnueabihf-g++' - gyp_env['AR'] = 'arm-linux-gnueabihf-ar' - gyp_env['AS'] = 'arm-linux-gnueabihf-as' - gyp_env['CC_host'] = 'cc' - gyp_env['CXX_host'] = 'c++' - gyp_defines += ['clang=0', 'host_clang=0'] - gyp_defines += ['armv7=1', 'arm_thumb=0', 'arm_neon=1', - 'arm_float_abi=hard'] - if force_arm_gcc: - gyp_defines.append('nacl_enable_arm_gcc=1') + gyp_env['GYP_CROSSCOMPILE'] = '1' + gyp_defines += ['arm_float_abi=hard'] if options.no_arm_trusted: gyp_defines.append('disable_cross_trusted=1') if getos.GetPlatform() == 'mac': diff --git a/native_client_sdk/src/build_tools/buildbot_common.py b/native_client_sdk/src/build_tools/buildbot_common.py index 7fad468..d0186d5 100644 --- a/native_client_sdk/src/build_tools/buildbot_common.py +++ b/native_client_sdk/src/build_tools/buildbot_common.py @@ -58,6 +58,10 @@ def Trace(msg): def GetWindowsEnvironment(): + if oshelpers.FindExeInPath('cl.exe') is not None: + # cl.exe is already in the path, let's just use that. + return os.environ + sys.path.append(os.path.join(NACL_DIR, 'buildbot')) import buildbot_standard @@ -85,12 +89,30 @@ def GetWindowsEnvironment(): context = FakeContext() buildbot_standard.SetupWindowsEnvironment(context) - # buildbot_standard.SetupWindowsEnvironment adds the directory which contains - # vcvarsall.bat to the path, but not the directory which contains cl.exe, - # link.exe, etc. - # Running vcvarsall.bat adds the correct directories to the path, which we - # extract below. - process = subprocess.Popen('vcvarsall.bat x86 > NUL && set', + env_script = 'vcvarsall.bat' + + if not oshelpers.FindExeInPath(env_script): + # This might happen if Visual Studio is not installed. Check to see if + # vs2013 is in depot_tools. + + # Find depot_tools by looking for gclient.bat. + gclient_bat = oshelpers.FindExeInPath('gclient.bat') + if gclient_bat is None: + ErrorExit('gclient.bat is not in the path. Where is depot_tools?') + + depot_tools_dir = os.path.dirname(gclient_bat) + vs2013_dir = os.path.join(depot_tools_dir, 'win_toolchain', 'vs2013_files') + if not os.path.exists(vs2013_dir): + ErrorExit('Visual Studio not installed normally or in depot_tools.') + + # The depot_tools vs2013 toolchain has its own batch file (not + # vcvarsall.bat) for setting the environment variables needed by vs2013. + env_script = os.path.join(vs2013_dir, 'win8sdk', 'bin', 'SetEnv.cmd') + + # Running the env_script adds the correct directories to the path for + # executables (e.g. cl.exe, link.exe), include paths, lib directories, etc, + # which we extract below. + process = subprocess.Popen(env_script + ' x86 > NUL && set', stdout=subprocess.PIPE, env=context.env, shell=True) stdout, _ = process.communicate() diff --git a/native_client_sdk/src/build_tools/tests/build_artifacts_test.py b/native_client_sdk/src/build_tools/tests/build_artifacts_test.py index 9c4f756..6bc938a 100755 --- a/native_client_sdk/src/build_tools/tests/build_artifacts_test.py +++ b/native_client_sdk/src/build_tools/tests/build_artifacts_test.py @@ -181,15 +181,9 @@ class GypNinjaPosixTestCase(BasePosixTestCase): 'output_dir=out_dir'], cwd='src_dir', env={ + 'GYP_CROSSCOMPILE': '1', 'GYP_GENERATORS': 'ninja', - 'GYP_DEFINES': 'target_arch=arm armv7=1 arm_thumb=0 arm_neon=1' - ' arm_float_abi=hard nacl_enable_arm_gcc=1', - 'CC': 'arm-linux-gnueabihf-gcc', - 'CXX': 'arm-linux-gnueabihf-g++', - 'AR': 'arm-linux-gnueabihf-ar', - 'AS': 'arm-linux-gnueabihf-as', - 'CC_host': 'cc', - 'CXX_host': 'c++', + 'GYP_DEFINES': 'target_arch=arm arm_float_abi=hard', }), call(['ninja', '-C', 'out_dir/Release', 'target'], cwd='src_dir') ]) @@ -204,16 +198,10 @@ class GypNinjaPosixTestCase(BasePosixTestCase): 'output_dir=out_dir'], cwd='src_dir', env={ + 'GYP_CROSSCOMPILE': '1', 'GYP_GENERATORS': 'ninja', - 'GYP_DEFINES': 'target_arch=arm armv7=1 arm_thumb=0 arm_neon=1' - ' arm_float_abi=hard nacl_enable_arm_gcc=1' - ' disable_cross_trusted=1', - 'CC': 'arm-linux-gnueabihf-gcc', - 'CXX': 'arm-linux-gnueabihf-g++', - 'AR': 'arm-linux-gnueabihf-ar', - 'AS': 'arm-linux-gnueabihf-as', - 'CC_host': 'cc', - 'CXX_host': 'c++', + 'GYP_DEFINES': 'target_arch=arm arm_float_abi=hard ' + 'disable_cross_trusted=1', }), call(['ninja', '-C', 'out_dir/Release', 'target'], cwd='src_dir') ]) |