From: "Fabian Groffen" <grobian@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-devel/clang/files/9999/, sys-devel/clang/
Date: Sun, 27 Dec 2020 09:50:52 +0000 (UTC) [thread overview]
Message-ID: <1609062572.1b2b62e093d789f6b1a4609c866581991e287b88.grobian@gentoo> (raw)
commit: 1b2b62e093d789f6b1a4609c866581991e287b88
Author: Jacob Floyd <cognifloyd <AT> gmail <DOT> com>
AuthorDate: Sat Dec 19 00:53:24 2020 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sun Dec 27 09:49:32 2020 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1b2b62e0
sys-devel/clang: fix bootstrap on darwin prefix
Adjust the clang internal header/framework search paths when building on
darwin prefix. We symlink the selected MacOSX.sdk to EPREFIX/MacOSX.sdk
during bootstrap, so that is the correct place to get system headers,
such as those for libc, or for system framework headers, that we do not
replace in prefix.
Bug: https://bugs.gentoo.org/758167
Signed-off-by: Jacob Floyd <cognifloyd <AT> gmail.com>
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
sys-devel/clang/clang-11.0.0.ebuild | 13 ++++-
sys-devel/clang/clang-11.0.1.9999.ebuild | 11 +++-
sys-devel/clang/clang-11.0.1_rc1.ebuild | 11 +++-
sys-devel/clang/clang-11.0.1_rc2.ebuild | 11 +++-
sys-devel/clang/clang-12.0.0.9999.ebuild | 11 +++-
sys-devel/clang/files/9999/prefix-dirs.patch | 75 ++++++++++++++++++++++++++++
6 files changed, 126 insertions(+), 6 deletions(-)
diff --git a/sys-devel/clang/clang-11.0.0.ebuild b/sys-devel/clang/clang-11.0.0.ebuild
index cf0dde1f160..1d4f4bad16c 100644
--- a/sys-devel/clang/clang-11.0.0.ebuild
+++ b/sys-devel/clang/clang-11.0.0.ebuild
@@ -5,7 +5,7 @@ EAPI=7
PYTHON_COMPAT=( python3_{6..9} )
inherit cmake llvm llvm.org multilib-minimal pax-utils \
- python-single-r1 toolchain-funcs
+ prefix python-single-r1 toolchain-funcs
DESCRIPTION="C language family frontend for LLVM"
HOMEPAGE="https://llvm.org/"
@@ -30,7 +30,7 @@ ALL_LLVM_TARGETS=( "${ALL_LLVM_TARGETS[@]/#/llvm_targets_}" )
LICENSE="Apache-2.0-with-LLVM-exceptions UoI-NCSA MIT"
SLOT="$(ver_cut 1)"
-KEYWORDS="amd64 arm arm64 ppc64 ~riscv x86 ~amd64-linux"
+KEYWORDS="amd64 arm arm64 ppc64 ~riscv x86 ~amd64-linux ~x64-macos"
IUSE="debug default-compiler-rt default-libcxx default-lld
doc +static-analyzer test xml kernel_FreeBSD ${ALL_LLVM_TARGETS[*]}"
REQUIRED_USE="${PYTHON_REQUIRED_USE}
@@ -75,6 +75,10 @@ PDEPEND="
# Therefore: use sys-devel/clang[${MULTILIB_USEDEP}] only if you need
# multilib clang* libraries (not runtime, not wrappers).
+PATCHES=(
+ "${FILESDIR}"/9999/prefix-dirs.patch
+)
+
pkg_setup() {
LLVM_MAX_SLOT=${SLOT} llvm_pkg_setup
python-single-r1_pkg_setup
@@ -88,6 +92,11 @@ src_prepare() {
llvm.org_src_prepare
mv ../clang-tools-extra tools/extra || die
+
+ # add Gentoo Portage Prefix for Darwin (see prefix-dirs.patch)
+ eprefixify \
+ lib/Frontend/InitHeaderSearch.cpp \
+ lib/Driver/ToolChains/Darwin.cpp || die
}
check_distribution_components() {
diff --git a/sys-devel/clang/clang-11.0.1.9999.ebuild b/sys-devel/clang/clang-11.0.1.9999.ebuild
index 4a3a05b4df8..c5362450b51 100644
--- a/sys-devel/clang/clang-11.0.1.9999.ebuild
+++ b/sys-devel/clang/clang-11.0.1.9999.ebuild
@@ -5,7 +5,7 @@ EAPI=7
PYTHON_COMPAT=( python3_{6..9} )
inherit cmake llvm llvm.org multilib-minimal pax-utils \
- python-single-r1 toolchain-funcs
+ prefix python-single-r1 toolchain-funcs
DESCRIPTION="C language family frontend for LLVM"
HOMEPAGE="https://llvm.org/"
@@ -77,6 +77,10 @@ llvm.org_set_globals
# Therefore: use sys-devel/clang[${MULTILIB_USEDEP}] only if you need
# multilib clang* libraries (not runtime, not wrappers).
+PATCHES=(
+ "${FILESDIR}"/9999/prefix-dirs.patch
+)
+
pkg_setup() {
LLVM_MAX_SLOT=${SLOT} llvm_pkg_setup
python-single-r1_pkg_setup
@@ -90,6 +94,11 @@ src_prepare() {
llvm.org_src_prepare
mv ../clang-tools-extra tools/extra || die
+
+ # add Gentoo Portage Prefix for Darwin (see prefix-dirs.patch)
+ eprefixify \
+ lib/Frontend/InitHeaderSearch.cpp \
+ lib/Driver/ToolChains/Darwin.cpp || die
}
check_distribution_components() {
diff --git a/sys-devel/clang/clang-11.0.1_rc1.ebuild b/sys-devel/clang/clang-11.0.1_rc1.ebuild
index 4a3a05b4df8..c5362450b51 100644
--- a/sys-devel/clang/clang-11.0.1_rc1.ebuild
+++ b/sys-devel/clang/clang-11.0.1_rc1.ebuild
@@ -5,7 +5,7 @@ EAPI=7
PYTHON_COMPAT=( python3_{6..9} )
inherit cmake llvm llvm.org multilib-minimal pax-utils \
- python-single-r1 toolchain-funcs
+ prefix python-single-r1 toolchain-funcs
DESCRIPTION="C language family frontend for LLVM"
HOMEPAGE="https://llvm.org/"
@@ -77,6 +77,10 @@ llvm.org_set_globals
# Therefore: use sys-devel/clang[${MULTILIB_USEDEP}] only if you need
# multilib clang* libraries (not runtime, not wrappers).
+PATCHES=(
+ "${FILESDIR}"/9999/prefix-dirs.patch
+)
+
pkg_setup() {
LLVM_MAX_SLOT=${SLOT} llvm_pkg_setup
python-single-r1_pkg_setup
@@ -90,6 +94,11 @@ src_prepare() {
llvm.org_src_prepare
mv ../clang-tools-extra tools/extra || die
+
+ # add Gentoo Portage Prefix for Darwin (see prefix-dirs.patch)
+ eprefixify \
+ lib/Frontend/InitHeaderSearch.cpp \
+ lib/Driver/ToolChains/Darwin.cpp || die
}
check_distribution_components() {
diff --git a/sys-devel/clang/clang-11.0.1_rc2.ebuild b/sys-devel/clang/clang-11.0.1_rc2.ebuild
index 4a3a05b4df8..c5362450b51 100644
--- a/sys-devel/clang/clang-11.0.1_rc2.ebuild
+++ b/sys-devel/clang/clang-11.0.1_rc2.ebuild
@@ -5,7 +5,7 @@ EAPI=7
PYTHON_COMPAT=( python3_{6..9} )
inherit cmake llvm llvm.org multilib-minimal pax-utils \
- python-single-r1 toolchain-funcs
+ prefix python-single-r1 toolchain-funcs
DESCRIPTION="C language family frontend for LLVM"
HOMEPAGE="https://llvm.org/"
@@ -77,6 +77,10 @@ llvm.org_set_globals
# Therefore: use sys-devel/clang[${MULTILIB_USEDEP}] only if you need
# multilib clang* libraries (not runtime, not wrappers).
+PATCHES=(
+ "${FILESDIR}"/9999/prefix-dirs.patch
+)
+
pkg_setup() {
LLVM_MAX_SLOT=${SLOT} llvm_pkg_setup
python-single-r1_pkg_setup
@@ -90,6 +94,11 @@ src_prepare() {
llvm.org_src_prepare
mv ../clang-tools-extra tools/extra || die
+
+ # add Gentoo Portage Prefix for Darwin (see prefix-dirs.patch)
+ eprefixify \
+ lib/Frontend/InitHeaderSearch.cpp \
+ lib/Driver/ToolChains/Darwin.cpp || die
}
check_distribution_components() {
diff --git a/sys-devel/clang/clang-12.0.0.9999.ebuild b/sys-devel/clang/clang-12.0.0.9999.ebuild
index e5da1c5cedb..8ebb9ceea5e 100644
--- a/sys-devel/clang/clang-12.0.0.9999.ebuild
+++ b/sys-devel/clang/clang-12.0.0.9999.ebuild
@@ -5,7 +5,7 @@ EAPI=7
PYTHON_COMPAT=( python3_{6..9} )
inherit cmake llvm llvm.org multilib-minimal pax-utils \
- python-single-r1 toolchain-funcs
+ prefix python-single-r1 toolchain-funcs
DESCRIPTION="C language family frontend for LLVM"
HOMEPAGE="https://llvm.org/"
@@ -77,6 +77,10 @@ llvm.org_set_globals
# Therefore: use sys-devel/clang[${MULTILIB_USEDEP}] only if you need
# multilib clang* libraries (not runtime, not wrappers).
+PATCHES=(
+ "${FILESDIR}"/9999/prefix-dirs.patch
+)
+
pkg_setup() {
LLVM_MAX_SLOT=${SLOT} llvm_pkg_setup
python-single-r1_pkg_setup
@@ -88,6 +92,11 @@ src_prepare() {
BUILD_DIR=${WORKDIR}/x/y/clang
llvm.org_src_prepare
+
+ # add Gentoo Portage Prefix for Darwin (see prefix-dirs.patch)
+ eprefixify \
+ lib/Frontend/InitHeaderSearch.cpp \
+ lib/Driver/ToolChains/Darwin.cpp || die
}
check_distribution_components() {
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 00000000000..0f7b5ca31eb
--- /dev/null
+++ b/sys-devel/clang/files/9999/prefix-dirs.patch
@@ -0,0 +1,75 @@
+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).
+
+The ebuild adds an extra / at the end of EPREFIX so that it is never
+an empty string.
+
+--- 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)) {
next reply other threads:[~2020-12-27 9:50 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-27 9:50 Fabian Groffen [this message]
-- strict thread matches above, loose matches on Subject: below --
2017-08-29 6:06 [gentoo-commits] repo/gentoo:master commit in: sys-devel/clang/files/9999/, sys-devel/clang/ Michał Górny
2016-11-01 0:41 Michał Górny
2016-10-04 6:41 Michał Górny
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1609062572.1b2b62e093d789f6b1a4609c866581991e287b88.grobian@gentoo \
--to=grobian@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox