summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenda Xu <heroxbd@gentoo.org>2020-12-24 00:49:50 +0800
committerBenda Xu <heroxbd@gentoo.org>2020-12-27 09:55:25 +0800
commita3ecb54a88984f4549cffe7d5ba039ef2eebd928 (patch)
tree7d395b2f6aea91a50f320457b3679362577f34af /sys-devel/llvm-roc
parentnet-misc/youtube-dl: Stabilize 2020.12.22 ALLARCHES, #761790 (diff)
downloadgentoo-a3ecb54a88984f4549cffe7d5ba039ef2eebd928.tar.gz
gentoo-a3ecb54a88984f4549cffe7d5ba039ef2eebd928.tar.bz2
gentoo-a3ecb54a88984f4549cffe7d5ba039ef2eebd928.zip
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@gmail.com> Package-Manager: Portage-3.0.12, Repoman-3.0.1 Signed-off-by: Benda Xu <heroxbd@gentoo.org>
Diffstat (limited to 'sys-devel/llvm-roc')
-rw-r--r--sys-devel/llvm-roc/llvm-roc-4.0.0.ebuild21
1 files changed, 21 insertions, 0 deletions
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 2d3f39394110..64b2abf582b3 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
}