link: don't link /usr/local openssl.

See https://langui.sh/2015/07/24/osx-clang-include-lib-search-paths/ for
an explanation and https://gist.github.com/tdsmith/4b502c5cc6e7d358acdf
for reproduction instructions.
This commit is contained in:
Mike McQuaid 2016-07-28 16:49:08 -06:00
parent 209d9e8a6e
commit b999edb344

View File

@ -24,7 +24,16 @@ module Homebrew
mode.dry_run = true if ARGV.dry_run?
ARGV.kegs.each do |keg|
if keg.linked?
if HOMEBREW_PREFIX.to_s == "/usr/local" && keg.name == "openssl"
opoo <<-EOS.undent
Refusing to link: openssl
Linking keg-only OpenSSL means you may end up linking against the insecure,
deprecated system version while using the headers from the Homebrew version.
Instead, pass the full include/library paths to your compiler e.g.:
-I#{HOMEBREW_PREFIX}/opt/openssl/include -L#{HOMEBREW_PREFIX}/opt/openssl/lib
EOS
next
elsif keg.linked?
opoo "Already linked: #{keg}"
puts "To relink: brew unlink #{keg.name} && brew link #{keg.name}"
next