commit: a3ecb54a88984f4549cffe7d5ba039ef2eebd928
Author: Benda Xu <heroxbd <AT> gentoo <DOT> org>
AuthorDate: Wed Dec 23 16:49:50 2020 +0000
Commit: Benda XU <heroxbd <AT> gentoo <DOT> org>
CommitDate: Sun Dec 27 01:55:25 2020 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a3ecb54a
sys-devel/llvm-roc: add support for Prefix.
The logic is modeled after
profiles/features/prefix/standalone/profile.bashrc.
With the location of hip changed to /usr/lib/hip, let clang of
llvm-roc look for EPREFIX/usr/lib/hip instead of vendor /opt/rocm.
Suggested-by: Yiyang Wu <xgreenlandforwyy <AT> gmail.com>
Package-Manager: Portage-3.0.12, Repoman-3.0.1
Signed-off-by: Benda Xu <heroxbd <AT> gentoo.org>
sys-devel/llvm-roc/llvm-roc-4.0.0.ebuild | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/sys-devel/llvm-roc/llvm-roc-4.0.0.ebuild
b/sys-devel/llvm-roc/llvm-roc-4.0.0.ebuild
index 2d3f3939411..64b2abf582b 100644
--- a/sys-devel/llvm-roc/llvm-roc-4.0.0.ebuild
+++ b/sys-devel/llvm-roc/llvm-roc-4.0.0.ebuild
@@ -33,6 +33,27 @@ CMAKE_BUILD_TYPE=RelWithDebInfo
src_prepare() {
cd "${WORKDIR}/llvm-project-rocm-${PV}" || die
eapply "${FILESDIR}/${PN}-3.0.0-add_libraries.patch"
+
+ if [[ -n ${EPREFIX} ]]; then
+ pushd "${S}"/../clang >/dev/null || die
+ sed -i -e "s@DEFAULT_SYSROOT \"\"@DEFAULT_SYSROOT
\"${EPREFIX}\"@" CMakeLists.txt
+ eend $?
+
+ ebegin "Use ${EPREFIX} as default sysroot"
+ cd lib/Driver/ToolChains >/dev/null || die
+ ebegin "Use dynamic linker from ${EPREFIX}"
+ sed -i -e "/LibDir.*Loader/s@return \"\/\"@return
\"${EPREFIX%/}/\"@" Linux.cpp
+ eend $?
+
+ ebegin "Remove --sysroot call on ld for native toolchain"
+ sed -i -e "$(grep -n -B1 sysroot= Gnu.cpp | sed -ne
'{1s/-.*//;1p}'),+1 d" Gnu.cpp
+ eend $?
+ popd >/dev/null || die
+ fi
+
+ sed -e 's:/opt/rocm:/usr/lib/hip:' \
+ -i "${S}"/../clang/lib/Driver/ToolChains/AMDGPU.cpp
+
eapply_user
cmake_src_prepare
}