2010-09-11 20:22:54 +01:00
|
|
|
require 'hardware'
|
|
|
|
|
|
|
|
module Homebrew extend self
|
|
|
|
def __config
|
|
|
|
puts config_s
|
|
|
|
end
|
|
|
|
|
|
|
|
def llvm
|
|
|
|
@llvm ||= MacOS.llvm_build_version
|
|
|
|
end
|
|
|
|
|
|
|
|
def gcc_42
|
|
|
|
@gcc_42 ||= MacOS.gcc_42_build_version
|
|
|
|
end
|
|
|
|
|
|
|
|
def gcc_40
|
|
|
|
@gcc_40 ||= MacOS.gcc_40_build_version
|
|
|
|
end
|
|
|
|
|
2011-11-03 21:10:09 -05:00
|
|
|
def clang
|
|
|
|
@clang ||= MacOS.clang_version
|
|
|
|
end
|
|
|
|
|
|
|
|
def clang_build
|
|
|
|
@clang_build ||= MacOS.clang_build_version
|
|
|
|
end
|
|
|
|
|
2010-09-11 20:22:54 +01:00
|
|
|
def xcode_version
|
2011-05-18 16:10:31 +01:00
|
|
|
@xcode_version || MacOS.xcode_version
|
2010-09-11 20:22:54 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
def sha
|
2011-12-28 19:30:34 -06:00
|
|
|
sha = HOMEBREW_REPOSITORY.cd do
|
|
|
|
`git rev-parse --verify -q HEAD 2>/dev/null`.chomp
|
|
|
|
end
|
2010-09-11 20:22:54 +01:00
|
|
|
if sha.empty? then "(none)" else sha end
|
|
|
|
end
|
|
|
|
|
2012-02-27 23:43:19 -06:00
|
|
|
def describe_x11
|
|
|
|
return "N/A" unless x11_installed?
|
2012-02-29 01:28:23 +00:00
|
|
|
return case x11_path = Pathname.new("/usr/X11").realpath.to_s
|
|
|
|
when "/usr/X11" then "/usr/X11"
|
|
|
|
else "/usr/X11 => #{x11_path}"
|
2012-02-27 23:43:19 -06:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-02-02 19:10:15 -08:00
|
|
|
def describe_perl
|
2012-05-13 19:00:10 -05:00
|
|
|
perl = which 'perl'
|
|
|
|
return "N/A" if perl.nil?
|
2012-02-02 19:10:15 -08:00
|
|
|
|
2012-05-13 19:00:10 -05:00
|
|
|
real_perl = Pathname.new(perl).realpath
|
2012-02-02 19:10:15 -08:00
|
|
|
return perl if perl == real_perl
|
|
|
|
return "#{perl} => #{real_perl}"
|
|
|
|
end
|
|
|
|
|
|
|
|
def describe_python
|
2012-05-13 19:00:10 -05:00
|
|
|
python = which 'python'
|
|
|
|
return "N/A" if python.nil?
|
2012-02-02 19:10:15 -08:00
|
|
|
|
2012-05-13 19:00:10 -05:00
|
|
|
real_python = Pathname.new(python).realpath
|
2012-02-02 19:10:15 -08:00
|
|
|
|
|
|
|
return python if python == real_python
|
|
|
|
return "#{python} => #{real_python}"
|
|
|
|
end
|
|
|
|
|
|
|
|
def describe_ruby
|
2012-05-13 19:00:10 -05:00
|
|
|
ruby = which 'ruby'
|
|
|
|
return "N/A" if ruby.nil?
|
2012-02-02 19:10:15 -08:00
|
|
|
|
2012-05-13 19:00:10 -05:00
|
|
|
real_ruby = Pathname.new(ruby).realpath
|
2012-02-02 19:10:15 -08:00
|
|
|
return ruby if ruby == real_ruby
|
|
|
|
return "#{ruby} => #{real_ruby}"
|
|
|
|
end
|
|
|
|
|
|
|
|
def real_path a_path
|
|
|
|
Pathname.new(a_path).realpath.to_s
|
2010-09-11 20:22:54 +01:00
|
|
|
end
|
|
|
|
|
2012-03-06 18:08:16 +00:00
|
|
|
def hardware
|
|
|
|
"CPU: #{Hardware.cores_as_words}-core #{Hardware.bits}-bit #{Hardware.intel_family}"
|
|
|
|
end
|
|
|
|
|
|
|
|
def kernel
|
|
|
|
`uname -m`.chomp
|
|
|
|
end
|
|
|
|
|
|
|
|
# we try to keep output minimal
|
|
|
|
def dump_build_config
|
|
|
|
puts "HOMEBREW_PREFIX: #{HOMEBREW_PREFIX}" if HOMEBREW_PREFIX.to_s != "/usr/local"
|
|
|
|
puts "HOMEBREW_CELLAR: #{HOMEBREW_CELLAR}" if HOMEBREW_CELLAR.to_s != "#{HOMEBREW_PREFIX}/Cellar"
|
|
|
|
puts hardware
|
|
|
|
puts "MacOS: #{MACOS_FULL_VERSION}-#{kernel}"
|
|
|
|
puts "Xcode: #{xcode_version}"
|
2012-05-19 19:57:56 -05:00
|
|
|
puts "/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby:\n #{RUBY_VERSION}-#{RUBY_PATCHLEVEL}" if RUBY_VERSION.to_f != 1.8
|
2012-03-06 18:08:16 +00:00
|
|
|
|
|
|
|
ponk = macports_or_fink_installed?
|
2012-03-24 12:11:15 -05:00
|
|
|
puts "MacPorts/Fink: #{ponk}" if ponk
|
2012-03-06 18:08:16 +00:00
|
|
|
|
|
|
|
x11 = describe_x11
|
|
|
|
puts "X11: #{x11}" unless x11 == "/usr/X11"
|
|
|
|
end
|
|
|
|
|
2010-09-11 20:22:54 +01:00
|
|
|
def config_s; <<-EOS.undent
|
|
|
|
HOMEBREW_VERSION: #{HOMEBREW_VERSION}
|
|
|
|
HEAD: #{sha}
|
|
|
|
HOMEBREW_PREFIX: #{HOMEBREW_PREFIX}
|
|
|
|
HOMEBREW_CELLAR: #{HOMEBREW_CELLAR}
|
2012-03-06 18:08:16 +00:00
|
|
|
#{hardware}
|
2010-09-11 20:22:54 +01:00
|
|
|
OS X: #{MACOS_FULL_VERSION}
|
2012-03-06 18:08:16 +00:00
|
|
|
Kernel Architecture: #{kernel}
|
2010-09-11 20:22:54 +01:00
|
|
|
Xcode: #{xcode_version}
|
2011-11-25 17:34:47 -08:00
|
|
|
GCC-4.0: #{gcc_40 ? "build #{gcc_40}" : "N/A"}
|
|
|
|
GCC-4.2: #{gcc_42 ? "build #{gcc_42}" : "N/A"}
|
|
|
|
LLVM: #{llvm ? "build #{llvm}" : "N/A"}
|
2012-01-11 02:02:32 -06:00
|
|
|
Clang: #{clang ? "#{clang} build #{clang_build}" : "N/A"}
|
2010-09-11 20:22:54 +01:00
|
|
|
MacPorts or Fink? #{macports_or_fink_installed?}
|
2012-02-27 23:43:19 -06:00
|
|
|
X11: #{describe_x11}
|
2012-02-02 19:10:15 -08:00
|
|
|
System Ruby: #{RUBY_VERSION}-#{RUBY_PATCHLEVEL}
|
|
|
|
Which Perl: #{describe_perl}
|
|
|
|
Which Python: #{describe_python}
|
|
|
|
Which Ruby: #{describe_ruby}
|
2010-09-11 20:22:54 +01:00
|
|
|
EOS
|
|
|
|
end
|
|
|
|
end
|