summaryrefslogtreecommitdiff
path: root/dev-util/nsight-compute/nsight-compute-2026.3.0.13.ebuild
blob: 7a02cf52fdfeff534c1db8895dafb5b609e990db (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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# Copyright 2024-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit desktop edo unpacker

DESCRIPTION="performance analysis tool designed to visualize an application's algorithms"
HOMEPAGE="https://developer.nvidia.com/nsight-systems"

MY_PV="$(ver_rs 1-3 '_' "$(ver_cut 1-3)")"
MY_PN="${PN//nsight-}"
MY_PN_SHORT="cu"

SRC_URI="
	amd64? (
		https://developer.nvidia.com/downloads/assets/tools/secure/${PN}/${MY_PV}/${PN//-/_}-linux-x86_64-${PV}.run
	)
	arm64? (
		https://developer.nvidia.com/downloads/assets/tools/secure/${PN}/${MY_PV}/${PN//-/_}-linux-sbsa-${PV}.run
	)
	mirror+https://developer.download.nvidia.com/images/nvidia-nsight-${MY_PN}-icon-gbp-shaded-128.png
		-> nvidia-nsight-${MY_PN}-icon-gbp-shaded-128.20231126.png
"

S="${WORKDIR}/pkg"

LICENSE="NVIDIA-r2"
SLOT="${PV}"
KEYWORDS="~amd64 ~arm64"

RESTRICT="bindist mirror strip test"

RDEPEND="
	dev-libs/expat
	dev-libs/glib:2
	dev-libs/nspr
	dev-libs/nss
	dev-libs/wayland
	dev-qt/qtdeclarative:6
	dev-qt/qtpositioning:6
	dev-qt/qtwayland:6
	dev-qt/qtwebchannel:6
	dev-qt/qtwebengine:6
	media-libs/fontconfig
	media-libs/libglvnd
	media-libs/tiff-compat:4
	sys-apps/dbus
	sys-cluster/rdma-core
	x11-drivers/nvidia-drivers
	x11-libs/libX11
	x11-libs/libXcomposite
	x11-libs/libXdamage
	x11-libs/libXext
	x11-libs/libXfixes
	x11-libs/libXi
	x11-libs/libXrandr
	x11-libs/libXrender
	x11-libs/libXtst
	x11-libs/libdrm
	x11-libs/libxcb:=
	x11-libs/libxkbcommon
	x11-libs/libxkbfile
	x11-libs/libxshmfence
	x11-libs/xcb-util-cursor
	x11-libs/xcb-util-image
	x11-libs/xcb-util-keysyms
	x11-libs/xcb-util-renderutil
	x11-libs/xcb-util-wm
"

BDEPEND="
	dev-util/patchelf
"

QA_PREBUILT="/opt/nvidia/*"

src_prepare() {
	if [[ -n "${EPREFIX}" ]]; then
		sed  -e "s#=/#=${EPREFIX}/#g" -i usr/share/applications/*.desktop || die
	fi

	pushd host/linux-desktop-* >/dev/null || die

	local rpaths rpath
	readarray -t rpaths < <(find . -maxdepth 1 -name '*.bin')
	for rpath in "${rpaths[@]}"; do
		edob -m "fixing rpath for ${rpath}" \
			patchelf --set-rpath '$ORIGIN' "${rpath}"

		# OpenGLVersionChecker stumbles on "OpenGL ES profile version string" so disable the check
		sed \
			-e "s/NV_AGORA_PATH/NV_AGORA_PATH_/g" \
			-e "4i export QT_PLUGIN_PATH=\"\${NV_AGORA_PATH_}/Plugins\"" \
			-e "s/AGORA_USE_MESA_FALLBACK=true/AGORA_USE_MESA_FALLBACK=false/" \
			-i "$(basename "${rpath}" .bin)" \
			|| die
	done

	popd &>/dev/null || die

	eapply_user
}

src_install() {
	local dir
	dir="/opt/nvidia/${PN}/$(ver_cut 1-2)"

	dodir "${dir}"
	mv ./* "${ED}${dir}" || die

	local arch_dirs
	readarray -t arch_dirs < <(find "${ED}${dir}/host" -mindepth 1 -maxdepth 1 -name 'linux-*' -exec basename {} \;)
	if [[ -z "${arch_dirs[*]}" ]]; then
		die "failed to find arch dir"
	fi
	if [[ "$(echo "${#arch_dirs[@]}" | wc -l )" -gt 1 ]]; then
		eerror "${arch_dirs[*]}"
		die "found ${#arch_dirs[*]} arch dirs"
	fi

	cp \
		"${DISTDIR}/nvidia-nsight-${MY_PN}-icon-gbp-shaded-128.20231126.png" \
		"${ED}${dir}/host/${arch_dirs[0]}/n${MY_PN_SHORT}-ui.png" \
			|| die

	newmenu - "${P}.desktop" <<-EOF || die
		[Desktop Entry]
		Type=Application
		Name=NVIDIA Nsight ${MY_PN^} ${PV}
		GenericName=NVIDIA Nsight ${MY_PN^}
		Icon=${EPREFIX}${dir}/host/${arch_dirs[0]}/n${MY_PN_SHORT}-ui.png
		Exec=env WAYLAND_DISPLAY= ${EPREFIX}${dir}/host/${arch_dirs[0]}/n${MY_PN_SHORT}-ui
		TryExec=${EPREFIX}${dir}/host/${arch_dirs[0]}/n${MY_PN_SHORT}-ui
		Keywords=cuda;gpu;nvidia;nsight;
		X-AppInstall-Keywords=cuda;gpu;nvidia;nsight;
		X-GNOME-Keywords=cuda;gpu;nvidia;nsight;
		Terminal=false
		Categories=Development;Profiling;ParallelComputing
	EOF
}