summaryrefslogtreecommitdiff
path: root/dev-util/rocm-smi/files/rocm-smi-5.7.1-set-soversion.patch
blob: 203b179d3faa704b56e115dabae113c7ed8e5341 (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
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}")