From 682ebc001bdfaecbfea0372f6ee9d91a7cc34faa Mon Sep 17 00:00:00 2001 From: Tobias Mayer Date: Sun, 23 Jun 2024 20:47:25 +0200 Subject: [PATCH] lz4: patch cmake to generate unified target Fixes building `arrow-cpp`. --- .../0001-Create-a-unified-lz4-target.patch | 34 +++++++++++++++++++ pkgs/tools/compression/lz4/default.nix | 8 ++--- 2 files changed, 36 insertions(+), 6 deletions(-) create mode 100644 pkgs/tools/compression/lz4/0001-Create-a-unified-lz4-target.patch diff --git a/pkgs/tools/compression/lz4/0001-Create-a-unified-lz4-target.patch b/pkgs/tools/compression/lz4/0001-Create-a-unified-lz4-target.patch new file mode 100644 index 000000000000..4092d232a0a3 --- /dev/null +++ b/pkgs/tools/compression/lz4/0001-Create-a-unified-lz4-target.patch @@ -0,0 +1,34 @@ +From 14fca2e93bd783c0ad2362af6d69801c2073765d Mon Sep 17 00:00:00 2001 +From: Tobias Mayer +Date: Sun, 23 Jun 2024 20:16:00 +0200 +Subject: [PATCH] Create a unified lz4 target + +Includes changes from +* https://github.com/lz4/lz4/pull/1372 +* https://github.com/lz4/lz4/pull/1413 +--- + build/cmake/CMakeLists.txt | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/build/cmake/CMakeLists.txt b/build/cmake/CMakeLists.txt +index eb7007b..07ddd2b 100644 +--- a/build/cmake/CMakeLists.txt ++++ b/build/cmake/CMakeLists.txt +@@ -130,6 +130,14 @@ if(BUILD_STATIC_LIBS) + POSITION_INDEPENDENT_CODE ${LZ4_POSITION_INDEPENDENT_LIB}) + list(APPEND LZ4_LIBRARIES_BUILT lz4_static) + endif() ++# Add unified target. ++add_library(lz4 INTERFACE) ++list(APPEND LZ4_LIBRARIES_BUILT lz4) ++if(BUILD_SHARED_LIBS) ++ target_link_libraries(lz4 INTERFACE lz4_shared) ++else() ++ target_link_libraries(lz4 INTERFACE lz4_static) ++endif() + + if(BUILD_STATIC_LIBS) + set(LZ4_LINK_LIBRARY lz4_static) +-- +2.45.1 + diff --git a/pkgs/tools/compression/lz4/default.nix b/pkgs/tools/compression/lz4/default.nix index a2069c4fb64f..49927a9ffbc0 100644 --- a/pkgs/tools/compression/lz4/default.nix +++ b/pkgs/tools/compression/lz4/default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, fetchFromGitHub, fetchpatch, cmake +{ lib, stdenv, fetchFromGitHub, cmake , valgrind, testers }: @@ -24,11 +24,7 @@ stdenv.mkDerivation (finalAttrs: { outputs = [ "dev" "lib" "man" "out" ]; patches = [ - (fetchpatch { # https://github.com/lz4/lz4/pull/1162 - name = "build-shared-no.patch"; - url = "https://github.com/lz4/lz4/commit/851ef4b23c7cbf4ceb2ba1099666a8b5ec4fa195.patch"; - hash = "sha256-P+/uz3m7EAmHgXF/1Vncc0uKKxNVq6HNIsElx0rGxpw="; - }) + ./0001-Create-a-unified-lz4-target.patch ]; cmakeDir = "../build/cmake";