summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNHOrus <jy6x2b32pie9@yahoo.com>2024-06-25 12:47:24 +0400
committerJoonas Niilola <juippis@gentoo.org>2024-07-20 09:42:41 +0300
commitd953c7514231d39335733c921649429a429a6288 (patch)
treef420dd3ef61837227a69daed1c3bb0bc978d5490 /dev-util/rocm-smi
parentdev-lang/mujs: drop 1.3.3 (diff)
downloadgentoo-d953c7514231d39335733c921649429a429a6288.tar.gz
gentoo-d953c7514231d39335733c921649429a429a6288.tar.bz2
gentoo-d953c7514231d39335733c921649429a429a6288.zip
dev-util/rocm-smi: Port to C99, Python 3.12
Ported upstream bug, tested that it works well with Python 3.12 both for versions 3.4.2 and 5.7.1, well enough (my APU is only partially supported and doesn't return much of interesting data) Revbumped just in case. Closes: https://bugs.gentoo.org/929551 Closes: https://bugs.gentoo.org/918709 Signed-off-by: NHOrus <jy6x2b32pie9@yahoo.com> Signed-off-by: Joonas Niilola <juippis@gentoo.org>
Diffstat (limited to 'dev-util/rocm-smi')
-rw-r--r--dev-util/rocm-smi/files/rocm-smi-5.4.2-fix-readonly-object.patch14
-rw-r--r--dev-util/rocm-smi/rocm-smi-5.4.2-r1.ebuild58
-rw-r--r--dev-util/rocm-smi/rocm-smi-5.7.1-r3.ebuild61
3 files changed, 133 insertions, 0 deletions
diff --git a/dev-util/rocm-smi/files/rocm-smi-5.4.2-fix-readonly-object.patch b/dev-util/rocm-smi/files/rocm-smi-5.4.2-fix-readonly-object.patch
new file mode 100644
index 000000000000..914fd2f6b426
--- /dev/null
+++ b/dev-util/rocm-smi/files/rocm-smi-5.4.2-fix-readonly-object.patch
@@ -0,0 +1,14 @@
+bug https://bugs.gentoo.org/918709
+patch from https://github.com/ROCm/rocm_smi_lib/issues/170#issuecomment-2130745220
+upstreamed in https://github.com/ROCm/rocm_smi_lib/commit/7fdc6e56c40ed6f02c888dcb1492944a9373ba74
+--- a/include/rocm_smi/rocm_smi_utils.h 2024-05-25 00:02:19.127412816 -0400
++++ b/include/rocm_smi/rocm_smi_utils.h 2024-05-25 00:03:25.359416227 -0400
+@@ -149,7 +149,7 @@
+ __forceinline ~ScopeGuard() {
+ if (!dismiss_) release_();
+ }
+- __forceinline ScopeGuard& operator=(const ScopeGuard& rhs) {
++ __forceinline ScopeGuard& operator=(ScopeGuard& rhs) {
+ dismiss_ = rhs.dismiss_;
+ release_ = rhs.release_;
+ rhs.dismiss_ = true;
diff --git a/dev-util/rocm-smi/rocm-smi-5.4.2-r1.ebuild b/dev-util/rocm-smi/rocm-smi-5.4.2-r1.ebuild
new file mode 100644
index 000000000000..e77f370cd678
--- /dev/null
+++ b/dev-util/rocm-smi/rocm-smi-5.4.2-r1.ebuild
@@ -0,0 +1,58 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{9..12} )
+
+inherit cmake python-r1
+
+DESCRIPTION="ROCm System Management Interface Library"
+HOMEPAGE="https://github.com/RadeonOpenCompute/rocm_smi_lib"
+
+if [[ ${PV} == *9999 ]] ; then
+ inherit git-r3
+ EGIT_REPO_URI="https://github.com/RadeonOpenCompute/rocm_smi_lib"
+ EGIT_BRANCH="master"
+else
+ SRC_URI="https://github.com/RadeonOpenCompute/rocm_smi_lib/archive/rocm-${PV}.tar.gz -> rocm-smi-${PV}.tar.gz"
+ KEYWORDS="~amd64"
+ S="${WORKDIR}/rocm_smi_lib-rocm-${PV}"
+fi
+
+LICENSE="MIT NCSA-AMD"
+SLOT="0/$(ver_cut 1-2)"
+IUSE=""
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+DEPEND=""
+RDEPEND="${PYTHON_DEPS}"
+BDEPEND=""
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-5.0.2-gcc12-memcpy.patch
+ "${FILESDIR}"/${PN}-5.4.2-detect-builtin-amdgpu.patch
+ "${FILESDIR}"/${PN}-5.4.2-fix-readonly-object.patch
+)
+
+src_prepare() {
+ sed -e "/LICENSE.txt/d" -i CMakeLists.txt || die
+ sed -e "/^path_librocm = /c\path_librocm = '${EPREFIX}/usr/lib64/librocm_smi64.so'" \
+ -i python_smi_tools/rsmiBindings.py || die
+ cmake_src_prepare
+}
+
+src_configure() {
+ local mycmakeargs=(
+ -DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr"
+ -DCMAKE_DISABLE_FIND_PACKAGE_LATEX=ON
+ -DFILE_REORG_BACKWARD_COMPATIBILITY=OFF
+ )
+ cmake_src_configure
+}
+
+src_install() {
+ cmake_src_install
+ python_foreach_impl python_newscript python_smi_tools/rocm_smi.py rocm-smi
+ python_foreach_impl python_domodule python_smi_tools/rsmiBindings.py
+}
diff --git a/dev-util/rocm-smi/rocm-smi-5.7.1-r3.ebuild b/dev-util/rocm-smi/rocm-smi-5.7.1-r3.ebuild
new file mode 100644
index 000000000000..9d1d975d0e84
--- /dev/null
+++ b/dev-util/rocm-smi/rocm-smi-5.7.1-r3.ebuild
@@ -0,0 +1,61 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{10..12} )
+
+inherit cmake python-r1
+
+DESCRIPTION="ROCm System Management Interface Library"
+HOMEPAGE="https://github.com/RadeonOpenCompute/rocm_smi_lib"
+
+if [[ ${PV} == *9999 ]] ; then
+ inherit git-r3
+ EGIT_REPO_URI="https://github.com/RadeonOpenCompute/rocm_smi_lib"
+ EGIT_BRANCH="master"
+else
+ SRC_URI="https://github.com/RadeonOpenCompute/rocm_smi_lib/archive/rocm-${PV}.tar.gz -> rocm-smi-${PV}.tar.gz"
+ KEYWORDS="~amd64"
+ S="${WORKDIR}/rocm_smi_lib-rocm-${PV}"
+fi
+
+LICENSE="MIT NCSA-AMD"
+SLOT="0/$(ver_cut 1-2)"
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+RDEPEND="${PYTHON_DEPS}"
+
+S="${WORKDIR}/rocm_smi_lib-rocm-${PV}"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-5.7.1-set-soversion.patch
+ "${FILESDIR}"/${PN}-5.7.1-no-strip.patch
+ "${FILESDIR}"/${PN}-5.7.1-remove-example.patch
+ "${FILESDIR}"/${PN}-5.4.2-detect-builtin-amdgpu.patch
+ "${FILESDIR}"/${PN}-5.4.2-fix-readonly-object.patch
+)
+
+src_prepare() {
+ cmake_src_prepare
+
+ sed "s/\${PKG_VERSION_STR}/${PV}/" -i CMakeLists.txt || die
+ sed -e "s/@VERSION_MAJOR@/$(ver_cut 1)/ ; s/@VERSION_MINOR@/$(ver_cut 2)/" \
+ -i oam/CMakeLists.txt -i rocm_smi/CMakeLists.txt || die
+}
+
+src_configure() {
+ local mycmakeargs=(
+ -DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr"
+ -DFILE_REORG_BACKWARD_COMPATIBILITY=OFF
+ )
+ cmake_src_configure
+}
+
+src_install() {
+ cmake_src_install
+ python_foreach_impl python_newscript python_smi_tools/rocm_smi.py rocm-smi
+ python_foreach_impl python_domodule python_smi_tools/rsmiBindings.py
+
+ mv "${ED}"/usr/share/doc/rocm_smi "${ED}"/usr/share/doc/${PF} || die
+}