summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSv. Lockal <lockalsash@gmail.com>2024-03-09 13:57:48 +0000
committerSam James <sam@gentoo.org>2024-03-10 02:16:13 +0000
commit48a7cd1cc7ff9034442c2aa88a66087b6b19360a (patch)
tree6d2ad7da22b63b36d68e48862d2e550e5a18c09f /dev-libs/roct-thunk-interface
parentsys-apps/agedu: drop 20200617, 20200705 (diff)
downloadgentoo-48a7cd1cc7ff9034442c2aa88a66087b6b19360a.tar.gz
gentoo-48a7cd1cc7ff9034442c2aa88a66087b6b19360a.tar.bz2
gentoo-48a7cd1cc7ff9034442c2aa88a66087b6b19360a.zip
dev-libs/roct-thunk-interface: fix compilation with musl for 5.7.1 and 6.0.0
Upstream PR: https://github.com/ROCm/ROCT-Thunk-Interface/pull/96 Upstream bug: https://github.com/ROCm/ROCT-Thunk-Interface/issues/65 Closes: https://bugs.gentoo.org/830944 Closes: https://bugs.gentoo.org/715434 Signed-off-by: Sv. Lockal <lockalsash@gmail.com> Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'dev-libs/roct-thunk-interface')
-rw-r--r--dev-libs/roct-thunk-interface/files/roct-thunk-interface-5.7.1-musl.patch61
-rw-r--r--dev-libs/roct-thunk-interface/roct-thunk-interface-5.7.1-r1.ebuild (renamed from dev-libs/roct-thunk-interface/roct-thunk-interface-5.7.1.ebuild)7
-rw-r--r--dev-libs/roct-thunk-interface/roct-thunk-interface-6.0.0-r1.ebuild (renamed from dev-libs/roct-thunk-interface/roct-thunk-interface-6.0.0.ebuild)7
3 files changed, 71 insertions, 4 deletions
diff --git a/dev-libs/roct-thunk-interface/files/roct-thunk-interface-5.7.1-musl.patch b/dev-libs/roct-thunk-interface/files/roct-thunk-interface-5.7.1-musl.patch
new file mode 100644
index 000000000000..8cd8a5ff2ee1
--- /dev/null
+++ b/dev-libs/roct-thunk-interface/files/roct-thunk-interface-5.7.1-musl.patch
@@ -0,0 +1,61 @@
+Upstream PR: https://github.com/ROCm/ROCT-Thunk-Interface/pull/96
+Bug: https://github.com/ROCm/ROCT-Thunk-Interface/issues/65
+--- a/src/globals.c
++++ b/src/globals.c
+@@ -32,5 +32,9 @@ unsigned long kfd_open_count;
+ unsigned long system_properties_count;
+ pthread_mutex_t hsakmt_mutex = PTHREAD_MUTEX_INITIALIZER;
+ bool is_dgpu;
++
++#ifndef PAGE_SIZE
+ int PAGE_SIZE;
++#endif
++
+ int PAGE_SHIFT;
+--- a/src/libhsakmt.h
++++ b/src/libhsakmt.h
+@@ -62,7 +62,11 @@ extern HsaVersionInfo kfd_version_info;
+ do { if ((minor) > kfd_version_info.KernelInterfaceMinorVersion)\
+ return HSAKMT_STATUS_NOT_SUPPORTED; } while (0)
+
++/* Might be defined in limits.h on platforms where it is constant (used by musl) */
++/* See also: https://pubs.opengroup.org/onlinepubs/7908799/xsh/limits.h.html */
++#ifndef PAGE_SIZE
+ extern int PAGE_SIZE;
++#endif
+ extern int PAGE_SHIFT;
+
+ /* VI HW bug requires this virtual address alignment */
+--- a/src/openclose.c
++++ b/src/openclose.c
+@@ -116,7 +116,9 @@ static void clear_after_fork(void)
+
+ static inline void init_page_size(void)
+ {
++#ifndef PAGE_SIZE
+ PAGE_SIZE = sysconf(_SC_PAGESIZE);
++#endif
+ PAGE_SHIFT = ffs(PAGE_SIZE) - 1;
+ }
+
+--- a/src/topology.c
++++ b/src/topology.c
+@@ -32,6 +32,7 @@
+ #include <string.h>
+ #include <unistd.h>
+ #include <ctype.h>
++#include <limits.h>
+
+ #include <errno.h>
+ #include <sys/sysinfo.h>
+@@ -1369,6 +1370,10 @@ static int topology_create_temp_cpu_cache_list(int node,
+ * which can be present twice in the string above. 29 is for the prefix
+ * and the +6 is for the cache suffix
+ */
++#ifndef MAXNAMLEN
++/* MAXNAMLEN is the BSD name for NAME_MAX. glibc aliases this as NAME_MAX, but not musl */
++#define MAXNAMLEN NAME_MAX
++#endif
+ const uint32_t MAXPATHSIZE = 29 + MAXNAMLEN + (MAXNAMLEN + 6);
+ cpu_cacheinfo_t *p_temp_cpu_ci_list; /* a list of cpu_ci */
+ char path[MAXPATHSIZE], node_dir[MAXPATHSIZE];
diff --git a/dev-libs/roct-thunk-interface/roct-thunk-interface-5.7.1.ebuild b/dev-libs/roct-thunk-interface/roct-thunk-interface-5.7.1-r1.ebuild
index 2b6233891f0f..86cd350d7e3d 100644
--- a/dev-libs/roct-thunk-interface/roct-thunk-interface-5.7.1.ebuild
+++ b/dev-libs/roct-thunk-interface/roct-thunk-interface-5.7.1-r1.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2023 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
@@ -26,7 +26,10 @@ BDEPEND="x11-libs/libdrm[video_cards_amdgpu]"
CMAKE_BUILD_TYPE=Release
-PATCHES=( "${FILESDIR}/${PN}-5.7.0-functions.patch" )
+PATCHES=(
+ "${FILESDIR}/${PN}-5.7.0-functions.patch"
+ "${FILESDIR}/${PN}-5.7.1-musl.patch"
+)
src_prepare() {
sed -e "s:get_version ( \"1.0.0\" ):get_version ( \"${PV}\" ):" -i CMakeLists.txt || die
diff --git a/dev-libs/roct-thunk-interface/roct-thunk-interface-6.0.0.ebuild b/dev-libs/roct-thunk-interface/roct-thunk-interface-6.0.0-r1.ebuild
index 353f0030f362..83c87c70b2d3 100644
--- a/dev-libs/roct-thunk-interface/roct-thunk-interface-6.0.0.ebuild
+++ b/dev-libs/roct-thunk-interface/roct-thunk-interface-6.0.0-r1.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2023 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
@@ -26,7 +26,10 @@ BDEPEND="x11-libs/libdrm[video_cards_amdgpu]"
CMAKE_BUILD_TYPE=Release
-PATCHES=( "${FILESDIR}/${PN}-6.0.0-functions.patch" )
+PATCHES=(
+ "${FILESDIR}/${PN}-6.0.0-functions.patch"
+ "${FILESDIR}/${PN}-5.7.1-musl.patch"
+)
src_prepare() {
sed -e "s:get_version ( \"1.0.0\" ):get_version ( \"${PV}\" ):" -i CMakeLists.txt || die