commit:     c42a36956f512554fb0992cf4fe2ac34e47de3cd
Author:     Yiyang Wu <xgreenlandforwyy <AT> gmail <DOT> com>
AuthorDate: Wed Jun 15 06:48:50 2022 +0000
Commit:     Benda XU <heroxbd <AT> gentoo <DOT> org>
CommitDate: Sat Aug  6 14:20:20 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c42a3695

dev-libs/rocm-device-libs: add 5.1.3

Drop llvm-roc dependency, depend on vanilla clang.
Correct bitcode path in test for unpatched clang.

Signed-off-by: Yiyang Wu <xgreenlandforwyy <AT> gmail.com>
Signed-off-by: Benda Xu <heroxbd <AT> gentoo.org>

 dev-libs/rocm-device-libs/Manifest                 |  1 +
 .../files/rocm-device-libs-5.1.3-llvm-link.patch   | 13 ++++++
 .../rocm-device-libs-5.1.3-test-bitcode-dir.patch  | 24 +++++++++++
 .../rocm-device-libs/rocm-device-libs-5.1.3.ebuild | 47 ++++++++++++++++++++++
 4 files changed, 85 insertions(+)

diff --git a/dev-libs/rocm-device-libs/Manifest 
b/dev-libs/rocm-device-libs/Manifest
index caad548c25f9..b9dc17091c0c 100644
--- a/dev-libs/rocm-device-libs/Manifest
+++ b/dev-libs/rocm-device-libs/Manifest
@@ -8,3 +8,4 @@ DIST rocm-device-libs-4.2.0.tar.gz 231971 BLAKE2B 
292798ec29b6feb268928a41d7a321
 DIST rocm-device-libs-4.3.0.tar.gz 234910 BLAKE2B 
af306219df395f9c5e65e6e06dff976698b80009d3b0c330c396c3e9475dca124bee4c96ff31724763bf40b3fd611f1ef55a7fb675f5ef82b992e496bc3a2d6d
 SHA512 
6e93b435d782a50f45d17bafb466ee05df88c39d665a8d796b68d588b6074629934c44afaae233fc84a238dc9c93d15917efeec7633349b4e894f3b3385bf57e
 DIST rocm-device-libs-4.5.2.tar.gz 244532 BLAKE2B 
fd13f3e518dc0922bb4e2a49863e3b86238158431189f4d4e9665f7e7b1adfa78ca96d915a3737b0da476cfbffcf0a0ad8840349a22062f59a83f59bc9edd05a
 SHA512 
5da2efd685c279ebb1bf67e27e1a8febb20dcdcf33136667b9bf2ca0d3684b366237358269a0c221dd602af37503aa766842cd1932b2711b562c1fc94cd2ae70
 DIST rocm-device-libs-5.0.2.tar.gz 242099 BLAKE2B 
3fc2afc3a837557da04bcd5673656c08d0b5ebf48fd6568a4b1687d157dc4b08e3b5cd219a7bf3c2ed82ca1391477c32c42b4e594d07ad47ef429061be351af9
 SHA512 
1c37401641080e511f325cddb62490c8827d1bcef7f2198449246afbd391162ed3294c24b0529e1b3669129e29544989e2cf12d46c90fea8d880c52cfdca5a72
+DIST rocm-device-libs-5.1.3.tar.gz 242862 BLAKE2B 
68d66de897f461e9f876de5fe2214803d4c00665651dea6af0952f0ce579c6704a5ec41b08971fa613ade309a0a85cb611b56b592dc2a25e247183e634ea3378
 SHA512 
cc3dfb8d4b4841ba777355c537175259d0019159ff462358320674b85082cccd99f6462f60fee66228ddfb88fade043445c1bac62504aa1462ba61b7e2751de7

diff --git 
a/dev-libs/rocm-device-libs/files/rocm-device-libs-5.1.3-llvm-link.patch 
b/dev-libs/rocm-device-libs/files/rocm-device-libs-5.1.3-llvm-link.patch
new file mode 100644
index 000000000000..9e6dc38921e2
--- /dev/null
+++ b/dev-libs/rocm-device-libs/files/rocm-device-libs-5.1.3-llvm-link.patch
@@ -0,0 +1,13 @@
+https://bugs.gentoo.org/851702#c4
+Adapt to libLLVM.so instead of the seperated libs
+===================================================================
+--- ROCm-Device-Libs-rocm-5.0.2.orig/utils/prepare-builtins/CMakeLists.txt
++++ ROCm-Device-Libs-rocm-5.0.2/utils/prepare-builtins/CMakeLists.txt
+@@ -26,5 +26,5 @@ set_target_properties(prepare-builtins P
+   CXX_STANDARD_REQUIRED Yes
+   CXX_EXTENSIONS No)
+ llvm_update_compile_flags(prepare-builtins)
+-llvm_map_components_to_libnames(llvm_libs support core bitreader bitwriter)
+-target_link_libraries(prepare-builtins ${llvm_libs})
++llvm_map_components_to_libnames(llvm_libs support)
++target_link_libraries(prepare-builtins ${llvm_libs} LLVM)

