diff options
Diffstat (limited to 'sys-devel/clang/files/9999/prefix-dirs.patch')
-rw-r--r-- | sys-devel/clang/files/9999/prefix-dirs.patch | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/sys-devel/clang/files/9999/prefix-dirs.patch b/sys-devel/clang/files/9999/prefix-dirs.patch new file mode 100644 index 000000000000..d8d79b8fb513 --- /dev/null +++ b/sys-devel/clang/files/9999/prefix-dirs.patch @@ -0,0 +1,72 @@ +This mirrors cmake-*-prefix-dirs.patch + +It add EPREFIX to search paths for c/cxx headers. +It also adds EPREFIX/MacOSX.sdk to search paths for c and Frameworks. +Assumes that c++ lib and headers will be installed in the prefix. + +Also, a couple of args are populated by inspecting the SDK, +so, default to EPREFIX/MacOSX.sdk when the sysroot is not specified. +(This does NOT set sysroot). + +--- a/clang/lib/Frontend/InitHeaderSearch.cpp 2020-11-30 12:53:42.000000000 -0600 ++++ b/clang/lib/Frontend/InitHeaderSearch.cpp 2020-11-30 13:57:52.000000000 -0600 +@@ -445,6 +445,9 @@ + // All header search logic is handled in the Driver for Darwin. + if (triple.isOSDarwin()) { + if (HSOpts.UseStandardSystemIncludes) { ++ // Add Gentoo Prefix framework dirs first ++ AddPath("@GENTOO_PORTAGE_EPREFIX@/MacOSX.sdk/System/Library/Frameworks", System, true); ++ AddPath("@GENTOO_PORTAGE_EPREFIX@/MacOSX.sdk/Library/Frameworks", System, true); + // Add the default framework include paths on Darwin. + AddPath("/System/Library/Frameworks", System, true); + AddPath("/Library/Frameworks", System, true); +--- a/clang/lib/Driver/ToolChains/Darwin.cpp 2020-10-07 05:10:48.000000000 -0500 ++++ b/clang/lib/Driver/ToolChains/Darwin.cpp 2020-11-30 12:57:15.000000000 -0600 +@@ -1737,9 +1737,9 @@ + const ArgList &Args, + const Driver &TheDriver) { + const Arg *A = Args.getLastArg(options::OPT_isysroot); +- if (!A) +- return None; +- StringRef isysroot = A->getValue(); ++ //if (!A) ++ // return None; ++ StringRef isysroot = A ? A->getValue() : "@GENTOO_PORTAGE_EPREFIX@/MacOSX.sdk"; + auto SDKInfoOrErr = driver::parseDarwinSDKInfo(VFS, isysroot); + if (!SDKInfoOrErr) { + llvm::consumeError(SDKInfoOrErr.takeError()); +@@ -1921,13 +1921,14 @@ + return DriverArgs.getLastArgValue(options::OPT_isysroot); + if (!getDriver().SysRoot.empty()) + return getDriver().SysRoot; +- return "/"; ++ return "@GENTOO_PORTAGE_EPREFIX@/"; + } + + void DarwinClang::AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs, + llvm::opt::ArgStringList &CC1Args) const { + const Driver &D = getDriver(); + ++ // Sysroot is effectively Gentoo EPREFIX when -isysroot/-sysroot is not defined + llvm::StringRef Sysroot = GetHeaderSysroot(DriverArgs); + + bool NoStdInc = DriverArgs.hasArg(options::OPT_nostdinc); +@@ -1969,6 +1970,10 @@ + SmallString<128> P(Sysroot); + llvm::sys::path::append(P, "usr", "include"); + addExternCSystemInclude(DriverArgs, CC1Args, P.str()); ++ // And add <sysroot>/MacOSX.sdk/usr/include. ++ SmallString<128> Psdk(Sysroot); ++ llvm::sys::path::append(Psdk, "MacOSX.sdk", "usr", "include"); ++ addExternCSystemInclude(DriverArgs, CC1Args, Psdk.str()); + } + } + +@@ -2017,6 +2022,7 @@ + DriverArgs.hasArg(options::OPT_nostdincxx)) + return; + ++ // Sysroot is effectively Gentoo EPREFIX when -isysroot/-sysroot is not defined + llvm::StringRef Sysroot = GetHeaderSysroot(DriverArgs); + + switch (GetCXXStdlibType(DriverArgs)) { |