Diff amdsmi-7.1.1 with a amdsmi-10.1.0

/usr/portage/dev-util/amdsmi/amdsmi-10.1.0.ebuild 2026-10-23 20:01:05.288494935 +0300
3 3

  
4 4
EAPI=8
5 5

  
6
PYTHON_COMPAT=( python3_{10..14} )
6
PYTHON_COMPAT=( python3_{11..15} )
7 7
ROCM_SKIP_GLOBALS=1
8
inherit cmake linux-info python-r1 rocm
8
inherit cmake dot-a linux-info python-r1 rocm toolchain-funcs
9 9

  
10 10
ESMI_PN=esmi_pkg_ver
11
ESMI_PV=4.2
11
ESMI_PV=5.2.1.1
12 12

  
13 13
DESCRIPTION="AMD System Management Interface for managing and monitoring GPUs"
14 14
HOMEPAGE="
15
	https://github.com/ROCm/amdsmi
15
	https://github.com/ROCm/rocm-systems/tree/develop/projects/amdsmi
16 16
	https://rocm.docs.amd.com/projects/amdsmi/en/latest/
17 17
"
18 18
SRC_URI="
19
	https://github.com/ROCm/amdsmi/archive/refs/tags/rocm-${PV}.tar.gz -> ${P}.tar.gz
19
	https://github.com/ROCm/rocm-systems/releases/download/therock-${PV%.0}/${PN}.tar.gz -> ${P}.tar.gz
20 20
	https://github.com/amd/esmi_ib_library/archive/refs/tags/${ESMI_PN}-${ESMI_PV}.tar.gz
21
		-> esmi_ib_library-${ESMI_PV}.tar.gz
21 22
"
22
S="${WORKDIR}/amdsmi-rocm-${PV}"
23
S="${WORKDIR}/${PN}"
23 24
ESMI_S="${WORKDIR}/esmi_ib_library-${ESMI_PN}-${ESMI_PV}"
24 25

  
25 26
LICENSE="MIT"
......
31 32

  
32 33
REQUIRED_USE="${PYTHON_REQUIRED_USE}"
33 34

  
34
DEPEND="
35
RDEPEND="
35 36
	${PYTHON_DEPS}
36
	test? ( dev-cpp/gtest )
37
	dev-libs/libnl:3
38
	net-libs/libmnl
37 39
	x11-libs/libdrm[video_cards_amdgpu]
38 40
"
39
RDEPEND="
40
	${PYTHON_DEPS}
41
DEPEND="
42
	${RDEPEND}
41 43
	dev-libs/rocm-core:${SLOT}
44
	test? ( dev-cpp/gtest )
42 45
"
43 46

  
44
PATCHES=(
45
	"${FILESDIR}"/${PN}-7.0.2-no-git.patch
46
	"${FILESDIR}"/${PN}-7.0.2-unbundle-gtest.patch
47
	"${FILESDIR}"/${PN}-7.1.1-libdrm-compat.patch
48
	"${FILESDIR}"/${PN}-7.1.1-fix-includes.patch
49
)
50

  
51 47
CONFIG_CHECK="~HSA_AMD ~DRM_AMDGPU"
52 48

  
53 49
src_prepare() {
......
60 56
	sed -e "s/-Wall -Wextra//" \
61 57
		-i CMakeLists.txt "${ESMI_S}"/CMakeLists.txt goamdsmi_shim/CMakeLists.txt || die
62 58

  
59
	# Bug: https://bugs.gentoo.org/984514
60
	sed -e "/check_cxx_compiler_flag/!s/ -Werror\(=[a-z-]*\)\?//g" \
61
		-i CMakeLists.txt cmake_modules/help_package.cmake \
62
		src/nic/ai-nic/amdsmi_unified/CMakeLists.txt || die
63

  
64
	# Bug: https://bugs.gentoo.org/984513
65
	sed -e "s/COMMAND objdump/COMMAND $(tc-getOBJDUMP)/" -i CMakeLists.txt || die
66

  
63 67
	# Reset custom installation path
64 68
	sed -e "/generic_add_rocm/d" -i CMakeLists.txt || die
65 69

  
66
	# Remove /usr/lib to fix multilib
67
	sed -e '/target_link_libraries.*\/lib/d' -i goamdsmi_shim/CMakeLists.txt || die
68

  
69 70
	# Install docs to correct place
70 71
	sed -e "s:doc/\${CPACK_PACKAGE_NAME}:doc/${P}:" -i CMakeLists.txt || die
71 72

  
72 73
	# Do not install /usr/share/doc/${P}-asan
73 74
	sed -e "s/COMPONENT asan/COMPONENT asan EXCLUDE_FROM_ALL/" -i CMakeLists.txt || die
74 75

  
76
	# libc++ does not include <cstdlib> transitively
77
	sed -e "/#include <cstring>/i #include <cstdlib>" -i rocm_smi/src/rocm_smi_binary_parser.cc || die
78

  
75 79
	cmake_src_prepare
76 80
}
77 81

  
78 82
src_configure() {
79 83
	python_setup
84
	# Bug: https://bugs.gentoo.org/984518
85
	lto-guarantee-fat
80 86

  
81 87
	local mycmakeargs=(
82 88
		-DBUILD_TESTS=$(usex test)
83
		-DUSE_SYSTEM_GTEST=ON
84 89
		-Wno-dev
85 90
	)
91
	use test && mycmakeargs+=( -DCMAKE_REQUIRE_FIND_PACKAGE_GTest=ON )
86 92
	cmake_src_configure
87 93
}
88 94

  
89 95
src_test() {
90
	# GPU access in amdsmitstReadOnly.TestSysInfoRead and amdsmitstReadOnly.TestIdInfoRead
91
	addwrite /dev/dri/renderD128
96
	# Bug: https://bugs.gentoo.org/984527
97
	if [[ -c /dev/kfd ]]; then
98
		check_amdgpu
99
	else
100
		ewarn "/dev/kfd is missing, skipping functional tests"
101
		local -x GTEST_FILTER="*Unit.*"
102
	fi
92 103

  
93
	# Few tests fail on ASUS GZ302E: no metrics from kernel?
94
	GTEST_FILTER="-amdsmitstReadOnly.TempRead:amdsmitstReadOnly.TestFrequenciesRead" \
95 104
	"${BUILD_DIR}/tests/amd_smi_test/amdsmitst" || die "Test failed"
96 105
}
97 106

  
98 107
src_install() {
99 108
	cmake_src_install
109
	strip-lto-bytecode
100 110

  
101
	# Wrong places
102
	rm "${ED}"/usr/share/amd_smi/amdsmi/{libamd_smi.so,LICENSE,README.md} || die
111
	# Reinstalled below with python_domodule
112
	rm -r "${D}$(python_get_sitedir)"/amdsmi "${ED}"/usr/bin/amd-smi || die
103 113

  
104 114
	python_fix_shebang "${ED}"/usr/libexec/amdsmi_cli
105 115
	python_domodule "${ED}"/usr/libexec/amdsmi_cli
Thank you!