From 17c76b0312a9ca0cf15fc02f73f7a998b3c1c7a7 Mon Sep 17 00:00:00 2001 From: Ihar Hrachyshka Date: Wed, 15 Jan 2025 19:20:56 -0500 Subject: [PATCH] libspatialindex: fix on Darwin Recent bump to 2.1.0 changed the soversion from 7 to 8. It broke python3-rtree as follows: OSError: Could not load libspatialindex_c library Instead of bumping the version in postFixup, disable rpath in cmake instructions. Co-Authored-By: Reno Dakota --- .../li/libspatialindex/no-rpath-for-darwin.diff | 11 +++++++++++ pkgs/by-name/li/libspatialindex/package.nix | 11 +++++------ 2 files changed, 16 insertions(+), 6 deletions(-) create mode 100644 pkgs/by-name/li/libspatialindex/no-rpath-for-darwin.diff diff --git a/pkgs/by-name/li/libspatialindex/no-rpath-for-darwin.diff b/pkgs/by-name/li/libspatialindex/no-rpath-for-darwin.diff new file mode 100644 index 000000000000..d26dec8cdb99 --- /dev/null +++ b/pkgs/by-name/li/libspatialindex/no-rpath-for-darwin.diff @@ -0,0 +1,11 @@ +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -248,7 +248,7 @@ if(HAVE_BCOPY) + endif() + + +-if(APPLE) ++if(FALSE) + set(MACOSX_RPATH ON) + set_target_properties(spatialindex spatialindex_c + PROPERTIES INSTALL_NAME_DIR "@rpath") diff --git a/pkgs/by-name/li/libspatialindex/package.nix b/pkgs/by-name/li/libspatialindex/package.nix index 1c07b6dae6ea..ad39600beb19 100644 --- a/pkgs/by-name/li/libspatialindex/package.nix +++ b/pkgs/by-name/li/libspatialindex/package.nix @@ -3,7 +3,6 @@ stdenv, fetchFromGitHub, cmake, - fixDarwinDylibNames, }: stdenv.mkDerivation (finalAttrs: { @@ -17,11 +16,15 @@ stdenv.mkDerivation (finalAttrs: { hash = "sha256-a2CzRLHdQMnVhHZhwYsye4X644r8gp1m6vU2CJpSRpU="; }; + patches = [ + ./no-rpath-for-darwin.diff + ]; + postPatch = '' patchShebangs test/ ''; - nativeBuildInputs = [ cmake ] ++ lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames; + nativeBuildInputs = [ cmake ]; cmakeFlags = [ (lib.cmakeBool "BUILD_TESTING" finalAttrs.finalPackage.doCheck) @@ -37,10 +40,6 @@ stdenv.mkDerivation (finalAttrs: { doCheck = true; - postFixup = lib.optionalString stdenv.hostPlatform.isDarwin '' - install_name_tool -change "@rpath/libspatialindex.7.dylib" "$out/lib/libspatialindex.7.dylib" $out/lib/libspatialindex_c.dylib - ''; - meta = { description = "Extensible spatial index library in C++"; homepage = "https://libspatialindex.org";