From fbaf8a5968c69c7914027162368af5a738ad639e Mon Sep 17 00:00:00 2001 From: Samuel John Date: Mon, 17 Jun 2013 09:01:37 +0200 Subject: [PATCH] Linking Frameworks correctly if multiple. For example python and python3 both provide a `Python.framework` and OS X Frameworks are made to deal with this by putting them into `Versions` and linking the default one as `Current`. However, brew did not respect this and cleaned out stuff making neither of the two versions work because `Current` is replaced by an empty directory. This commit fixes that. However, still one of the two `Python.frameworks` has to remove it's `Current` and `Headers` links, because brew cannot decide alone which one is the "default" and allowed to set the `Current` link. A similar situation might apply to Qt 4 vs. 5.. --- Library/Homebrew/keg.rb | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/keg.rb b/Library/Homebrew/keg.rb index 7b4ad84fd0..04d1be8e19 100644 --- a/Library/Homebrew/keg.rb +++ b/Library/Homebrew/keg.rb @@ -115,7 +115,6 @@ class Keg < Pathname link_dir('bin', mode) {:skip_dir} link_dir('sbin', mode) {:skip_dir} link_dir('include', mode) {:link} - link_dir('Frameworks', mode) { :link } link_dir('share', mode) do |path| case path.to_s @@ -148,6 +147,18 @@ class Keg < Pathname end end + link_dir('Frameworks', mode) do |path| + # Frameworks contain symlinks pointing into a subdir, so we have to use + # the :link strategy. However, for Foo.framework and + # Foo.framework/Versions we have to use :mkpath so that multiple formulae + # can link their versions into it and `brew [un]link` works. + if path.to_s =~ /[^\/]*\.framework(\/Versions)?$/ + :mkpath + else + :link + end + end + unless mode.dry_run linked_keg_record.make_relative_symlink(self) optlink