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.
master
Max Howell 2010-04-13 20:17:28 +01:00
parent 9ee52ad3ff
commit 464b50c8de
1 changed files with 20 additions and 0 deletions

View File

@ -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