Gentoo Archives: gentoo-commits

From: Marek Szuba <marecki@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-libs/amdgpu-pro-opencl/
Date: Wed, 29 May 2019 10:31:14
Message-Id: 1559125858.5b8c1208f08af0fa8b870e3e677abf8cdc7c1bc3.marecki@gentoo
1 commit: 5b8c1208f08af0fa8b870e3e677abf8cdc7c1bc3
2 Author: Marek Szuba <marecki <AT> gentoo <DOT> org>
3 AuthorDate: Wed May 29 10:30:24 2019 +0000
4 Commit: Marek Szuba <marecki <AT> gentoo <DOT> org>
5 CommitDate: Wed May 29 10:30:58 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5b8c1208
7
8 dev-libs/amdgpu-pro-opencl: conflict with media-libs/mesa[opencl]
9
10 With both this and the Mesa OpenCL state tracker enabled, using
11 dev-libs/ocl-icd one ends up with two OpenCL platforms pointing
12 to the same hardware - and more importantly causes segmentation faults
13 in all applications attempting to use OpenCL.
14
15 Closes: https://bugs.gentoo.org/686790
16 Signed-off-by: Marek Szuba <marecki <AT> gentoo.org>
17 Package-Manager: Portage-2.3.66, Repoman-2.3.11
18
19 .../amdgpu-pro-opencl-19.10.785425-r1.ebuild | 100 +++++++++++++++++++++
20 1 file changed, 100 insertions(+)
21
22 diff --git a/dev-libs/amdgpu-pro-opencl/amdgpu-pro-opencl-19.10.785425-r1.ebuild b/dev-libs/amdgpu-pro-opencl/amdgpu-pro-opencl-19.10.785425-r1.ebuild
23 new file mode 100644
24 index 00000000000..9e9ca9dc6be
25 --- /dev/null
26 +++ b/dev-libs/amdgpu-pro-opencl/amdgpu-pro-opencl-19.10.785425-r1.ebuild
27 @@ -0,0 +1,100 @@
28 +# Copyright 1999-2019 Gentoo Authors
29 +# Distributed under the terms of the GNU General Public License v2
30 +
31 +EAPI=7
32 +
33 +MULTILIB_COMPAT=( abi_x86_{32,64} )
34 +
35 +inherit unpacker multilib-minimal
36 +
37 +SUPER_PN='amdgpu-pro'
38 +MY_PV=$(ver_rs 2 '-')
39 +
40 +DESCRIPTION="Proprietary OpenCL implementation for AMD GPUs"
41 +HOMEPAGE="https://www.amd.com/en/support/kb/release-notes/rn-rad-lin-19-10-unified"
42 +SRC_URI="${SUPER_PN}-${MY_PV}-ubuntu-18.04.tar.xz"
43 +
44 +LICENSE="AMD-GPU-PRO-EULA"
45 +SLOT="0"
46 +KEYWORDS="~amd64 ~x86"
47 +
48 +RESTRICT="mirror fetch strip"
49 +
50 +BDEPEND="dev-util/patchelf"
51 +COMMON="app-eselect/eselect-opencl
52 + dev-libs/ocl-icd"
53 +DEPEND="${COMMON}"
54 +RDEPEND="${COMMON}
55 + !media-libs/mesa[opencl]" # Bug #686790
56 +
57 +QA_PREBUILT="/opt/amdgpu/lib*/*"
58 +
59 +S="${WORKDIR}/${SUPER_PN}-${MY_PV}-ubuntu-18.04"
60 +
61 +pkg_nofetch() {
62 + local pkgver=$(ver_cut 1-2)
63 + einfo "Please download Radeon Software for Linux version ${pkgver} for Ubuntu 18.04 from"
64 + einfo " ${HOMEPAGE}"
65 + einfo "The archive should then be placed into your distfiles directory."
66 +}
67 +
68 +src_unpack() {
69 + default
70 +
71 + local ids_ver="1.0.0"
72 + local patchlevel=$(ver_cut 3)
73 + cd "${S}" || die
74 + unpack_deb "${S}/libdrm-amdgpu-common_${ids_ver}-${patchlevel}_all.deb"
75 + multilib_parallel_foreach_abi multilib_src_unpack
76 +}
77 +
78 +multilib_src_unpack() {
79 + local libdrm_ver="2.4.97"
80 + local patchlevel=$(ver_cut 3)
81 + local deb_abi
82 + [[ ${ABI} == x86 ]] && deb_abi=i386
83 +
84 + mkdir -p "${BUILD_DIR}" || die
85 + pushd "${BUILD_DIR}" >/dev/null || die
86 + unpack_deb "${S}/opencl-orca-amdgpu-pro-icd_${MY_PV}_${deb_abi:-${ABI}}.deb"
87 + unpack_deb "${S}/libdrm-amdgpu-amdgpu1_${libdrm_ver}-${patchlevel}_${deb_abi:-${ABI}}.deb"
88 + popd >/dev/null || die
89 +}
90 +
91 +multilib_src_install() {
92 + local dir_abi short_abi
93 + [[ ${ABI} == x86 ]] && dir_abi=i386-linux-gnu && short_abi=32
94 + [[ ${ABI} == amd64 ]] && dir_abi=x86_64-linux-gnu && short_abi=64
95 +
96 + into "/opt/amdgpu"
97 + patchelf --set-rpath '$ORIGIN' "opt/${SUPER_PN}/lib/${dir_abi}"/libamdocl-orca${short_abi}.so || die "Failed to fix library rpath"
98 + dolib.so "opt/${SUPER_PN}/lib/${dir_abi}"/*
99 + dolib.so "opt/amdgpu/lib/${dir_abi}"/*
100 +
101 + insinto /etc/OpenCL/vendors
102 + echo "/opt/amdgpu/$(get_libdir)/libamdocl-orca${short_abi}.so" \
103 + > "${T}/${SUPER_PN}-${ABI}.icd" || die "Failed to generate ICD file for ABI ${ABI}"
104 + doins "${T}/${SUPER_PN}-${ABI}.icd"
105 +}
106 +
107 +# FIXME: is this right?
108 +multilib_src_install_all() {
109 + ewarn "FOO $PWD"
110 + ewarn `ls`
111 + insinto "/opt/amdgpu"
112 + doins -r opt/amdgpu/share
113 +}
114 +
115 +pkg_postinst() {
116 + if [[ -z "${REPLACING_VERSIONS}" ]]; then
117 + ewarn "Please note that using proprietary OpenCL libraries together with the"
118 + ewarn "Open Source amdgpu stack is not officially supported by AMD. Do not ask them"
119 + ewarn "for support in case of problems with this package."
120 + ewarn ""
121 + ewarn "Furthermore, if you have the whole AMDGPU-Pro stack installed this package"
122 + ewarn "will almost certainly conflict with it. This might change once AMDGPU-Pro"
123 + ewarn "has become officially supported by Gentoo."
124 + fi
125 +
126 + "${ROOT}"/usr/bin/eselect opencl set --use-old ocl-icd
127 +}