Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

link: stop unneeded force linking on Mojave/CLT 10. #4441

Merged
merged 1 commit into from
Jul 9, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 21 additions & 10 deletions Library/Homebrew/cmd/link.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,27 @@ def link

ARGV.kegs.each do |keg|
keg_only = Formulary.keg_only?(keg.rack)
if HOMEBREW_PREFIX.to_s == "/usr/local" && keg_only &&
keg.name.start_with?("openssl", "libressl")
opoo <<~EOS
Refusing to link: #{keg.name}
Linking keg-only #{keg.name} means you may end up linking against the insecure,
deprecated system OpenSSL while using the headers from Homebrew's #{keg.name}.
Instead, pass the full include/library paths to your compiler e.g.:
-I#{HOMEBREW_PREFIX}/opt/#{keg.name}/include -L#{HOMEBREW_PREFIX}/opt/#{keg.name}/lib
EOS
next
if HOMEBREW_PREFIX.to_s == "/usr/local" && keg_only
if keg.name.start_with?("openssl", "libressl")
opoo <<~EOS
Refusing to link: #{keg.name}
Linking keg-only #{keg.name} means you may end up linking against the insecure,
deprecated system OpenSSL while using the headers from Homebrew's #{keg.name}.
Instead, pass the full include/library paths to your compiler e.g.:
-I#{HOMEBREW_PREFIX}/opt/#{keg.name}/include -L#{HOMEBREW_PREFIX}/opt/#{keg.name}/lib
EOS
next
elsif (MacOS.version >= :mojave ||
MacOS::Xcode.version >= "10.0" ||
MacOS::CLT.version >= "10.0") &&
dep_f.keg_only_reason.reason == :provided_by_macos
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we also want to check shadowed_by_macos too since finding the libedit headers may be an issue too.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 but let's wait until we see that in the wild first?

opoo <<~EOS
Refusing to link macOS-provided software: #{keg.name}
Instead, pass the full include/library paths to your compiler e.g.:
-I#{HOMEBREW_PREFIX}/opt/#{keg.name}/include -L#{HOMEBREW_PREFIX}/opt/#{keg.name}/lib
EOS
next
end
elsif keg.linked?
opoo "Already linked: #{keg}"
puts "To relink: brew unlink #{keg.name} && brew link #{keg.name}"
Expand Down