development_tools: add install instruction helpers.
This commit is contained in:
		
							parent
							
								
									c86c600bfd
								
							
						
					
					
						commit
						012fc4709a
					
				@ -19,6 +19,12 @@ class DevelopmentTools
 | 
			
		||||
      which("clang") || which("gcc")
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    def installation_instructions
 | 
			
		||||
      "Install Clang or brew install gcc"
 | 
			
		||||
    end
 | 
			
		||||
    alias_method :custom_installation_instructions,
 | 
			
		||||
                 :installation_instructions
 | 
			
		||||
 | 
			
		||||
    def default_cc
 | 
			
		||||
      cc = DevelopmentTools.locate "cc"
 | 
			
		||||
      cc.realpath.basename.to_s rescue nil
 | 
			
		||||
 | 
			
		||||
@ -22,6 +22,44 @@ class DevelopmentTools
 | 
			
		||||
      MacOS::Xcode.installed? || MacOS::CLT.installed?
 | 
			
		||||
    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
 | 
			
		||||
      case default_cc
 | 
			
		||||
      # if GCC 4.2 is installed, e.g. via Tigerbrew, prefer it
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user