app-eselect/eselect-opencl: [QA] Fix BadHomepage
[gentoo.git] / app-eselect / eselect-opencl / eselect-opencl-1.1.0-r4.ebuild
1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=5
5
6 inherit multilib
7
8 DESCRIPTION="Utility to change the OpenCL implementation being used"
9 HOMEPAGE="https://wiki.gentoo.org/wiki/No_homepage"
10
11 # Source:
12 # http://www.khronos.org/registry/cl/api/${CL_ABI}/opencl.h
13 # http://www.khronos.org/registry/cl/api/${CL_ABI}/cl_platform.h
14 # http://www.khronos.org/registry/cl/api/${CL_ABI}/cl.h
15 # http://www.khronos.org/registry/cl/api/${CL_ABI}/cl_ext.h
16 # http://www.khronos.org/registry/cl/api/${CL_ABI}/cl_gl.h
17 # http://www.khronos.org/registry/cl/api/${CL_ABI}/cl_gl_ext.h
18 # http://www.khronos.org/registry/cl/api/${CL_ABI}/cl.hpp
19
20 # Using copy by Mario Kicherer #496418
21
22 SRC_URI="
23         https://dev.gentoo.org/~xarthisius/distfiles/${P}-r1.tar.xz
24         https://github.com/KhronosGroup/OpenCL-Headers/archive/opencl10.zip
25         https://github.com/KhronosGroup/OpenCL-Headers/archive/opencl11.zip
26         https://github.com/KhronosGroup/OpenCL-Headers/archive/opencl12.zip
27         https://github.com/KhronosGroup/OpenCL-Headers/archive/opencl20.zip
28         https://github.com/KhronosGroup/OpenCL-Headers/archive/opencl21.zip
29         http://packages.gentooexperimental.org/opencl-cpp-headers.tar
30         "
31 LICENSE="GPL-2"
32 SLOT="0"
33 KEYWORDS="amd64 ~arm64 x86"
34 IUSE=""
35
36 DEPEND="
37         app-arch/unzip
38         app-arch/xz-utils"
39 RDEPEND=">=app-admin/eselect-1.2.4"
40
41 pkg_postinst() {
42         local impl="$(eselect opencl show)"
43         if [[ -n "${impl}"  && "${impl}" != '(none)' ]] ; then
44                 eselect opencl set "${impl}"
45         fi
46 }
47
48 src_install() {
49         insinto /usr/share/eselect/modules
50         doins opencl.eselect
51         #doman opencl.eselect.5
52
53         local headers=( opencl.h cl_platform.h cl.h cl_ext.h cl_gl.h cl_gl_ext.h cl_egl.h )
54
55         # We install all versions of OpenCL headers
56         for CL_ABI in 1.0 1.1 1.2 2.0 2.1; do
57                 mkdir -p "${ED}/usr/$(get_libdir)/OpenCL/global/include/CL-${CL_ABI}"
58                 for f in ${headers[@]}; do
59                         cp "${WORKDIR}"/OpenCL-Headers-opencl${CL_ABI/./}/${f} "${ED}/usr/$(get_libdir)/OpenCL/global/include/CL-${CL_ABI}/${f}" > /dev/null
60                 done
61         done
62
63         for i in 1.1 1.2 2.1; do
64                 cp "${WORKDIR}"/$i/cl.hpp "${ED}/usr/$(get_libdir)/OpenCL/global/include/CL-${CL_ABI}/"
65         done
66         # Create symlinks to newest. Maybe this should be switchable?
67         for f in ${headers[@]}; do
68                 dosym "../../$(get_libdir)/OpenCL/global/include/CL-1.2/${f}" "/usr/include/CL/${f}"
69         done
70 }