Skip to content

Commit

Permalink
simplify
Browse files Browse the repository at this point in the history
learned tricks from mozilla#306
  • Loading branch information
ggreif committed Apr 25, 2023
1 parent 5839c74 commit 33cdcdd
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions rust-overlay.nix
Original file line number Diff line number Diff line change
Expand Up @@ -290,22 +290,18 @@ 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.
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|dylib} 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)
cp --remove-destination $RUSTC_DRIVER_PATH $out/lib/
fi
if ls $out/lib/librustc_driver-*.dylib &>/dev/null; then
RUSTC_DRIVER_PATH=$(realpath -e $out/lib/librustc_driver-*.dylib)
if ls $out/lib/librustc_driver-*.{so,dylib} &>/dev/null; then
RUSTC_DRIVER_PATH=$(realpath -e $out/lib/librustc_driver-*.{so,dylib})
cp --remove-destination $RUSTC_DRIVER_PATH $out/lib/
fi
'';
Expand Down

0 comments on commit 33cdcdd

Please sign in to comment.