From b84f332d2b8985ffbc9cfc2405a90a86c39dd37f Mon Sep 17 00:00:00 2001
From: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
Date: Thu, 7 Aug 2014 19:18:06 +0200
Subject: [PATCH] <tools/gyp> Fix ninja_use_custom_environment_files

We want to use this option to prevent gyp from detecting the MSVC
toolchain by itself. We already require the environment to be setup
according to the desired toolchain for Qt, and we should respect it
when it's time to build QtWebEngine through gyp.

win_tool.py currently expects the environment.<arch> file to be
present. Fix the issue by copying in this file the whole environment
at the gyp invocation time instead of from an invocation of the
setup script when ninja_use_custom_environment_files isn't used.

Change-Id: Iade4c488e1af5cab8306e9070c73d42ec67a955a
Reviewed-by: Andras Becsi <andras.becsi@digia.com>
---
 chromium/tools/gyp/pylib/gyp/msvs_emulation.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/chromium/tools/gyp/pylib/gyp/msvs_emulation.py b/chromium/tools/gyp/pylib/gyp/msvs_emulation.py
index 63593a424d8..2ee6cd2e048 100644
--- a/chromium/tools/gyp/pylib/gyp/msvs_emulation.py
+++ b/chromium/tools/gyp/pylib/gyp/msvs_emulation.py
@@ -917,6 +917,10 @@ def GenerateEnvironmentFiles(toplevel_build_dir, generator_flags, open_out):
     cl_paths = {}
     for arch in archs:
       cl_paths[arch] = 'cl.exe'
+      env_block = _FormatAsEnvironmentBlock(os.environ)
+      f = open_out(os.path.join(toplevel_build_dir, 'environment.' + arch), 'wb')
+      f.write(env_block)
+      f.close()
     return cl_paths
   vs = GetVSVersion(generator_flags)
   cl_paths = {}
-- 
GitLab