aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMax Howell2010-04-13 20:17:28 +0100
committerMax Howell2010-04-13 20:17:28 +0100
commit808f2d07341e2c83506d0446fe45f619fb56b2ed (patch)
tree47eceac28c594471c8240236224658399d8ccc9a /Library
parent64ab3d41ffe5ceeee438aa0d11fa3f561671cd78 (diff)
downloadhomebrew-808f2d07341e2c83506d0446fe45f619fb56b2ed.tar.bz2
Fix couchdb by fixing icu4c install_names
Bad icu4c, but this presses the point that we should be in general fixing stuff when it is installed. This code can be generalised, but there are some caveats.
Diffstat (limited to 'Library')
-rw-r--r--Library/Formula/icu4c.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/Library/Formula/icu4c.rb b/Library/Formula/icu4c.rb
index d5071fa20..e3bc0ef44 100644
--- a/Library/Formula/icu4c.rb
+++ b/Library/Formula/icu4c.rb
@@ -22,6 +22,26 @@ class Icu4c <Formula
system "make"
system "make install"
end
+
+ # fix install_names
+ lib.children.reject{ |pn| pn.symlink? or pn.extname != '.dylib' }.each do |dylib|
+ bad_names(dylib) do |id, bad_names|
+ cd lib do
+ system "install_name_tool", "-id", (lib+id).realpath, dylib.basename
+ bad_names.each do |bad|
+ system "install_name_tool", "-change", bad, (lib+bad.basename).realpath, dylib.basename
+ end
+ end
+ end
+ end
+ end
+
+ def bad_names pn
+ ENV['HOMEBREW_PN'] = pn.to_s
+ rx = /\t(.*) \(compatibility version (\d+\.)*\d+, current version (\d+\.)*\d+\)/
+ dylibs = `otool -L "$HOMEBREW_PN"`.split "\n"
+ dylibs = dylibs.map{ |fn| rx =~ fn && $1 }.compact.reject{ |fn| fn[0].chr == '/' }.map{ |fn| p fn; Pathname.new fn }
+ yield dylibs.shift, dylibs
end
end