Skip to content

Commit 7c0c15d

Browse files
committed
rust: restore libLLVM symlink
Fixes Homebrew#205571 (comment) This reverts commit c255cc3.
1 parent 9c07042 commit 7c0c15d

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

Formula/r/rust.rb

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,10 @@ class Rust < Formula
122122
end
123123
end
124124

125+
def llvm
126+
Formula["llvm"]
127+
end
128+
125129
def install
126130
# Ensure that the `openssl` crate picks up the intended library.
127131
# https://docs.rs/openssl/latest/openssl/#manual
@@ -169,7 +173,7 @@ def install
169173
--prefix=#{prefix}
170174
--sysconfdir=#{etc}
171175
--tools=#{tools.join(",")}
172-
--llvm-root=#{Formula["llvm"].opt_prefix}
176+
--llvm-root=#{llvm.opt_prefix}
173177
--enable-llvm-link-shared
174178
--enable-profiler
175179
--enable-vendor
@@ -207,6 +211,14 @@ def post_install
207211
MachO.codesign!(dylib) if Hardware::CPU.arm?
208212
chmod 0444, dylib
209213
end
214+
return unless OS.mac?
215+
216+
# Symlink our LLVM here to make sure the adjacent bin/rust-lld can find it.
217+
# Needs to be done in `postinstall` to avoid having `change_dylib_id` done on it.
218+
lib.glob("rustlib/*/lib") do |dir|
219+
# Use `ln_sf` instead of `install_symlink` to avoid resolving this into a Cellar path.
220+
ln_sf llvm.opt_lib/shared_library("libLLVM"), dir
221+
end
210222
end
211223

212224
test do

0 commit comments

Comments
 (0)