diff --git 
a/dev-libs/rocm-device-libs/files/rocm-device-libs-5.1.3-test-bitcode-dir.patch 
b/dev-libs/rocm-device-libs/files/rocm-device-libs-5.1.3-test-bitcode-dir.patch
new file mode 100644
index 000000000000..9047f8ef90e5
--- /dev/null
+++ 
b/dev-libs/rocm-device-libs/files/rocm-device-libs-5.1.3-test-bitcode-dir.patch
@@ -0,0 +1,24 @@
+lib/amdgcn/bitcode is not among the default bitcode dirs of clang
+Add --rocm-device-lib-path to the clang argument
+Excerpt from 
https://salsa.debian.org/rocm-team/rocm-device-libs/-/blob/d2014eed680ccce5f9bd61ff4fc28a89682575f3/debian/patches/cmake-amdgcn-bitcode.patch
+==============================================
+--- rocm-device-libs.orig/test/constant_folding/RunConstantFoldTest.cmake
++++ rocm-device-libs/test/constant_folding/RunConstantFoldTest.cmake
+@@ -16,6 +16,7 @@
+   -target amdgcn-amd-amdhsa -mcpu=${TEST_CPU}
+   -Xclang -finclude-default-header
+   --rocm-path=${BINARY_DIR}
++  --rocm-device-lib-path=${AMDGCN_BITCODES}
+   -mllvm -amdgpu-simplify-libcall=0
+   -o ${OUTPUT_FILE} ${INPUT_FILE}
+   RESULT_VARIABLE CLANG_RESULT
+--- rocm-device-libs.orig/test/constant_folding/CMakeLists.txt
++++ rocm-device-libs/test/constant_folding/CMakeLists.txt
+@@ -30,6 +30,7 @@
+      -DFILECHECK_BIN=${FILECHECK_BIN}
+      -DOUTPUT_FILE=output.${name}.ll
+      -DINPUT_FILE=${CMAKE_CURRENT_SOURCE_DIR}/${name}.cl
++     -DAMDGCN_BITCODES=${PROJECT_BINARY_DIR}/lib/amdgcn/bitcode
+      -DTEST_CPU=gfx900
+      -P ${CMAKE_CURRENT_SOURCE_DIR}/RunConstantFoldTest.cmake)
+ endfunction()

diff --git a/dev-libs/rocm-device-libs/rocm-device-libs-5.1.3.ebuild 
b/dev-libs/rocm-device-libs/rocm-device-libs-5.1.3.ebuild
new file mode 100644
index 000000000000..61871fbface9
--- /dev/null
+++ b/dev-libs/rocm-device-libs/rocm-device-libs-5.1.3.ebuild
@@ -0,0 +1,47 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit cmake llvm
+
+LLVM_MAX_SLOT=14
+
+if [[ ${PV} == *9999 ]] ; then
+       EGIT_REPO_URI="https://github.com/RadeonOpenCompute/ROCm-Device-Libs/";
+       inherit git-r3
+       S="${WORKDIR}/${P}/src"
+else
+       
SRC_URI="https://github.com/RadeonOpenCompute/ROCm-Device-Libs/archive/rocm-${PV}.tar.gz
 -> ${P}.tar.gz"
+       S="${WORKDIR}/ROCm-Device-Libs-rocm-${PV}"
+       KEYWORDS="~amd64"
+fi
+
+DESCRIPTION="Radeon Open Compute Device Libraries"
+HOMEPAGE="https://github.com/RadeonOpenCompute/ROCm-Device-Libs";
+
+LICENSE="MIT"
+SLOT="0/$(ver_cut 1-2)"
+IUSE="test"
+RESTRICT="!test? ( test )"
+
+RDEPEND="sys-devel/clang:${LLVM_MAX_SLOT}"
+DEPEND="${RDEPEND}"
+
+CMAKE_BUILD_TYPE=Release
+
+PATCHES=( "${FILESDIR}/${PN}-5.1.3-test-bitcode-dir.patch"
+       "${FILESDIR}/${PN}-5.1.3-llvm-link.patch" )
+
+src_prepare() {
+       sed -e "s:amdgcn/bitcode:lib/amdgcn/bitcode:" -i "${S}/cmake/OCL.cmake" 
|| die
+       sed -e "s:amdgcn/bitcode:lib/amdgcn/bitcode:" -i 
"${S}/cmake/Packages.cmake" || die
+       cmake_src_prepare
+}
+
+src_configure() {
+       local mycmakeargs=(
+               -DLLVM_DIR="$(get_llvm_prefix "${LLVM_MAX_SLOT}")"
+       )
+       cmake_src_configure
+}

Reply via email to