public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: dev-libs/rocksdb/, dev-libs/rocksdb/files/
@ 2022-03-19  4:15 Yixun Lan
  0 siblings, 0 replies; 3+ messages in thread
From: Yixun Lan @ 2022-03-19  4:15 UTC (permalink / raw
  To: gentoo-commits

commit:     b005163fb832df44f7c0cabeb7b54b7d7ea61080
Author:     Yun Pan <dinoallo <AT> netc <DOT> it>
AuthorDate: Tue Mar 15 14:45:12 2022 +0000
Commit:     Yixun Lan <dlan <AT> gentoo <DOT> org>
CommitDate: Sat Mar 19 04:09:20 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b005163f

dev-libs/rocksdb: add timer for riscv platform

See: https://bugs.gentoo.org/834855#c3
Related upstream PR: https://github.com/facebook/rocksdb/pull/9215

Bug: https://bugs.gentoo.org/834855
Signed-off-by: Yun Pan <dinoallo <AT> netc.it>
Signed-off-by: Yixun Lan <dlan <AT> gentoo.org>

 .../files/rocksdb-6.17.3-add_timer_for_riscv.patch | 40 ++++++++++++++++++++++
 dev-libs/rocksdb/rocksdb-6.17.3.ebuild             |  1 +
 2 files changed, 41 insertions(+)

diff --git a/dev-libs/rocksdb/files/rocksdb-6.17.3-add_timer_for_riscv.patch b/dev-libs/rocksdb/files/rocksdb-6.17.3-add_timer_for_riscv.patch
new file mode 100644
index 000000000000..b98cc9dc5fd6
--- /dev/null
+++ b/dev-libs/rocksdb/files/rocksdb-6.17.3-add_timer_for_riscv.patch
@@ -0,0 +1,40 @@
+Add timer for riscv.
+Upstream PR status: https://github.com/facebook/rocksdb/pull/9215
+This PR hasn't been merged into the main branch.
+https://bugs.gentoo.org/834855
+
+--- a/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h
++++ b/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h
+@@ -101,7 +101,7 @@ int toku_clock_gettime(clockid_t clk_id, struct timespec *ts) __attribute__((__v
+ typedef uint64_t tokutime_t;  // Time type used in by tokutek timers.
+ 
+ #if 0
+-// The value of tokutime_t is not specified here. 
++// The value of tokutime_t is not specified here.
+ // It might be microseconds since 1/1/1970 (if gettimeofday() is
+ // used), or clock cycles since boot (if rdtsc is used).  Or something
+ // else.
+@@ -133,6 +133,23 @@ static inline tokutime_t toku_time_now(void) {
+   return result;
+ #elif defined(__powerpc__)
+   return __ppc_get_timebase();
++#elif defined(__riscv) && __riscv_xlen == 32
++  uint32_t cycles_lo, cycles_hi0, cycles_hi1;
++  // Implemented in assembly because Clang insisted on branching.
++  asm volatile(
++               "rdcycleh %0\n"
++               "rdcycle %1\n"
++               "rdcycleh %2\n"
++               "sub %0, %0, %2\n"
++               "seqz %0, %0\n"
++               "sub %0, zero, %0\n"
++               "and %1, %1, %0\n"
++               : "=r"(cycles_hi0), "=r"(cycles_lo), "=r"(cycles_hi1));
++  return (static_cast<uint64_t>(cycles_hi1) << 32) | cycles_lo;
++#elif defined(__riscv) && __riscv_xlen == 64
++  uint64_t cycles;
++  asm volatile("rdcycle %0" : "=r"(cycles));
++  return cycles;
+ #else
+ #error No timer implementation for this platform
+ #endif

diff --git a/dev-libs/rocksdb/rocksdb-6.17.3.ebuild b/dev-libs/rocksdb/rocksdb-6.17.3.ebuild
index 76c4d651f8af..b01c64b2d2f8 100644
--- a/dev-libs/rocksdb/rocksdb-6.17.3.ebuild
+++ b/dev-libs/rocksdb/rocksdb-6.17.3.ebuild
@@ -27,6 +27,7 @@ RDEPEND="${DEPEND}"
 
 PATCHES=(
 	"${FILESDIR}"/${PN}-6.14.6-libatomic.patch
+	"${FILESDIR}"/${PN}-6.17.3-add_timer_for_riscv.patch
 )
 
 src_configure() {


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-libs/rocksdb/, dev-libs/rocksdb/files/
@ 2022-03-19  4:15 Yixun Lan
  0 siblings, 0 replies; 3+ messages in thread
From: Yixun Lan @ 2022-03-19  4:15 UTC (permalink / raw
  To: gentoo-commits

commit:     678c1515b3327a7876ef8e3e118db4ab9e5d8e63
Author:     Yun Pan <dinoallo <AT> netc <DOT> it>
AuthorDate: Tue Mar 15 14:48:49 2022 +0000
Commit:     Yixun Lan <dlan <AT> gentoo <DOT> org>
CommitDate: Sat Mar 19 04:09:24 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=678c1515

dev-libs/rocksdb: fix check for libatomic

The original patch that comes with rocksdb 6.14.6 is inadequate to
check if libatomic is required on some architectures. The new patch
superseded the old one in version 6.17.3.
Along with patch e8fc99f, rocksdb 6.17.3 can now be compiled on
riscv.

Bug: https://bugs.gentoo.org/834855
Signed-off-by: Yun Pan <dinoallo <AT> netc.it>
Signed-off-by: Yixun Lan <dlan <AT> gentoo.org>

 .../rocksdb/files/rocksdb-6.17.3-libatomic.patch   | 71 ++++++++++++++++++++++
 dev-libs/rocksdb/rocksdb-6.17.3.ebuild             |  2 +-
 2 files changed, 72 insertions(+), 1 deletion(-)

diff --git a/dev-libs/rocksdb/files/rocksdb-6.17.3-libatomic.patch b/dev-libs/rocksdb/files/rocksdb-6.17.3-libatomic.patch
new file mode 100644
index 000000000000..56cc674d09a4
--- /dev/null
+++ b/dev-libs/rocksdb/files/rocksdb-6.17.3-libatomic.patch
@@ -0,0 +1,71 @@
+Fixes check for atomics.
+
+The upstream currently does not have checks for atomics in v6.17.3.
+However, since v6.22.1, rocksdb includes checks similar/identical to 
+files/rocksdb-6.14.6-libatomic.patch, which is superseded by this new patch. 
+See: https://github.com/facebook/rocksdb/commit/47b424f4bd51078591e674ff936de5a270530ce2
+Once the upstream adopts new methods for checking, this patch may be removed after testing.
+
+https://bugs.gentoo.org/834855
+
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -289,6 +289,7 @@ else()
+ endif()
+ 
+ include(CheckCXXSourceCompiles)
++set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
+ if(NOT MSVC)
+   set(CMAKE_REQUIRED_FLAGS "-msse4.2 -mpclmul")
+ endif()
+@@ -305,7 +306,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)
+@@ -313,6 +313,37 @@ elseif(FORCE_SSE42)
+   message(FATAL_ERROR "FORCE_SSE42=ON but unable to compile with SSE4.2 enabled")
+ endif()
+ 
++# Check if -latomic is required or not
++if (NOT MSVC)
++  set(CMAKE_REQUIRED_FLAGS "--std=c++11")
++  set(ATOMIC_TEST_SOURCE "
++	#include <atomic>
++	std::atomic<int> x;
++	std::atomic<short> y;
++	std::atomic<char> z;
++        std::atomic<long long> w;
++	int main() {
++		++z;
++		++y;
++                ++w;
++		return ++x;
++	}")
++  CHECK_CXX_SOURCE_COMPILES("${ATOMIC_TEST_SOURCE}" BUILTIN_ATOMIC)
++  if (NOT BUILTIN_ATOMIC)
++    set(CMAKE_REQUIRED_LIBRARIES atomic)
++    CHECK_CXX_SOURCE_COMPILES("${ATOMIC_TEST_SOURCE}" ATOMICS_REQUIRE_LIBATOMIC)
++    unset(CMAKE_REQUIRED_LIBRARIES)
++    if (ATOMICS_REQUIRE_LIBATOMIC)
++      list(APPEND THIRDPARTY_LIBS atomic)
++    else()
++      message(FATAL_ERROR "Host compiler must support std::atomic!")
++    endif()
++  endif()
++endif()
++
++# Reset the required flags
++set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
++
+ CHECK_CXX_SOURCE_COMPILES("
+ #if defined(_MSC_VER) && !defined(__thread)
+ #define __thread __declspec(thread)
+@@ -1354,3 +1385,4 @@ option(WITH_EXAMPLES "build with examples" OFF)
+ if(WITH_EXAMPLES)
+   add_subdirectory(examples)
+ endif()
++

diff --git a/dev-libs/rocksdb/rocksdb-6.17.3.ebuild b/dev-libs/rocksdb/rocksdb-6.17.3.ebuild
index b01c64b2d2f8..7fc2dc3f43db 100644
--- a/dev-libs/rocksdb/rocksdb-6.17.3.ebuild
+++ b/dev-libs/rocksdb/rocksdb-6.17.3.ebuild
@@ -26,8 +26,8 @@ DEPEND="
 RDEPEND="${DEPEND}"
 
 PATCHES=(
-	"${FILESDIR}"/${PN}-6.14.6-libatomic.patch
 	"${FILESDIR}"/${PN}-6.17.3-add_timer_for_riscv.patch
+	"${FILESDIR}"/${PN}-6.17.3-libatomic.patch
 )
 
 src_configure() {


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-libs/rocksdb/, dev-libs/rocksdb/files/
@ 2022-11-23  0:02 Yixun Lan
  0 siblings, 0 replies; 3+ messages in thread
From: Yixun Lan @ 2022-11-23  0:02 UTC (permalink / raw
  To: gentoo-commits

commit:     d445583c1b8fe28894a60ea0a050313d632c3135
Author:     Yixun Lan <dlan <AT> gentoo <DOT> org>
AuthorDate: Tue Nov 22 23:57:08 2022 +0000
Commit:     Yixun Lan <dlan <AT> gentoo <DOT> org>
CommitDate: Wed Nov 23 00:01:43 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d445583c

dev-libs/rocksdb: update libatomic patch

the old version of rocksdb-6.14.6-libatomic.patch is broken,
and fail to detect libatomic library at riscv64 platform,
so let's update the version from 6.17.3's which works fine.

Signed-off-by: Yixun Lan <dlan <AT> gentoo.org>

 .../rocksdb/files/rocksdb-6.14.6-libatomic.patch   | 105 ---------------------
 dev-libs/rocksdb/rocksdb-6.14.6-r1.ebuild          |   2 +-
 dev-libs/rocksdb/rocksdb-6.15.5.ebuild             |   2 +-
 3 files changed, 2 insertions(+), 107 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
deleted file mode 100644
index 27f17aab8933..000000000000
--- a/dev-libs/rocksdb/files/rocksdb-6.14.6-libatomic.patch
+++ /dev/null
@@ -1,105 +0,0 @@
-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
-@@ -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()
- 
-+# 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() {
-+  uint64_t i = x.load(std::memory_order_relaxed);
-+  bool b = x.is_lock_free();
-+  return 0;
-+}
-+" BUILTIN_ATOMIC)
-+if (NOT BUILTIN_ATOMIC)
-+  #TODO: Check if -latomic exists 
-+  list(APPEND THIRDPARTY_LIBS atomic)
-+endif()
-+endif()
-+
-+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.14.6-r1.ebuild b/dev-libs/rocksdb/rocksdb-6.14.6-r1.ebuild
index e35631d5477c..3ec9e9aee852 100644
--- a/dev-libs/rocksdb/rocksdb-6.14.6-r1.ebuild
+++ b/dev-libs/rocksdb/rocksdb-6.14.6-r1.ebuild
@@ -26,7 +26,7 @@ DEPEND="
 RDEPEND="${DEPEND}"
 
 PATCHES=(
-	"${FILESDIR}"/${PN}-6.14.6-libatomic.patch
+	"${FILESDIR}"/${PN}-6.17.3-libatomic.patch
 )
 
 src_configure() {

diff --git a/dev-libs/rocksdb/rocksdb-6.15.5.ebuild b/dev-libs/rocksdb/rocksdb-6.15.5.ebuild
index f583da0da773..cb835069c451 100644
--- a/dev-libs/rocksdb/rocksdb-6.15.5.ebuild
+++ b/dev-libs/rocksdb/rocksdb-6.15.5.ebuild
@@ -26,7 +26,7 @@ DEPEND="
 RDEPEND="${DEPEND}"
 
 PATCHES=(
-	"${FILESDIR}"/${PN}-6.14.6-libatomic.patch
+	"${FILESDIR}"/${PN}-6.17.3-libatomic.patch
 )
 
 src_configure() {


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-11-23  0:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-23  0:02 [gentoo-commits] repo/gentoo:master commit in: dev-libs/rocksdb/, dev-libs/rocksdb/files/ Yixun Lan
  -- strict thread matches above, loose matches on Subject: below --
2022-03-19  4:15 Yixun Lan
2022-03-19  4:15 Yixun Lan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox