From 4696401e5d62167338bf0e9e15d66e22bb1994ac Mon Sep 17 00:00:00 2001 From: Max Howell Date: Fri, 29 Jul 2011 15:20:32 +0100 Subject: [PATCH] Look for bad dylibs in the installer A common source of compile error, lets tell the user straight away. Removed relevant documentation from the installation instructions as a consequence. --- install_homebrew.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/install_homebrew.rb b/install_homebrew.rb index 7c103c0eae..08299f74b1 100644 --- a/install_homebrew.rb +++ b/install_homebrew.rb @@ -53,6 +53,15 @@ ensure system "/bin/stty -raw echo" end +def badlibs + @badlibs ||= begin + Dir['/usr/local/lib/*.dylib'].select do |dylib| + ENV['dylib'] = dylib + File.file? dylib and not File.symlink? dylib and `/usr/bin/file "$dylib"` =~ /shared library/ + end + end +end + ####################################################################### script abort "/usr/local/.git already exists!" unless Dir["/usr/local/.git/*"].empty? abort "Don't run this as root!" if Process.uid == 0 @@ -119,3 +128,12 @@ sudo "/bin/chmod o-w /usr/local" warn "/usr/local/bin is not in your PATH." unless ENV['PATH'].split(':').include? '/usr/local/bin' warn "Now install Xcode: http://developer.apple.com/technologies/xcode.html" unless Kernel.system "/usr/bin/which -s gcc" + +unless badlibs.empty? + warn "The following *evil* dylibs exist in /usr/local/lib" + puts "They may break builds or worse. You should consider deleting them:" + puts *badlibs +end + +ohai "Installation successful!" +puts "Now type: brew help"