development_tools: add install instruction helpers.

This commit is contained in:
Mike McQuaid 2016-07-16 21:01:22 +01:00
parent c86c600bfd
commit 012fc4709a
2 changed files with 44 additions and 0 deletions

View File

@ -19,6 +19,12 @@ class DevelopmentTools
which("clang") || which("gcc") which("clang") || which("gcc")
end end
def installation_instructions
"Install Clang or brew install gcc"
end
alias_method :custom_installation_instructions,
:installation_instructions
def default_cc def default_cc
cc = DevelopmentTools.locate "cc" cc = DevelopmentTools.locate "cc"
cc.realpath.basename.to_s rescue nil cc.realpath.basename.to_s rescue nil

View File

@ -22,6 +22,44 @@ class DevelopmentTools
MacOS::Xcode.installed? || MacOS::CLT.installed? MacOS::Xcode.installed? || MacOS::CLT.installed?
end end
def installation_instructions
if MacOS.version >= "10.9"
<<-EOS.undent
Install the Command Line Tools:
xcode-select --install
EOS
elsif MacOS.version == "10.8" || MacOS.version == "10.7"
<<-EOS.undent
Install the Command Line Tools from
https://developer.apple.com/downloads/
or via Xcode's preferences.
EOS
else
<<-EOS.undent
Install Xcode from
https://developer.apple.com/xcode/downloads/
EOS
end
end
def custom_installation_instructions
if MacOS.version > :tiger
<<-EOS.undent
Install GNU's GCC
brew install gcc
EOS
else
# Tiger doesn't ship with apple-gcc42, and this is required to build
# some software that doesn't build properly with FSF GCC.
<<-EOS.undent
Install Apple's GCC
brew install apple-gcc42
or GNU's GCC
brew install gcc
EOS
end
end
def default_compiler def default_compiler
case default_cc case default_cc
# if GCC 4.2 is installed, e.g. via Tigerbrew, prefer it # if GCC 4.2 is installed, e.g. via Tigerbrew, prefer it