diff options
author | fergus.henderson <fergushenderson@users.noreply.github.com> | 2008-12-22 21:56:57 +0000 |
---|---|---|
committer | fergus.henderson <fergushenderson@users.noreply.github.com> | 2008-12-22 21:56:57 +0000 |
commit | c9f15d13f44194fd56ef57dd55715c2b749d3adb (patch) | |
tree | 9fc3f3716ab9695eb39756b0906e08d8d9a05336 /include_server | |
parent | a4e3449536b0425225727198d791900f1b5e17a9 (diff) | |
download | distcc-git-c9f15d13f44194fd56ef57dd55715c2b749d3adb.tar.gz |
When computing the compiler's default search path by parsing the output
from "gcc -v", ignore Apple-modified MacOS gcc's "framework" directories.
Diffstat (limited to 'include_server')
-rwxr-xr-x | include_server/compiler_defaults.py | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/include_server/compiler_defaults.py b/include_server/compiler_defaults.py index c174e3b..cc716f8 100755 --- a/include_server/compiler_defaults.py +++ b/include_server/compiler_defaults.py @@ -236,8 +236,26 @@ def _SystemSearchdirsGCC(compiler, language, canonical_lookup): + "couldn't parse output of '%s'.\nReceived:\n%s") % (compiler, language, command, out)) return [ canonical_lookup(directory) - for directory in match_obj.group(1).split() ] - + for line in match_obj.group(1).split("\n") + for directory in line.split() + # Ignore Apple-modified MacOS gcc's "framework" directories. + if not line.endswith(" (framework directory)") + ] + # TODO: Rather than just ignoring framework directories, we + # should handle them properly, fully emulating the search + # algorithm used by Apple's modified GCC. + # The search algorithm used for framework directories is not very + # well documented, as far as I can tell, but the source code is in + # gcc/config/darwin-c.c in the Apple GCC sources. + # From a quick glance, I think it looks like this: + # - For each #include of the form Foo/bar.h, + # For each framework directory Baz, + # Look in Baz/Foo.framework/Headers/bar.h + # and in Baz/Foo.framework/PrivateHeaders/bar.h + # - If the regular search fails, look for subframeworks. + # For each #include of the form Foo/bar.h + # from Baz/Quux.framework/Headers/whatever.h + # Look in Baz/Quux.framework/Frameworks/Foo/Headers/bar.h. class CompilerDefaults(object): """Records and caches the default search dirs and creates symlink farm. |