 d271614872
			
		
	
	
		d271614872
		
			
		
	
	
	
	
		
			
			Right now this is done through the gcc@5 formula.
See 9692318ca6/Formula/gcc%405.rb (L33)
This is fragile because when we will migrate to gcc@11
we have to think about migrating the installation from one gcc formula to another..
Also, not having the right glibc version results in a non-functional brew
installation on an older Linux: the glibc installation needs
to be done by brew, and not by a workaround in a specific formula
Co-Authored-By: Mike McQuaid <mike@mikemcquaid.com>
Co-Authored-By: Bo Anderson <mail@boanderson.me>
Co-Authored-By: Shaun Jackman <sjackman@gmail.com>
		
	
			
		
			
				
	
	
		
			45 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Ruby
		
	
	
	
	
	
			
		
		
	
	
			45 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Ruby
		
	
	
	
	
	
| # typed: true
 | |
| # frozen_string_literal: true
 | |
| 
 | |
| class DevelopmentTools
 | |
|   class << self
 | |
|     extend T::Sig
 | |
| 
 | |
|     sig { params(tool: String).returns(T.nilable(Pathname)) }
 | |
|     def locate(tool)
 | |
|       (@locate ||= {}).fetch(tool) do |key|
 | |
|         @locate[key] = if (path = HOMEBREW_PREFIX/"bin/#{tool}").executable?
 | |
|           path
 | |
|         elsif File.executable?(path = "/usr/bin/#{tool}")
 | |
|           Pathname.new path
 | |
|         end
 | |
|       end
 | |
|     end
 | |
| 
 | |
|     sig { returns(Symbol) }
 | |
|     def default_compiler
 | |
|       :gcc
 | |
|     end
 | |
| 
 | |
|     sig { returns(T::Boolean) }
 | |
|     def build_system_too_old?
 | |
|       return @build_system_too_old if defined? @build_system_too_old
 | |
| 
 | |
|       @build_system_too_old = (system_gcc_too_old? || OS::Linux::Glibc.below_ci_version?)
 | |
|     end
 | |
| 
 | |
|     sig { returns(T::Boolean) }
 | |
|     def system_gcc_too_old?
 | |
|       gcc_version("gcc") < OS::LINUX_GCC_CI_VERSION
 | |
|     end
 | |
| 
 | |
|     sig { returns(T::Hash[String, T.nilable(String)]) }
 | |
|     def build_system_info
 | |
|       generic_build_system_info.merge({
 | |
|         "glibc_version"     => OS::Linux::Glibc.version.to_s.presence,
 | |
|         "oldest_cpu_family" => Hardware.oldest_cpu.to_s,
 | |
|       })
 | |
|     end
 | |
|   end
 | |
| end
 |