Gentoo Archives: gentoo-commits

From: Benda XU <heroxbd@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sci-libs/rocThrust/
Date: Mon, 24 Jan 2022 11:17:17
Message-Id: 1643022524.b4e8b1a1b30030971c2f7979e2dfce00304e464b.heroxbd@gentoo
1 commit: b4e8b1a1b30030971c2f7979e2dfce00304e464b
2 Author: Benda Xu <heroxbd <AT> gentoo <DOT> org>
3 AuthorDate: Mon Jan 24 11:06:32 2022 +0000
4 Commit: Benda XU <heroxbd <AT> gentoo <DOT> org>
5 CommitDate: Mon Jan 24 11:08:44 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b4e8b1a1
7
8 sci-libs/rocThrust: strip PN from the include path.
9
10 Package-Manager: Portage-3.0.30, Repoman-3.0.3
11 Signed-off-by: Benda Xu <heroxbd <AT> gentoo.org>
12
13 sci-libs/rocThrust/rocThrust-4.3.0-r1.ebuild | 76 ++++++++++++++++++++++++++++
14 1 file changed, 76 insertions(+)
15
16 diff --git a/sci-libs/rocThrust/rocThrust-4.3.0-r1.ebuild b/sci-libs/rocThrust/rocThrust-4.3.0-r1.ebuild
17 new file mode 100644
18 index 000000000000..fc6045bf31f2
19 --- /dev/null
20 +++ b/sci-libs/rocThrust/rocThrust-4.3.0-r1.ebuild
21 @@ -0,0 +1,76 @@
22 +# Copyright 1999-2022 Gentoo Authors
23 +# Distributed under the terms of the GNU General Public License v2
24 +
25 +EAPI=7
26 +
27 +inherit cmake
28 +
29 +DESCRIPTION="HIP back-end for the parallel algorithm library Thrust"
30 +HOMEPAGE="https://github.com/ROCmSoftwarePlatform/rocThrust"
31 +SRC_URI="https://github.com/ROCmSoftwarePlatform/rocThrust/archive/rocm-${PV}.tar.gz -> rocThrust-${PV}.tar.gz"
32 +
33 +LICENSE="Apache-2.0"
34 +KEYWORDS="~amd64"
35 +SLOT="0/$(ver_cut 1-2)"
36 +IUSE="benchmark test"
37 +
38 +RESTRICT="!test? ( test )"
39 +
40 +RDEPEND="dev-util/hip:${SLOT}
41 + sci-libs/rocPRIM:${SLOT}"
42 +DEPEND="${RDEPEND}"
43 +
44 +S="${WORKDIR}/rocThrust-rocm-${PV}"
45 +
46 +PATCHES=( "${FILESDIR}/${PN}-4.0-operator_new.patch"
47 + "${FILESDIR}/${P}-deprecate-hcc_detail.patch" )
48 +
49 +src_prepare() {
50 + sed -e "/PREFIX rocthrust/d" \
51 + -e "/DESTINATION/s:rocthrust/include/thrust:include/thrust:" \
52 + -e "/rocm_install_symlink_subdir(rocthrust)/d" \
53 + -e "/<INSTALL_INTERFACE/s:rocthrust/include/:include/:" -i thrust/CMakeLists.txt || die
54 +
55 + sed -e "s:\${CMAKE_INSTALL_INCLUDEDIR}:&/rocthrust:" \
56 + -e "s:\${ROCM_INSTALL_LIBDIR}:\${CMAKE_INSTALL_LIBDIR}:" -i cmake/ROCMExportTargetsHeaderOnly.cmake || die
57 +
58 + # disable downloading googletest and googlebenchmark
59 + sed -r -e '/Downloading/{:a;N;/\n *\)$/!ba; d}' -i cmake/Dependencies.cmake || die
60 +
61 + # remove GIT dependency
62 + sed -r -e '/find_package\(Git/{:a;N;/\nendif/!ba; d}' -i cmake/Dependencies.cmake || die
63 +
64 + eapply_user
65 + cmake_src_prepare
66 +}
67 +
68 +src_configure() {
69 + # Grant access to the device
70 + addwrite /dev/kfd
71 + addpredict /dev/dri/
72 +
73 + # Compiler to use
74 + export CXX=hipcc
75 +
76 + local mycmakeargs=(
77 + -DBUILD_TEST=$(usex test ON OFF)
78 + -DBUILD_BENCHMARKS=$(usex benchmark ON OFF)
79 + ${AMDGPU_TARGETS+-DAMDGPU_TARGETS="${AMDGPU_TARGETS}"}
80 + -D__skip_rocmclang="ON" ## fix cmake-3.21 configuration issue caused by officialy support programming language "HIP"
81 + )
82 +
83 + cmake_src_configure
84 +}
85 +
86 +src_test() {
87 + # Grant access to the device
88 + addwrite /dev/kfd
89 + addwrite /dev/dri/
90 + cmake_src_test
91 +}
92 +
93 +src_install() {
94 + cmake_src_install
95 +
96 + use benchmark && dobin "${BUILD_DIR}"/benchmarks/benchmark_thrust_bench
97 +}