OK.

On 2023-10-28 6:16 a.m., Rafael Sadowski wrote:
Here is a diff to remove syscall(2) in boost. I have deliberately worked
with defined(__OpenBSD__) so that this can also push to upstream.

OK?

diff --git a/devel/boost/Makefile b/devel/boost/Makefile
index 91f25cb5c9e..2eec1a35b88 100644
--- a/devel/boost/Makefile
+++ b/devel/boost/Makefile
@@ -12,7 +12,7 @@ VERSION=      1.80.0
  EPOCH =               0
  DISTNAME=     boost_${VERSION:S/./_/g}
  PKGNAME=      boost-${VERSION}
-REVISION-main= 2
+REVISION-main= 3
  CATEGORIES=   devel
  SITES=        
https://boostorg.jfrog.io/artifactory/main/release/${VERSION}/source/
  EXTRACT_SUFX= .tar.bz2
diff --git a/devel/boost/patches/patch-boost_atomic_detail_futex_hpp 
b/devel/boost/patches/patch-boost_atomic_detail_futex_hpp
new file mode 100644
index 00000000000..c0ef4696a26
--- /dev/null
+++ b/devel/boost/patches/patch-boost_atomic_detail_futex_hpp
@@ -0,0 +1,45 @@
+Index: boost/atomic/detail/futex.hpp
+--- boost/atomic/detail/futex.hpp.orig
++++ boost/atomic/detail/futex.hpp
+@@ -23,7 +23,7 @@
+ #pragma once
+ #endif
+
+-#if defined(__linux__) || defined(__OpenBSD__) || defined(__NETBSD__) || 
defined(__NetBSD__)
++#if defined(__linux__) || defined(__NETBSD__) || defined(__NetBSD__)
+
+ #include <sys/syscall.h>
+
+@@ -45,8 +45,9 @@
+ #define BOOST_ATOMIC_DETAIL_NETBSD_FUTEX
+ #endif
+
+-#if defined(BOOST_ATOMIC_DETAIL_SYS_FUTEX)
+
++#if defined(BOOST_ATOMIC_DETAIL_SYS_FUTEX) || defined(__OpenBSD__)
++
+ #include <cstddef>
+ #if defined(__linux__)
+ #include <linux/futex.h>
+@@ -74,7 +75,9 @@ namespace detail {
+ //! Invokes an operation on the futex
+ BOOST_FORCEINLINE int futex_invoke(void* addr1, int op, unsigned int val1, 
const void* timeout = NULL, void* addr2 = NULL, unsigned int val3 = 0) 
BOOST_NOEXCEPT
+ {
+-#if !defined(BOOST_ATOMIC_DETAIL_NETBSD_FUTEX)
++#if defined(__OpenBSD__)
++    return ::futex(addr1, op, val1, timeout, addr2, 0u, val3);
++#elif !defined(BOOST_ATOMIC_DETAIL_NETBSD_FUTEX)
+     return ::syscall(BOOST_ATOMIC_DETAIL_SYS_FUTEX, addr1, op, val1, timeout, 
addr2, val3);
+ #else
+     // Pass 0 in val2.
+@@ -85,7 +88,9 @@ BOOST_FORCEINLINE int futex_invoke(void* addr1, int op
+ //! Invokes an operation on the futex
+ BOOST_FORCEINLINE int futex_invoke(void* addr1, int op, unsigned int val1, 
unsigned int val2, void* addr2 = NULL, unsigned int val3 = 0) BOOST_NOEXCEPT
+ {
+-#if !defined(BOOST_ATOMIC_DETAIL_NETBSD_FUTEX)
++#if defined(__OpenBSD__)
++    return futex(addr1, op, val1, static_cast< void* >(NULL), addr2, val2, 
val3);
++#elif !defined(BOOST_ATOMIC_DETAIL_NETBSD_FUTEX)
+     return ::syscall(BOOST_ATOMIC_DETAIL_SYS_FUTEX, addr1, op, val1, 
static_cast< atomics::detail::uintptr_t >(val2), addr2, val3);
+ #else
+     // Pass NULL in timeout.
diff --git a/devel/boost/patches/patch-boost_fiber_detail_futex_hpp 
b/devel/boost/patches/patch-boost_fiber_detail_futex_hpp
new file mode 100644
index 00000000000..e28ae68fc81
--- /dev/null
+++ b/devel/boost/patches/patch-boost_fiber_detail_futex_hpp
@@ -0,0 +1,15 @@
+Index: boost/fiber/detail/futex.hpp
+--- boost/fiber/detail/futex.hpp.orig
++++ boost/fiber/detail/futex.hpp
+@@ -32,7 +32,11 @@ namespace detail {
+ #if BOOST_OS_LINUX
+ BOOST_FORCEINLINE
+ int sys_futex( void * addr, std::int32_t op, std::int32_t x) {
++if defined(__OpenBSD__)
++    return ::futex(addr, op, x, nullptr, nullptr, 0);
++#else
+     return ::syscall( SYS_futex, addr, op, x, nullptr, nullptr, 0);
++#endif
+ }
+
+ BOOST_FORCEINLINE
diff --git a/devel/boost/patches/patch-libs_filesystem_src_unique_path_cpp 
b/devel/boost/patches/patch-libs_filesystem_src_unique_path_cpp
new file mode 100644
index 00000000000..c80f6458c4e
--- /dev/null
+++ b/devel/boost/patches/patch-libs_filesystem_src_unique_path_cpp
@@ -0,0 +1,22 @@
+Index: libs/filesystem/src/unique_path.cpp
+--- libs/filesystem/src/unique_path.cpp.orig
++++ libs/filesystem/src/unique_path.cpp
+@@ -36,7 +36,8 @@
+
+ #if !defined(BOOST_FILESYSTEM_DISABLE_GETRANDOM)
+ #if (defined(__linux__) || defined(__linux) || defined(linux)) && \
+-    (!defined(__ANDROID__) || __ANDROID_API__ >= 28)
++    (!defined(__ANDROID__) || __ANDROID_API__ >= 28) \
++    && !defined(__OpenBSD)
+ #include <sys/syscall.h>
+ #if defined(SYS_getrandom)
+ #define BOOST_FILESYSTEM_HAS_GETRANDOM_SYSCALL
+@@ -46,7 +47,7 @@
+ #define BOOST_FILESYSTEM_HAS_GETRANDOM
+ #endif
+ #elif defined(__GLIBC__)
+-#if __GLIBC_PREREQ(2, 25)
++#if __GLIBC_PREREQ(2, 25) || defined(__OpenBSD__)
+ #define BOOST_FILESYSTEM_HAS_GETRANDOM
+ #endif
+ #endif // BOOST_FILESYSTEM_HAS_GETRANDOM definition
diff --git a/devel/boost/patches/patch-libs_log_src_posix_object_name_cpp 
b/devel/boost/patches/patch-libs_log_src_posix_object_name_cpp
new file mode 100644
index 00000000000..a2e66a4aec2
--- /dev/null
+++ b/devel/boost/patches/patch-libs_log_src_posix_object_name_cpp
@@ -0,0 +1,21 @@
+Index: libs/log/src/posix/object_name.cpp
+--- libs/log/src/posix/object_name.cpp.orig
++++ libs/log/src/posix/object_name.cpp
+@@ -16,7 +16,7 @@
+ #include <boost/log/detail/config.hpp>
+ #include <unistd.h>
+ #include <sys/types.h>
+-#if defined(__ANDROID__) && (__ANDROID_API__+0) < 21
++#if defined(__ANDROID__) && (__ANDROID_API__+0) < 21 && !defined(__OpenBSD__)
+ #include <sys/syscall.h>
+ #endif
+ #if !defined(BOOST_LOG_NO_GETPWUID_R)
+@@ -44,7 +44,7 @@ namespace ipc {
+
+ BOOST_LOG_ANONYMOUS_NAMESPACE {
+
+-#if defined(__ANDROID__) && (__ANDROID_API__+0) < 21
++#if defined(__ANDROID__) && (__ANDROID_API__+0) < 21 && !defined(__OpenBSD__)
+ // Until Android API version 21 NDK does not define getsid wrapper in libc, 
although there is the corresponding syscall
+ inline pid_t getsid(pid_t pid) BOOST_NOEXCEPT
+ {


Reply via email to