always use opt_prefix in install_name

dylib install_names are presently rewritten relative to HOMEBREW_PREFIX,
except for keg-only formulas, which are rewritten relative to
opt_prefix.

If we make a formula keg_only, all of its dependents need to be bumped,
since it will no longer exist in HOMEBREW_PREFIX and all of the links
will be written incorrectly.

If we always use opt_prefix, we avoid that dilemma, and make installed
packages more robust if a dependency is `brew unlink`ed.

Closes Homebrew/homebrew#43518.

Signed-off-by: Dominyk Tiller <dominyktiller@gmail.com>
This commit is contained in:
Tim D. Smith 2015-09-02 11:05:31 -07:00 committed by Dominyk Tiller
parent 4ac345ca61
commit f81d561b67

View File

@ -153,14 +153,8 @@ class Keg
# the basename of the file itself.
basename = File.basename(file.dylib_id)
relative_dirname = file.dirname.relative_path_from(path)
shortpath = HOMEBREW_PREFIX.join(relative_dirname, basename)
if shortpath.exist? && !options[:keg_only]
shortpath.to_s
else
opt_record.join(relative_dirname, basename).to_s
end
end
def find_dylib(name)
lib.find { |pn| break pn if pn.basename == name } if lib.directory?