From 0a855f19729d4a980a6a77369c433bed6878b339 Mon Sep 17 00:00:00 2001 From: figsoda Date: Sun, 6 Nov 2022 21:32:10 -0500 Subject: [PATCH] fix sysroot resolution --- lib/combine.nix | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/lib/combine.nix b/lib/combine.nix index 44324123..837cea12 100644 --- a/lib/combine.nix +++ b/lib/combine.nix @@ -1,13 +1,25 @@ -{ lib, symlinkJoin }: +{ lib, symlinkJoin, zlib, stdenv }: name: paths: symlinkJoin { inherit name paths; postBuild = '' - if [ -d $out/bin ]; then - cp --remove-destination $(realpath $out/bin/*) $out/bin - fi + for file in $(find $out/bin -xtype f); do + install -m755 $(realpath "$file") $out/bin + + ${lib.optionalString stdenv.isLinux '' + patchelf --set-rpath $out/lib "$file" || true + ''} + + ${lib.optionalString stdenv.isDarwin '' + install_name_tool -add_rpath $out/lib "$file" || true + ''} + done + + for file in $(find $out/lib -name "librustc_driver-*"); do + install $(realpath "$file") $out/lib + done ''; meta.platforms = lib.platforms.all; }