dev-libs/libclc: add python3_8 target
[gentoo.git] / dev-libs / libclc / libclc-0.2.0_pre20191024.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5 PYTHON_COMPAT=( python3_{6,7,8} )
6
7 inherit llvm prefix python-any-r1 toolchain-funcs
8
9 DESCRIPTION="OpenCL C library"
10 HOMEPAGE="https://libclc.llvm.org/"
11 # libclc subdir of https://github.com/llvm/llvm-project.git
12 SRC_URI="https://dev.gentoo.org/~mgorny/dist/${P}.tar.xz"
13
14 LICENSE="Apache-2.0-with-LLVM-exceptions || ( MIT BSD )"
15 SLOT="0"
16 KEYWORDS="amd64 x86"
17 IUSE_VIDEO_CARDS="video_cards_nvidia video_cards_r600 video_cards_radeonsi"
18 IUSE="${IUSE_VIDEO_CARDS}"
19 REQUIRED_USE="|| ( ${IUSE_VIDEO_CARDS} )"
20
21 BDEPEND="
22         || (
23                 sys-devel/clang:10
24                 sys-devel/clang:9
25                 sys-devel/clang:8
26                 sys-devel/clang:7
27         )
28         ${PYTHON_DEPS}"
29
30 llvm_check_deps() {
31         has_version -b "sys-devel/clang:${LLVM_SLOT}"
32 }
33
34 src_prepare() {
35         default
36         if use prefix; then
37                 hprefixify configure.py
38         fi
39 }
40
41 pkg_setup() {
42         # we do not need llvm_pkg_setup
43         python-any-r1_pkg_setup
44 }
45
46 src_configure() {
47         local libclc_targets=()
48
49         use video_cards_nvidia && libclc_targets+=("nvptx--" "nvptx64--" "nvptx--nvidiacl" "nvptx64--nvidiacl")
50         use video_cards_r600 && libclc_targets+=("r600--")
51         use video_cards_radeonsi && libclc_targets+=("amdgcn--" "amdgcn-mesa-mesa3d" "amdgcn--amdhsa")
52
53         [[ ${#libclc_targets[@]} ]] || die "libclc target missing!"
54
55         ./configure.py \
56                 --with-cxx-compiler="$(tc-getCXX)" \
57                 --with-llvm-config="$(get_llvm_prefix "${LLVM_MAX_SLOT}")/bin/llvm-config" \
58                 --prefix="${EPREFIX}/usr" \
59                 "${libclc_targets[@]}" || die
60 }
61
62 src_compile() {
63         emake VERBOSE=1
64 }