From 65a6502a69c4208fd326da0596feaa57de15328e Mon Sep 17 00:00:00 2001 From: Benjamin Lee Date: Sat, 25 May 2024 02:03:21 -0700 Subject: [PATCH] rocksdb: add enableLiburing option --- .../development/libraries/rocksdb/default.nix | 6 ++++ .../libraries/rocksdb/fix-findliburing.patch | 29 +++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 pkgs/development/libraries/rocksdb/fix-findliburing.patch diff --git a/pkgs/development/libraries/rocksdb/default.nix b/pkgs/development/libraries/rocksdb/default.nix index af52b6a9fa7c..9f662a8b1479 100644 --- a/pkgs/development/libraries/rocksdb/default.nix +++ b/pkgs/development/libraries/rocksdb/default.nix @@ -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" diff --git a/pkgs/development/libraries/rocksdb/fix-findliburing.patch b/pkgs/development/libraries/rocksdb/fix-findliburing.patch new file mode 100644 index 000000000000..c546577813ce --- /dev/null +++ b/pkgs/development/libraries/rocksdb/fix-findliburing.patch @@ -0,0 +1,29 @@ +From 23432b7958ecea64b49ba680767ea5dc696768c9 Mon Sep 17 00:00:00 2001 +From: Benjamin Lee +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 +