summaryrefslogtreecommitdiff
blob: e960beb576235ae8c8974632f1715b57173b61e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# Copyright 2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

DESCRIPTION="Collection of tools for use with nvptx-none GCC toolchains"
HOMEPAGE="https://github.com/MentorEmbedded/nvptx-tools https://gcc.gnu.org/wiki/nvptx"

if [[ ${PV} == 9999 ]] ; then
	EGIT_REPO_URI="https://github.com/MentorEmbedded/nvptx-tools"
	inherit git-r3
else
	MY_COMMIT="93e00909ceb9cbbc104f0fcba56c0361ffb3ca4b"
	SRC_URI="https://github.com/MentorEmbedded/nvptx-tools/archive/${MY_COMMIT}.tar.gz -> ${P}.tar.gz"
	S="${WORKDIR}"/${PN}-${MY_COMMIT}

	KEYWORDS="~amd64"
fi

LICENSE="GPL-3"
SLOT="0"
IUSE="test"
RESTRICT="!test? ( test )"

export CBUILD=${CBUILD:-${CHOST}}
export CTARGET=${CTARGET:-${CHOST}}
if [[ ${CTARGET} == ${CHOST} ]] ; then
	if [[ ${CATEGORY} == cross-* ]] ; then
		export CTARGET=${CATEGORY#cross-}
	fi
fi

BDEPEND="
	test? (
		dev-python/lit
		dev-util/dejagnu
	)
"

is_crosscompile() {
	[[ ${CHOST} != ${CTARGET} ]]
}

pkg_setup() {
	# Reject newlib-on-glibc type installs
	if [[ ${CTARGET} == ${CHOST} ]] ; then
		case ${CHOST} in
			*-newlib|nvptx-*) ;;
			*) die "Use sys-devel/crossdev to build a nvptx(-none) toolchain" ;;
		esac
	fi
}