# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

MY_PV=$(ver_cut 1-2)

DESCRIPTION="NVIDIA Ray Tracing Engine"
HOMEPAGE="https://developer.nvidia.com/rtx/ray-tracing/optix"
SRC_URI="NVIDIA-OptiX-SDK-${PV}-linux64-x86_64.sh"
S="${WORKDIR}"

LICENSE="NVIDIA-SDK-v2017.06.13 BSD"
SLOT="0/$(ver_cut 1)"
KEYWORDS="~amd64 ~arm64"
RESTRICT="bindist mirror test"
IUSE="doc"

RDEPEND=">=x11-drivers/nvidia-drivers-510"

pkg_nofetch() {
	einfo "Please download ${A} from:"
	einfo "  ${HOMEPAGE}"
	einfo "and move it to your distfiles directory."
}

src_unpack() {
	tail -n +226 "${DISTDIR}"/${A} | tar -zx
	assert "unpacking ${A} failed"
}

src_install() {
	insinto "/opt/${PN}"

	doins -r include/

	use doc && dodoc doc/OptiX_{API_Reference,Programming_Guide}_${PV}.pdf
}