From a6e9ce3304fd708c7021d8a9b677e1ed784e0fe1 Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Mon, 28 Sep 2026 15:59:05 -0400 Subject: [PATCH] swiftPackages.swift-collections: add rpaths to support backdeployment --- .../swift/by-name/sw/swift-collections/package.nix | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pkgs/development/compilers/swift/by-name/sw/swift-collections/package.nix b/pkgs/development/compilers/swift/by-name/sw/swift-collections/package.nix index b9ba08469736..2457bd35eb4b 100644 --- a/pkgs/development/compilers/swift/by-name/sw/swift-collections/package.nix +++ b/pkgs/development/compilers/swift/by-name/sw/swift-collections/package.nix @@ -5,6 +5,7 @@ gitUpdater, ninja, stdenv, + stdlib, swift-minimal, }: @@ -59,6 +60,16 @@ stdenv.mkDerivation (finalAttrs: { --replace-fail '@include@' "''${!outputDev}" \ --replace-fail '@lib@' "''${!outputLib}" \ --replace-fail '@swiftPlatform@' ${stdenv.hostPlatform.swift.platform} + '' + # The CMake build doesn’t include the Span backdeploy, but we need it to support all supported deployment targets. + + lib.optionalString stdenv.hostPlatform.isDarwin '' + for dylib in "''${!outputLib}/lib"/*.dylib; do + if otool -L "$dylib" | grep -q "libswiftCompatibilitySpan.dylib"; then + install_name_tool "$dylib" \ + -add_rpath /usr/lib/swift \ + -add_rpath ${lib.escapeShellArg (lib.getLib stdlib)}/lib/swift-6.2/macosx + fi + done ''; __structuredAttrs = true;