Skip to content

Commit c72bae8

Browse files
committed
Handle Darwin too w.r.t. SYSROOT detection fix
1 parent 78e7239 commit c72bae8

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

rust-overlay.nix

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -289,19 +289,20 @@ let
289289
cp --remove-destination "$(realpath -e $target)" $target
290290
fi
291291
292-
# The SYSROOT is determined by using the librustc_driver-*.so.
292+
# The SYSROOT is determined by using the librustc_driver-*.{so,dylib}.
293293
# So, we need to point to the *.so files in our derivation.
294-
chmod u+w $target
295-
patchelf --set-rpath "$out/lib" $target || true
294+
shopt -u nullglob
295+
if ls $out/lib/*.so &>/dev/null; then
296+
chmod u+w $target
297+
patchelf --set-rpath "$out/lib" $target || true
298+
fi
296299
done
297300
298-
# Here we copy the librustc_driver-*.so to our derivation.
301+
# Here we copy the librustc_driver-*.{so,dylib} to our derivation.
299302
# The SYSROOT is determined based on the path of this library.
300-
if ls $out/lib/librustc_driver-*.so &> /dev/null; then
301-
RUSTC_DRIVER_PATH=$(realpath -e $out/lib/librustc_driver-*.so)
302-
rm $out/lib/librustc_driver-*.so
303-
cp $RUSTC_DRIVER_PATH $out/lib/
304-
fi
303+
shopt -s nullglob
304+
RUSTC_DRIVER_PATH=$(realpath -e $out/lib/librustc_driver-*.{so,dylib})
305+
cp --remove-destination $RUSTC_DRIVER_PATH $out/lib/
305306
'';
306307

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

0 commit comments

Comments
 (0)