2010-09-11 20:22:54 +01:00
|
|
|
require 'hardware'
|
|
|
|
|
|
|
|
module Homebrew extend self
|
2014-04-26 23:31:39 -07:00
|
|
|
def config
|
2013-11-01 19:04:04 -05:00
|
|
|
dump_verbose_config
|
2010-09-11 20:22:54 +01:00
|
|
|
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
|
|
|
|
|
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
|
|
|
|
head = HOMEBREW_REPOSITORY.cd do
|
2011-12-28 19:30:34 -06:00
|
|
|
`git rev-parse --verify -q HEAD 2>/dev/null`.chomp
|
|
|
|
end
|
2012-07-08 12:22:25 -05:00
|
|
|
if head.empty? then "(none)" else head end
|
2010-09-11 20:22:54 +01:00
|
|
|
end
|
|
|
|
|
2013-01-16 15:56:36 +01:00
|
|
|
def origin
|
|
|
|
origin = HOMEBREW_REPOSITORY.cd do
|
2013-10-04 13:08:13 -05:00
|
|
|
`git config --get remote.origin.url 2>/dev/null`.chomp
|
2013-01-16 15:56:36 +01:00
|
|
|
end
|
|
|
|
if origin.empty? then "(none)" else origin end
|
|
|
|
end
|
|
|
|
|
2012-06-08 05:44:11 +02:00
|
|
|
def describe_path path
|
|
|
|
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?
|
2013-08-26 21:45:47 -05:00
|
|
|
return "#{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
|
2012-06-08 05:44:11 +02:00
|
|
|
describe_path(which 'perl')
|
2012-02-02 19:10:15 -08:00
|
|
|
end
|
|
|
|
|
|
|
|
def describe_python
|
2012-06-08 05:44:11 +02:00
|
|
|
describe_path(which 'python')
|
2012-02-02 19:10:15 -08:00
|
|
|
end
|
|
|
|
|
|
|
|
def describe_ruby
|
2012-06-08 05:44:11 +02:00
|
|
|
describe_path(which 'ruby')
|
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
|
|
|
|
|
2012-03-06 18:08:16 +00:00
|
|
|
# we try to keep output minimal
|
|
|
|
def dump_build_config
|
2012-07-08 12:22:25 -05:00
|
|
|
puts "HOMEBREW_VERSION: #{HOMEBREW_VERSION}"
|
|
|
|
puts "HEAD: #{head}"
|
2012-03-06 18:08:16 +00:00
|
|
|
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
|
2012-06-25 20:11:45 -05:00
|
|
|
puts "OS X: #{MACOS_FULL_VERSION}-#{kernel}"
|
2012-09-14 13:24:28 -05:00
|
|
|
puts "Xcode: #{xcode}" if xcode
|
|
|
|
puts "CLT: #{clt}" if clt
|
2013-04-06 13:09:24 -05:00
|
|
|
puts "#{RUBY_PATH}:\n #{RUBY_VERSION}-#{RUBY_PATCHLEVEL}" if RUBY_VERSION.to_f != 1.8
|
2012-03-06 18:08:16 +00:00
|
|
|
|
2012-07-08 12:21:47 -05:00
|
|
|
unless MacOS.compilers_standard?
|
2012-09-05 16:41:35 -05:00
|
|
|
puts "GCC-4.0: build #{gcc_40}" if gcc_40
|
|
|
|
puts "GCC-4.2: build #{gcc_42}" if gcc_42
|
2013-10-24 14:51:43 -05:00
|
|
|
puts "LLVM-GCC: build #{llvm}" if llvm
|
2012-07-08 12:21:47 -05:00
|
|
|
puts "Clang: #{clang ? "#{clang} build #{clang_build}" : "N/A"}"
|
|
|
|
end
|
|
|
|
|
2012-12-17 17:05:53 -06:00
|
|
|
puts "MacPorts/Fink: #{macports_or_fink}" if macports_or_fink
|
2012-03-06 18:08:16 +00:00
|
|
|
|
2012-07-08 12:16:53 -05:00
|
|
|
puts "X11: #{describe_x11}"
|
2012-03-06 18:08:16 +00:00
|
|
|
end
|
|
|
|
|
2012-09-28 09:12:15 -04:00
|
|
|
def write_build_config f
|
2012-09-28 09:49:05 -04:00
|
|
|
stdout = $stdout
|
|
|
|
$stdout = f
|
2012-09-28 09:12:15 -04:00
|
|
|
Homebrew.dump_build_config
|
2012-09-28 09:49:05 -04:00
|
|
|
ensure
|
|
|
|
$stdout = stdout
|
2012-09-28 09:12:15 -04:00
|
|
|
end
|
|
|
|
|
2012-09-05 16:41:35 -05:00
|
|
|
def dump_verbose_config
|
|
|
|
puts "HOMEBREW_VERSION: #{HOMEBREW_VERSION}"
|
2013-01-16 15:56:36 +01:00
|
|
|
puts "ORIGIN: #{origin}"
|
2012-09-05 16:41:35 -05:00
|
|
|
puts "HEAD: #{head}"
|
|
|
|
puts "HOMEBREW_PREFIX: #{HOMEBREW_PREFIX}"
|
|
|
|
puts "HOMEBREW_CELLAR: #{HOMEBREW_CELLAR}"
|
|
|
|
puts hardware
|
|
|
|
puts "OS X: #{MACOS_FULL_VERSION}-#{kernel}"
|
2012-09-14 13:24:28 -05:00
|
|
|
puts "Xcode: #{xcode}" if xcode
|
|
|
|
puts "CLT: #{clt}" if clt
|
2012-09-05 16:41:35 -05:00
|
|
|
puts "GCC-4.0: build #{gcc_40}" if gcc_40
|
|
|
|
puts "GCC-4.2: build #{gcc_42}" if gcc_42
|
2013-10-24 14:51:43 -05:00
|
|
|
puts "LLVM-GCC: build #{llvm}" if llvm
|
2012-09-05 16:41:35 -05:00
|
|
|
puts "Clang: #{clang ? "#{clang} build #{clang_build}" : "N/A"}"
|
2012-12-17 17:05:53 -06:00
|
|
|
puts "MacPorts/Fink: #{macports_or_fink}" if macports_or_fink
|
2012-09-14 12:27:33 -05:00
|
|
|
puts "X11: #{describe_x11}"
|
2012-09-05 16:41:35 -05:00
|
|
|
puts "System Ruby: #{RUBY_VERSION}-#{RUBY_PATCHLEVEL}"
|
|
|
|
puts "Perl: #{describe_perl}"
|
|
|
|
puts "Python: #{describe_python}"
|
|
|
|
puts "Ruby: #{describe_ruby}"
|
2010-09-11 20:22:54 +01:00
|
|
|
end
|
|
|
|
end
|