summaryrefslogtreecommitdiff
path: root/dev-util/rocm-smi/files/rocm-smi-5.7.1-set-soversion.patch
diff options
context:
space:
mode:
Diffstat (limited to 'dev-util/rocm-smi/files/rocm-smi-5.7.1-set-soversion.patch')
-rw-r--r--dev-util/rocm-smi/files/rocm-smi-5.7.1-set-soversion.patch112
1 files changed, 112 insertions, 0 deletions
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}")