commit:     13462cfec0e954c85f9f7962719d97de2ff92e43
Author:     Sv. Lockal <lockalsash <AT> gmail <DOT> com>
AuthorDate: Tue Oct 31 20:59:13 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Mar  8 19:21:56 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=13462cfe

dev-util/rocm-smi: add 5.7.1

Signed-off-by: Sv. Lockal <lockalsash <AT> gmail.com>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-util/rocm-smi/Manifest                         |   1 +
 .../rocm-smi/files/rocm-smi-5.7.1-no-strip.patch   |  36 +++++++
 .../files/rocm-smi-5.7.1-remove-example.patch      |  14 +++
 .../files/rocm-smi-5.7.1-set-soversion.patch       | 112 +++++++++++++++++++++
 dev-util/rocm-smi/rocm-smi-5.7.1.ebuild            |  58 +++++++++++
 5 files changed, 221 insertions(+)

diff --git a/dev-util/rocm-smi/Manifest b/dev-util/rocm-smi/Manifest
index f173e1fd3cb0..d8623a5635f4 100644
--- a/dev-util/rocm-smi/Manifest
+++ b/dev-util/rocm-smi/Manifest
@@ -1,2 +1,3 @@
 DIST rocm-smi-5.1.3.tar.gz 1701386 BLAKE2B 
c5e779f5c33fec0b1b39b09c758dfadd3c24e28f15381593f2959e5c2fb9f49af3a7ca1f9ab7d6bf34c5af4fbe3f0c0ae20c6c049cbf9421a9184735bb4a64a2
 SHA512 
7bf7af2b42a035c298c2f9009b6123671af41f9ca1a50607cfa362f39dbd82ff88f8c13ece6c4edab585edadd9072ed096a400dd3850851e1beef3633a8eb14e
 DIST rocm-smi-5.4.2.tar.gz 1553259 BLAKE2B 
0560e115028caafb1d5dd8892cfa677431b792714ecd8c75f31451fa7685d1c7070cbd687c894d7eefd112de5e2df9aa7895aa57821db207dffc4e8890898638
 SHA512 
0fd651593df0ebbcb2c2327d030d2674efacdb6e883daa5a8adf733db2bde3e5d16dc304856221f4bb07a3cd834944ffcc7ebd689624f7ba24ffd6c262ba74b8
+DIST rocm-smi-5.7.1.tar.gz 801646 BLAKE2B 
b4799bbdaeb7203c16117cd30511d589a2b96e15801bb9f1382fe7a4d87d43e1d4b458d6923b6ebd602fdccba74bd65bcb98766dbd83c48fc3e02219be8c1022
 SHA512 
ad364278f137228a39108c93d482635137ea2724a5a39debb5b32329493ebf5c706dcf3863e2e24b6f0b6286f3877942277f5ae447446f155518972b957f7d9d

