Skip to content

Commit

Permalink
Handle Darwin too w.r.t. SYSROOT detection fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ggreif committed Apr 26, 2023
1 parent 78e7239 commit c72bae8
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions rust-overlay.nix
Original file line number Diff line number Diff line change
Expand Up @@ -289,19 +289,20 @@ let
cp --remove-destination "$(realpath -e $target)" $target
fi
# The SYSROOT is determined by using the librustc_driver-*.so.
# The SYSROOT is determined by using the librustc_driver-*.{so,dylib}.
# So, we need to point to the *.so files in our derivation.
chmod u+w $target
patchelf --set-rpath "$out/lib" $target || true
shopt -u nullglob
if ls $out/lib/*.so &>/dev/null; then
chmod u+w $target
patchelf --set-rpath "$out/lib" $target || true
fi
done
# Here we copy the librustc_driver-*.so to our derivation.
# Here we copy the librustc_driver-*.{so,dylib} to our derivation.
# The SYSROOT is determined based on the path of this library.
if ls $out/lib/librustc_driver-*.so &> /dev/null; then
RUSTC_DRIVER_PATH=$(realpath -e $out/lib/librustc_driver-*.so)
rm $out/lib/librustc_driver-*.so
cp $RUSTC_DRIVER_PATH $out/lib/
fi
shopt -s nullglob
RUSTC_DRIVER_PATH=$(realpath -e $out/lib/librustc_driver-*.{so,dylib})
cp --remove-destination $RUSTC_DRIVER_PATH $out/lib/
'';

# Export the manifest file as part of the nix-support files such
Expand Down

0 comments on commit c72bae8

Please sign in to comment.