summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Szuba <marecki@gentoo.org>2021-09-02 11:46:37 +0100
committerMarek Szuba <marecki@gentoo.org>2021-09-02 11:50:55 +0100
commit9a5672672cbda260a4fb713a266f50f4724f23df (patch)
tree3852672cc77b1b83ba3f2945a5b18d270eb5a1c9 /dev-libs/rocksdb
parentnet-dns/unbound: add tfo USE flag (diff)
downloadgentoo-9a5672672cbda260a4fb713a266f50f4724f23df.tar.gz
gentoo-9a5672672cbda260a4fb713a266f50f4724f23df.tar.bz2
gentoo-9a5672672cbda260a4fb713a266f50f4724f23df.zip
dev-libs/rocksdb: apply upstream libatomic check
Will have already been included in 6.20.2+. Closes: https://bugs.gentoo.org/809830 Signed-off-by: Marek Szuba <marecki@gentoo.org>
Diffstat (limited to 'dev-libs/rocksdb')
-rw-r--r--dev-libs/rocksdb/files/rocksdb-6.14.6-libatomic.patch118
-rw-r--r--dev-libs/rocksdb/rocksdb-6.15.5.ebuild4
-rw-r--r--dev-libs/rocksdb/rocksdb-6.17.3.ebuild4
3 files changed, 105 insertions, 21 deletions
diff --git a/dev-libs/rocksdb/files/rocksdb-6.14.6-libatomic.patch b/dev-libs/rocksdb/files/rocksdb-6.14.6-libatomic.patch
index 5ffcc8eee9ff..27f17aab8933 100644
--- a/dev-libs/rocksdb/files/rocksdb-6.14.6-libatomic.patch
+++ b/dev-libs/rocksdb/files/rocksdb-6.14.6-libatomic.patch
@@ -1,29 +1,105 @@
+From 38d79de10da65d234c70cbb36c24c58d189f76db Mon Sep 17 00:00:00 2001
+From: mrambacher <mrambach@gmail.com>
+Date: Mon, 12 Apr 2021 20:06:57 -0400
+Subject: [PATCH 1/3] Add check to cmake to see if we need to link against
+ -latomic
+
+For some compilers/environments (e.g. Clang, riscv64), we need to link against -latomic. Check if this is a requirement and add the library to the third-party libs if it is.
+---
+ CMakeLists.txt | 21 ++++++++++++++++++++-
+ 1 file changed, 20 insertions(+), 1 deletion(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 984c6197cb..460d350054 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
-@@ -325,6 +325,26 @@
- add_definitions(-DROCKSDB_SUPPORT_THREAD_LOCAL)
+@@ -312,7 +312,6 @@ int main() {
+ auto d = _mm_cvtsi128_si64(c);
+ }
+ " HAVE_SSE42)
+-unset(CMAKE_REQUIRED_FLAGS)
+ if(HAVE_SSE42)
+ add_definitions(-DHAVE_SSE42)
+ add_definitions(-DHAVE_PCLMUL)
+@@ -320,6 +319,26 @@ elseif(FORCE_SSE42)
+ message(FATAL_ERROR "FORCE_SSE42=ON but unable to compile with SSE4.2 enabled")
endif()
-+set(ATOMIC_TEST_SOURCE "
++# Check if -latomic is required or not
++if (NOT MSVC)
++ set(CMAKE_REQUIRED_FLAGS "--std=c++11")
++ CHECK_CXX_SOURCE_COMPILES("
+#include <atomic>
++std::atomic<uint64_t> x(0);
+int main() {
-+ std::atomic<bool> y (false);
-+ std::atomic<uint64_t> x (0);
-+ bool expected = true;
-+ bool j = y.compare_exchange_weak(expected,false);
-+ x++;
++ uint64_t i = x.load(std::memory_order_relaxed);
++ bool b = x.is_lock_free();
+ return 0;
-+}")
-+CHECK_CXX_SOURCE_COMPILES("${ATOMIC_TEST_SOURCE}" ATOMICS_ARE_BUILTIN)
-+if (NOT ATOMICS_ARE_BUILTIN)
-+ set(CMAKE_REQUIRED_LIBRARIES atomic)
-+ check_cxx_source_compiles("${ATOMIC_TEST_SOURCE}" ATOMICS_REQUIRE_LIBATOMIC)
-+ unset(CMAKE_REQUIRED_LIBRARIES)
-+ if (ATOMICS_REQUIRE_LIBATOMIC)
-+ string(APPEND CMAKE_CXX_STANDARD_LIBRARIES " -latomic")
-+ endif ()
-+endif ()
++}
++" BUILTIN_ATOMIC)
++if (NOT BUILTIN_ATOMIC)
++ #TODO: Check if -latomic exists
++ list(APPEND THIRDPARTY_LIBS atomic)
++endif()
++endif()
+
- option(FAIL_ON_WARNINGS "Treat compile warnings as errors" ON)
- if(FAIL_ON_WARNINGS)
- if(MSVC)
++unset(CMAKE_REQUIRED_FLAGS)
++
+ CHECK_CXX_SOURCE_COMPILES("
+ #if defined(_MSC_VER) && !defined(__thread)
+ #define __thread __declspec(thread)
+
+From df7fdd69ac19f26601a80e35f70ec51913838a6e Mon Sep 17 00:00:00 2001
+From: mrambacher <mrambach@gmail.com>
+Date: Wed, 14 Apr 2021 10:33:47 -0400
+Subject: [PATCH 2/3] Reset CMAKE_REQUIRED_FLAGS after compilation checks
+
+---
+ CMakeLists.txt | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 460d350054..5d167855a7 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -296,6 +296,7 @@ else()
+ endif()
+
+ include(CheckCXXSourceCompiles)
++set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
+ if(NOT MSVC)
+ set(CMAKE_REQUIRED_FLAGS "-msse4.2 -mpclmul")
+ endif()
+@@ -337,7 +338,8 @@ if (NOT BUILTIN_ATOMIC)
+ endif()
+ endif()
+
+-unset(CMAKE_REQUIRED_FLAGS)
++# Reset the required flags
++set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
+
+ CHECK_CXX_SOURCE_COMPILES("
+ #if defined(_MSC_VER) && !defined(__thread)
+
+From 4793c5c75351d5d7c609c27d0243c2138729c7b0 Mon Sep 17 00:00:00 2001
+From: mrambacher <mrambach@gmail.com>
+Date: Fri, 16 Apr 2021 08:53:48 -0400
+Subject: [PATCH 3/3] Fix lint warning
+
+---
+ CMakeLists.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 5d167855a7..558b985073 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -333,7 +333,7 @@ int main() {
+ }
+ " BUILTIN_ATOMIC)
+ if (NOT BUILTIN_ATOMIC)
+- #TODO: Check if -latomic exists
++ #TODO: Check if -latomic exists
+ list(APPEND THIRDPARTY_LIBS atomic)
+ endif()
+ endif()
diff --git a/dev-libs/rocksdb/rocksdb-6.15.5.ebuild b/dev-libs/rocksdb/rocksdb-6.15.5.ebuild
index eca7931e3752..c8bb53cec446 100644
--- a/dev-libs/rocksdb/rocksdb-6.15.5.ebuild
+++ b/dev-libs/rocksdb/rocksdb-6.15.5.ebuild
@@ -25,6 +25,10 @@ DEPEND="
"
RDEPEND="${DEPEND}"
+PATCHES=(
+ "${FILESDIR}"/${PN}-6.14.6-libatomic.patch
+)
+
src_configure() {
mycmakeargs=(
-DFAIL_ON_WARNINGS=OFF
diff --git a/dev-libs/rocksdb/rocksdb-6.17.3.ebuild b/dev-libs/rocksdb/rocksdb-6.17.3.ebuild
index e441ef854c8d..76c4d651f8af 100644
--- a/dev-libs/rocksdb/rocksdb-6.17.3.ebuild
+++ b/dev-libs/rocksdb/rocksdb-6.17.3.ebuild
@@ -25,6 +25,10 @@ DEPEND="
"
RDEPEND="${DEPEND}"
+PATCHES=(
+ "${FILESDIR}"/${PN}-6.14.6-libatomic.patch
+)
+
src_configure() {
mycmakeargs=(
-DFAIL_ON_WARNINGS=OFF