Merge pull request #314945 from Benjamin-L/rocksdb-uring-option

rocksdb: add enableLiburing option
This commit is contained in:
superherointj
2024-06-18 20:06:26 -03:00
committed by GitHub
3 changed files with 43 additions and 0 deletions
@@ -19,6 +19,8 @@ stdenv.mkDerivation rec {
enableParallelBuilding = true;
# Upstream's configure script is not autoconf generated, but a hand written one.
setOutputFlags = false;
dontDisableStatic = true;
dontAddStaticConfigureFlags = true;
configureFlags = [
"--includedir=${placeholder "dev"}/include"
"--mandir=${placeholder "man"}/share/man"
@@ -35,6 +37,12 @@ stdenv.mkDerivation rec {
];
postInstall = ''
# Always builds both static and dynamic libraries, so we need to remove the
# libraries that don't match stdenv type.
rm $out/lib/liburing*${
if stdenv.hostPlatform.isStatic then ".so*" else ".a"
}
# Copy the examples into $bin. Most reverse dependency of
# this package should reference only the $out output
for file in $(find ./examples -executable -type f); do
@@ -11,6 +11,8 @@
, windows
, enableJemalloc ? false
, jemalloc
, enableLiburing ? true
, liburing
, enableShared ? !stdenv.hostPlatform.isStatic
, sse42Support ? stdenv.hostPlatform.sse4_2Support
}:
@@ -26,11 +28,14 @@ stdenv.mkDerivation (finalAttrs: {
hash = "sha256-Zifn5Gu/4h6TaEqSaWQ2mFdryeAarqbHWW3fKUGGFac=";
};
patches = [ ./fix-findliburing.patch ];
nativeBuildInputs = [ cmake ninja ];
propagatedBuildInputs = [ bzip2 lz4 snappy zlib zstd ];
buildInputs = lib.optional enableJemalloc jemalloc
++ lib.optional enableLiburing liburing
++ lib.optional stdenv.hostPlatform.isMinGW windows.mingw_w64_pthreads;
outputs = [
@@ -45,6 +50,7 @@ stdenv.mkDerivation (finalAttrs: {
cmakeFlags = [
"-DPORTABLE=1"
"-DWITH_JEMALLOC=${if enableJemalloc then "1" else "0"}"
"-DWITH_LIBURING=${if enableLiburing then "1" else "0"}"
"-DWITH_JNI=0"
"-DWITH_BENCHMARK_TOOLS=0"
"-DWITH_TESTS=1"
@@ -0,0 +1,29 @@
From 23432b7958ecea64b49ba680767ea5dc696768c9 Mon Sep 17 00:00:00 2001
From: Benjamin Lee <benjamin@computer.surgery>
Date: Sun, 26 May 2024 17:17:01 -0700
Subject: [PATCH] fix findliburing
`find_package(... NAMES lib*)` is basically always wrong. The previous
code was just hardcoding the static library path to work around the fact
that this doesn't work. This breaks the build when only dynamic liburing
builds are available.
---
cmake/modules/Finduring.cmake | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cmake/modules/Finduring.cmake b/cmake/modules/Finduring.cmake
index 8cb14cb27..87f2df474 100644
--- a/cmake/modules/Finduring.cmake
+++ b/cmake/modules/Finduring.cmake
@@ -7,7 +7,7 @@
find_path(uring_INCLUDE_DIR
NAMES liburing.h)
find_library(uring_LIBRARIES
- NAMES liburing.a liburing)
+ NAMES uring)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(uring
--
2.44.0