2015-08-03 13:09:07 +01:00
|
|
|
require "hardware"
|
2015-07-03 22:59:30 +08:00
|
|
|
require "software_spec"
|
2015-09-04 16:33:37 +08:00
|
|
|
require "rexml/document"
|
2010-09-11 20:22:54 +01:00
|
|
|
|
2014-06-18 22:41:47 -05:00
|
|
|
module Homebrew
|
2014-04-26 23:31:39 -07:00
|
|
|
def config
|
2014-12-30 23:33:50 -05:00
|
|
|
dump_verbose_config
|
2010-09-11 20:22:54 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
def llvm
|
2015-07-26 16:49:16 -04:00
|
|
|
@llvm ||= MacOS.llvm_build_version if MacOS.has_apple_developer_tools?
|
2010-09-11 20:22:54 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
def gcc_42
|
2015-07-26 16:49:16 -04:00
|
|
|
@gcc_42 ||= MacOS.gcc_42_build_version if MacOS.has_apple_developer_tools?
|
2010-09-11 20:22:54 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
def gcc_40
|
2015-07-26 16:49:16 -04:00
|
|
|
@gcc_40 ||= MacOS.gcc_40_build_version if MacOS.has_apple_developer_tools?
|
2010-09-11 20:22:54 +01:00
|
|
|
end
|
|
|
|
|
2011-11-03 21:10:09 -05:00
|
|
|
def clang
|
2015-07-26 16:49:16 -04:00
|
|
|
@clang ||= MacOS.clang_version if MacOS.has_apple_developer_tools?
|
2011-11-03 21:10:09 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def clang_build
|
2015-07-26 16:49:16 -04:00
|
|
|
@clang_build ||= MacOS.clang_build_version if MacOS.has_apple_developer_tools?
|
2011-11-03 21:10:09 -05:00
|
|
|
end
|
|
|
|
|
2012-09-14 13:24:28 -05:00
|
|
|
def xcode
|
|
|
|
if instance_variable_defined?(:@xcode)
|
|
|
|
@xcode
|
|
|
|
elsif MacOS::Xcode.installed?
|
|
|
|
@xcode = MacOS::Xcode.version
|
|
|
|
@xcode += " => #{MacOS::Xcode.prefix}" unless MacOS::Xcode.default_prefix?
|
|
|
|
@xcode
|
Core change: XCode only install, with CLT or both
Allow XCode without the Command Line Tools to
work with homebrew, so it's not necessary
to register an Apple Dev ID and/or go to the
XCode prefs and download the CLT. Yay!
Further, this commit allows to use the CLT
solely (without the need for XCode).
Saves quite some megs.
(Some furmulae require xcodebuild)
Of course XCode together with the CLT is still
fine and has been tested on 10.7 and 10.6
with Xcode 4 and Xcode 3.
Only on Lion or above, tell the user about the options,
which are
- Xcode without CLT
- CLT without Xcode
- both (ok, it's not directly stated, but implicit)
So if no Xcode is found and we are on Lion or above,
we don't fail but check for the CLTs now.
For older Macs, the old message that Xcode is needed
and the installer should be run is still displayed.
If the CLT are not found but Xcode is, then we
print out about the experimental status of this setup.
Closes Homebrew/homebrew#10510.
Signed-off-by: Adam Vandenberg <flangy@gmail.com>
2012-02-26 21:04:15 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-09-14 13:24:28 -05:00
|
|
|
def clt
|
|
|
|
if instance_variable_defined?(:@clt)
|
|
|
|
@clt
|
2013-10-22 20:48:22 -05:00
|
|
|
elsif MacOS::CLT.installed? && MacOS::Xcode.version >= "4.3"
|
2012-09-14 13:24:28 -05:00
|
|
|
@clt = MacOS::CLT.version
|
|
|
|
end
|
2010-09-11 20:22:54 +01:00
|
|
|
end
|
|
|
|
|
2012-07-08 12:22:25 -05:00
|
|
|
def head
|
2014-06-30 19:15:03 -05:00
|
|
|
Homebrew.git_head || "(none)"
|
2010-09-11 20:22:54 +01:00
|
|
|
end
|
|
|
|
|
2014-10-04 16:09:48 -07:00
|
|
|
def last_commit
|
|
|
|
Homebrew.git_last_commit || "never"
|
|
|
|
end
|
|
|
|
|
2013-01-16 15:56:36 +01:00
|
|
|
def origin
|
2015-09-08 15:14:15 +08:00
|
|
|
Homebrew.git_origin || "(none)"
|
2013-01-16 15:56:36 +01:00
|
|
|
end
|
|
|
|
|
2015-08-03 13:09:07 +01:00
|
|
|
def describe_path(path)
|
2012-06-08 05:44:11 +02:00
|
|
|
return "N/A" if path.nil?
|
|
|
|
realpath = path.realpath
|
|
|
|
if realpath == path then path else "#{path} => #{realpath}" end
|
|
|
|
end
|
|
|
|
|
2012-02-27 23:43:19 -06:00
|
|
|
def describe_x11
|
2012-07-25 15:04:46 -05:00
|
|
|
return "N/A" unless MacOS::XQuartz.installed?
|
2015-08-03 13:09:07 +01:00
|
|
|
"#{MacOS::XQuartz.version} => #{describe_path(MacOS::XQuartz.prefix)}"
|
2012-02-27 23:43:19 -06:00
|
|
|
end
|
|
|
|
|
2012-02-02 19:10:15 -08:00
|
|
|
def describe_perl
|
2015-08-03 13:09:07 +01:00
|
|
|
describe_path(which "perl")
|
2012-02-02 19:10:15 -08:00
|
|
|
end
|
|
|
|
|
|
|
|
def describe_python
|
2015-08-03 13:09:07 +01:00
|
|
|
python = which "python"
|
|
|
|
if %r{/shims/python$} =~ python && which("pyenv")
|
2015-01-13 21:03:46 +08:00
|
|
|
"#{python} => #{Pathname.new(`pyenv which python`.strip).realpath}" rescue describe_path(python)
|
|
|
|
else
|
|
|
|
describe_path(python)
|
|
|
|
end
|
2012-02-02 19:10:15 -08:00
|
|
|
end
|
|
|
|
|
|
|
|
def describe_ruby
|
2015-08-03 13:09:07 +01:00
|
|
|
ruby = which "ruby"
|
|
|
|
if %r{/shims/ruby$} =~ ruby && which("rbenv")
|
2015-01-13 21:03:46 +08:00
|
|
|
"#{ruby} => #{Pathname.new(`rbenv which ruby`.strip).realpath}" rescue describe_path(ruby)
|
|
|
|
else
|
|
|
|
describe_path(ruby)
|
|
|
|
end
|
2010-09-11 20:22:54 +01:00
|
|
|
end
|
|
|
|
|
2012-03-06 18:08:16 +00:00
|
|
|
def hardware
|
2013-03-17 13:30:12 -05:00
|
|
|
"CPU: #{Hardware.cores_as_words}-core #{Hardware::CPU.bits}-bit #{Hardware::CPU.family}"
|
2012-03-06 18:08:16 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def kernel
|
|
|
|
`uname -m`.chomp
|
|
|
|
end
|
|
|
|
|
2012-12-17 17:05:53 -06:00
|
|
|
def macports_or_fink
|
|
|
|
@ponk ||= MacOS.macports_or_fink
|
|
|
|
@ponk.join(", ") unless @ponk.empty?
|
|
|
|
end
|
|
|
|
|
2014-12-31 09:50:21 -05:00
|
|
|
def describe_system_ruby
|
|
|
|
s = ""
|
|
|
|
case RUBY_VERSION
|
|
|
|
when /^1\.[89]/, /^2\.0/
|
|
|
|
s << "#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}"
|
|
|
|
else
|
|
|
|
s << RUBY_VERSION
|
|
|
|
end
|
|
|
|
|
2015-08-03 13:09:07 +01:00
|
|
|
if RUBY_PATH.to_s !~ %r{^/System/Library/Frameworks/Ruby.framework/Versions/[12]\.[089]/usr/bin/ruby}
|
2014-12-31 09:50:21 -05:00
|
|
|
s << " => #{RUBY_PATH}"
|
|
|
|
end
|
|
|
|
s
|
|
|
|
end
|
|
|
|
|
2015-01-24 20:58:02 +08:00
|
|
|
def describe_java
|
2015-09-04 16:33:37 +08:00
|
|
|
java_xml = Utils.popen_read("/usr/libexec/java_home", "--xml", "--failfast")
|
|
|
|
return "N/A" unless $?.success?
|
|
|
|
javas = []
|
|
|
|
REXML::XPath.each(REXML::Document.new(java_xml), "//key[text()='JVMVersion']/following-sibling::string") do |item|
|
|
|
|
javas << item.text
|
2015-01-24 20:58:02 +08:00
|
|
|
end
|
2015-09-04 16:33:37 +08:00
|
|
|
javas.uniq.join(", ")
|
2015-01-06 10:54:55 +01:00
|
|
|
end
|
|
|
|
|
2015-08-03 13:09:07 +01:00
|
|
|
def dump_verbose_config(f = $stdout)
|
2014-07-19 22:33:59 -05:00
|
|
|
f.puts "HOMEBREW_VERSION: #{HOMEBREW_VERSION}"
|
|
|
|
f.puts "ORIGIN: #{origin}"
|
|
|
|
f.puts "HEAD: #{head}"
|
2014-10-04 16:09:48 -07:00
|
|
|
f.puts "Last commit: #{last_commit}"
|
2014-07-19 22:33:59 -05:00
|
|
|
f.puts "HOMEBREW_PREFIX: #{HOMEBREW_PREFIX}"
|
2015-08-30 23:42:26 +02:00
|
|
|
f.puts "HOMEBREW_REPOSITORY: #{HOMEBREW_REPOSITORY}"
|
2014-07-19 22:33:59 -05:00
|
|
|
f.puts "HOMEBREW_CELLAR: #{HOMEBREW_CELLAR}"
|
2015-07-03 22:59:30 +08:00
|
|
|
f.puts "HOMEBREW_BOTTLE_DOMAIN: #{BottleSpecification::DEFAULT_DOMAIN}"
|
2014-07-19 22:33:59 -05:00
|
|
|
f.puts hardware
|
|
|
|
f.puts "OS X: #{MACOS_FULL_VERSION}-#{kernel}"
|
2014-11-03 17:50:52 +08:00
|
|
|
f.puts "Xcode: #{xcode ? xcode : "N/A"}"
|
|
|
|
f.puts "CLT: #{clt ? clt : "N/A"}"
|
2014-07-19 22:33:59 -05:00
|
|
|
f.puts "GCC-4.0: build #{gcc_40}" if gcc_40
|
|
|
|
f.puts "GCC-4.2: build #{gcc_42}" if gcc_42
|
|
|
|
f.puts "LLVM-GCC: build #{llvm}" if llvm
|
|
|
|
f.puts "Clang: #{clang ? "#{clang} build #{clang_build}" : "N/A"}"
|
|
|
|
f.puts "MacPorts/Fink: #{macports_or_fink}" if macports_or_fink
|
|
|
|
f.puts "X11: #{describe_x11}"
|
2014-12-31 09:50:21 -05:00
|
|
|
f.puts "System Ruby: #{describe_system_ruby}"
|
2014-07-19 22:33:59 -05:00
|
|
|
f.puts "Perl: #{describe_perl}"
|
|
|
|
f.puts "Python: #{describe_python}"
|
|
|
|
f.puts "Ruby: #{describe_ruby}"
|
2015-01-24 20:58:02 +08:00
|
|
|
f.puts "Java: #{describe_java}"
|
2010-09-11 20:22:54 +01:00
|
|
|
end
|
|
|
|
end
|