diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2018-04-23 11:14:22 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2018-10-11 15:30:31 +0000 |
commit | ec709675476e507ea094348091b0475084de976e (patch) | |
tree | 3237bc59607727fa19cf8f77292d1e58d60cffa0 /share/qbs/modules/cpp | |
parent | 2aa6d255a5d585266ec9cc4b8d619516a5dc12ba (diff) |
cpp module: Work around distcc quirk
Apparently, the distcc tool requires its argument to be a pure file name
rather than a full file path.
Task-number: QBS-1336
Change-Id: I6de8ee2f8fa341929a0f1057cbb491a15ec0446b
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'share/qbs/modules/cpp')
-rw-r--r-- | share/qbs/modules/cpp/gcc.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/share/qbs/modules/cpp/gcc.js b/share/qbs/modules/cpp/gcc.js index ff7867b25..7e25fa402 100644 --- a/share/qbs/modules/cpp/gcc.js +++ b/share/qbs/modules/cpp/gcc.js @@ -1044,7 +1044,25 @@ function prepareCompiler(project, product, inputs, outputs, input, output, expli var args = compilerFlags(project, product, input, output, explicitlyDependsOn); var wrapperArgsLength = 0; var wrapperArgs = product.cpp.compilerWrapper; + var extraEnv; if (wrapperArgs && wrapperArgs.length > 0) { + + // distcc cannot deal with absolute compiler paths (QBS-1336). + for (var i = 0; i < wrapperArgs.length; ++i) { + if (FileInfo.baseName(wrapperArgs[i]) !== "distcc") + continue; + if (i === wrapperArgs.length - 1) { + if (FileInfo.isAbsolutePath(compilerPath)) { + extraEnv = ["PATH=" + FileInfo.path(compilerPath)]; + compilerPath = FileInfo.fileName(compilerPath); + } + } else if (FileInfo.isAbsolutePath(wrapperArgs[i + 1])) { + extraEnv = ["PATH=" + FileInfo.path(FileInfo.path(wrapperArgs[i + 1]))]; + wrapperArgs[i + 1] = FileInfo.fileName(wrapperArgs[i + 1]); + } + break; + } + wrapperArgsLength = wrapperArgs.length; args.unshift(compilerPath); compilerPath = wrapperArgs.shift(); @@ -1058,6 +1076,8 @@ function prepareCompiler(project, product, inputs, outputs, input, output, expli cmd.highlight = "compiler"; cmd.jobPool = "compiler"; cmd.relevantEnvironmentVariables = compilerEnvVars(input, compilerInfo); + if (extraEnv) + cmd.environment = extraEnv; cmd.responseFileArgumentIndex = wrapperArgsLength; cmd.responseFileUsagePrefix = '@'; setResponseFileThreshold(cmd, product); |