diff --git a/dev-util/rocm-smi/files/rocm-smi-5.7.1-no-strip.patch 
b/dev-util/rocm-smi/files/rocm-smi-5.7.1-no-strip.patch
new file mode 100644
index 000000000000..07796295e71e
--- /dev/null
+++ b/dev-util/rocm-smi/files/rocm-smi-5.7.1-no-strip.patch
@@ -0,0 +1,36 @@
+--- a/oam/CMakeLists.txt
++++ b/oam/CMakeLists.txt
+@@ -82,15 +82,6 @@ set_property(TARGET ${OAM_TARGET} PROPERTY
+ set_property(TARGET ${OAM_TARGET} PROPERTY
+              VERSION "${SO_VERSION_STRING}")
+ 
+-## If the library is a release, strip the target library
+-if ("${CMAKE_BUILD_TYPE}" STREQUAL Release)
+-    if(${BUILD_SHARED_LIBS}) #striping only for .so
+-        add_custom_command(
+-             TARGET ${OAM_TARGET}
+-             POST_BUILD COMMAND ${CMAKE_STRIP} lib${OAM_TARGET}.so)
+-    endif()
+-endif ()
+-
+ # use the target_include_directories() command to specify the include 
directories for the target
+ target_include_directories(${OAM_TARGET}
+                            PUBLIC
+--- a/rocm_smi/CMakeLists.txt
++++ b/rocm_smi/CMakeLists.txt
+@@ -103,15 +103,6 @@ set_property(TARGET ${ROCM_SMI_TARGET} PROPERTY
+ set_property(TARGET ${ROCM_SMI_TARGET} PROPERTY
+              VERSION "${SO_VERSION_STRING}")
+ 
+-## If the library is a release, strip the target library
+-if ("${CMAKE_BUILD_TYPE}" STREQUAL Release)
+-  if(${BUILD_SHARED_LIBS}) #stripping only for .so
+-    add_custom_command(
+-          TARGET ${ROCM_SMI_TARGET}
+-          POST_BUILD COMMAND ${CMAKE_STRIP} 
lib${ROCM_SMI_TARGET}.so.${SO_VERSION_STRING})
+-  endif()
+-endif ()
+-
+ #file reorganization changes
+ #rocm_smi.py moved to libexec/rocm_smi. so creating rocm-smi symlink
+ file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin)

diff --git a/dev-util/rocm-smi/files/rocm-smi-5.7.1-remove-example.patch 
b/dev-util/rocm-smi/files/rocm-smi-5.7.1-remove-example.patch
new file mode 100644
index 000000000000..18e1f4c78b5d
--- /dev/null
+++ b/dev-util/rocm-smi/files/rocm-smi-5.7.1-remove-example.patch
@@ -0,0 +1,14 @@
+Remove example; unused, only generates not important QA warnings
+--- a/rocm_smi/CMakeLists.txt
++++ b/rocm_smi/CMakeLists.txt
+@@ -76,8 +76,10 @@ set(SMI_INC_LIST "")
+ 
+ set(SMI_EXAMPLE_EXE "rocm_smi_ex")
+ 
++if (WITH_EXAMPLE)
+ add_executable(${SMI_EXAMPLE_EXE} "example/rocm_smi_example.cc")
+ target_link_libraries(${SMI_EXAMPLE_EXE} ${ROCM_SMI_TARGET})
++endif()
+ add_library(${ROCM_SMI_TARGET}  ${CMN_SRC_LIST} ${SMI_SRC_LIST}
+                                               ${CMN_INC_LIST} ${SMI_INC_LIST})
+ target_link_libraries(${ROCM_SMI_TARGET} pthread rt)

diff --git a/dev-util/rocm-smi/files/rocm-smi-5.7.1-set-soversion.patch 
b/dev-util/rocm-smi/files/rocm-smi-5.7.1-set-soversion.patch
new file mode 100644
index 000000000000..203b179d3faa
--- /dev/null
+++ b/dev-util/rocm-smi/files/rocm-smi-5.7.1-set-soversion.patch
@@ -0,0 +1,112 @@
+Forcefully set rocm_smi64 soversion to 1.
+Before intoduction of git-based versioning, soversion was 1.0.
+
+This patch repeats approach of similar patch from Debian, additionally 
removing dependency from git.
+https://salsa.debian.org/rocm-team/rocm-smi-lib/-/blob/master/debian/patches/0007-rocm_smi64-soversion.patch
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -30,27 +30,6 @@ set(SHARE_INSTALL_PREFIX
+     "share/${ROCM_SMI}"
+     CACHE STRING "Tests and Example install directory")
+ 
+-# provide git to utilities
+-find_program (GIT NAMES git)
+-
+-## Setup the package version based on git tags.
+-set(PKG_VERSION_GIT_TAG_PREFIX "rsmi_pkg_ver")
+-get_package_version_number("5.0.0" ${PKG_VERSION_GIT_TAG_PREFIX} GIT)
+-message("Package version: ${PKG_VERSION_STR}")
+-set(${AMD_SMI_LIBS_TARGET}_VERSION_MAJOR "${VERSION_MAJOR}")
+-set(${AMD_SMI_LIBS_TARGET}_VERSION_MINOR "${VERSION_MINOR}")
+-set(${AMD_SMI_LIBS_TARGET}_VERSION_PATCH "0")
+-set(${AMD_SMI_LIBS_TARGET}_VERSION_BUILD "0")
+-
+-# The following default version values should be updated as appropriate for
+-# ABI breaks (update MAJOR and MINOR), and ABI/API additions (update MINOR).
+-# Until ABI stabilizes VERSION_MAJOR will be 0. This should be over-ridden
+-# by git tags (through "git describe") when they are present.
+-set(PKG_VERSION_MAJOR 1)
+-set(PKG_VERSION_MINOR 0)
+-set(PKG_VERSION_PATCH 0)
+-set(PKG_VERSION_NUM_COMMIT 0)
+-
+ ## Define default variable and variables for the optional build target
+ ##  rocm_smi_lib-dev
+ set(CMAKE_INSTALL_PREFIX "/opt/rocm" CACHE STRING "Default installation 
directory.")
+--- a/oam/CMakeLists.txt
++++ b/oam/CMakeLists.txt
+@@ -29,23 +29,10 @@ set(OAM_NAME "oam")
+ set(OAM_COMPONENT "lib${OAM_NAME}")
+ set(OAM_TARGET "${OAM_NAME}")
+ 
+-################# Determine the library version #########################
+-set(SO_VERSION_GIT_TAG_PREFIX "oam_so_ver")
+-
+-# VERSION_* variables should be set by get_version_from_tag
+-message("Package version: ${PKG_VERSION_STR}")
+-
+-# Debian package specific variables
+-# Set a default value for the package version
+-get_version_from_tag("1.0.0.0" ${SO_VERSION_GIT_TAG_PREFIX} GIT)
+-
+-# VERSION_* variables should be set by get_version_from_tag
+-if ( ${ROCM_PATCH_VERSION} )
+-    set ( VERSION_PATCH ${ROCM_PATCH_VERSION})
+-    set(SO_VERSION_STRING 
"${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
+-else()
+-    set(SO_VERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}")
+-endif ()
++set(VERSION_MAJOR "1")
++set(VERSION_MINOR "0")
++
++set(SO_VERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}")
+ set(${OAM_NAME}_VERSION_MAJOR "${VERSION_MAJOR}")
+ set(${OAM_NAME}_VERSION_MINOR "${VERSION_MINOR}")
+ set(${OAM_NAME}_VERSION_PATCH "0")
+--- a/python_smi_tools/rsmiBindings.py.in
++++ b/python_smi_tools/rsmiBindings.py.in
+@@ -9,19 +9,9 @@ from enum import Enum
+ 
+ import os
+ 
+-# Use ROCm installation path if running from standard installation
+-# With File Reorg rsmiBindings.py will be installed in  
/opt/rocm/libexec/rocm_smi.
+-# relative path changed accordingly
+-path_librocm = os.path.dirname(os.path.realpath(__file__)) + 
'/../../@CMAKE_INSTALL_LIBDIR@/librocm_smi64.so.@VERSION_MAJOR@'
+-if not os.path.isfile(path_librocm):
+-    print('Unable to find %s . Trying /opt/rocm*' % path_librocm)
+-    for root, dirs, files in os.walk('/opt', followlinks=True):
+-        if 'librocm_smi64.so.@VERSION_MAJOR@' in files:
+-            path_librocm = os.path.join(os.path.realpath(root), 
'librocm_smi64.so.@VERSION_MAJOR@')
+-    if os.path.isfile(path_librocm):
+-        print('Using lib from %s' % path_librocm)
+-    else:
+-        print('Unable to find librocm_smi64.so.@VERSION_MAJOR@')
++path_librocm = ctypes.util.find_library("rocm_smi64")
++if not path_librocm:
++    print('Unable to find librocm_smi64.so')
+ 
+ # ----------> TODO: Support static libs as well as SO
+ 
+--- a/rocm_smi/CMakeLists.txt
++++ b/rocm_smi/CMakeLists.txt
+@@ -31,17 +31,8 @@ set(ROCM_SMI_TARGET "${ROCM_SMI}64")
+ ## Include common cmake modules
+ include(utils)
+ 
+-################# Determine the library version #########################
+-set(SO_VERSION_GIT_TAG_PREFIX "rsmi_so_ver")
+-
+-# VERSION_* variables should be set by get_version_from_tag
+-message("Package version: ${PKG_VERSION_STR}")
+-
+-# Debian package specific variables
+-# Set a default value for the package version
+-get_version_from_tag("5.0.0.0" ${SO_VERSION_GIT_TAG_PREFIX} GIT)
+-
+-# VERSION_* variables should be set by get_version_from_tag
++set(VERSION_MAJOR "1")
++set(VERSION_MINOR "0")
+ if ( ${ROCM_PATCH_VERSION} )
+     set ( VERSION_PATCH ${ROCM_PATCH_VERSION})
+     set(SO_VERSION_STRING 
"${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")

diff --git a/dev-util/rocm-smi/rocm-smi-5.7.1.ebuild 
b/dev-util/rocm-smi/rocm-smi-5.7.1.ebuild
new file mode 100644
index 000000000000..5fd0811bd980
--- /dev/null
+++ b/dev-util/rocm-smi/rocm-smi-5.7.1.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_{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
+)
+
+src_prepare() {
+       cmake_src_prepare
+
+       sed "s/\${PKG_VERSION_STR}/${PV}/g" \
+               -i CMakeLists.txt -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
+}

Reply via email to