 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>
		
	
			
		
			
				
	
	
		
			55 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			Ruby
		
	
	
	
	
	
			
		
		
	
	
			55 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			Ruby
		
	
	
	
	
	
| # typed: true
 | |
| # frozen_string_literal: true
 | |
| 
 | |
| module OS
 | |
|   module Linux
 | |
|     # Helper functions for querying `glibc` information.
 | |
|     #
 | |
|     # @api private
 | |
|     module Glibc
 | |
|       extend T::Sig
 | |
| 
 | |
|       module_function
 | |
| 
 | |
|       sig { returns(Version) }
 | |
|       def system_version
 | |
|         @system_version ||= begin
 | |
|           version = Utils.popen_read("/usr/bin/ldd", "--version")[/ (\d+\.\d+)/, 1]
 | |
|           if version
 | |
|             Version.new version
 | |
|           else
 | |
|             Version::NULL
 | |
|           end
 | |
|         end
 | |
|       end
 | |
| 
 | |
|       sig { returns(Version) }
 | |
|       def version
 | |
|         @version ||= begin
 | |
|           version = Utils.popen_read(HOMEBREW_PREFIX/"opt/glibc/bin/ldd", "--version")[/ (\d+\.\d+)/, 1]
 | |
|           if version
 | |
|             Version.new version
 | |
|           else
 | |
|             system_version
 | |
|           end
 | |
|         end
 | |
|       end
 | |
| 
 | |
|       sig { returns(Version) }
 | |
|       def minimum_version
 | |
|         Version.new(ENV.fetch("HOMEBREW_LINUX_MINIMUM_GLIBC_VERSION"))
 | |
|       end
 | |
| 
 | |
|       sig { returns(T::Boolean) }
 | |
|       def below_minimum_version?
 | |
|         system_version < minimum_version
 | |
|       end
 | |
| 
 | |
|       sig { returns(T::Boolean) }
 | |
|       def below_ci_version?
 | |
|         system_version < LINUX_GLIBC_CI_VERSION
 | |
|       end
 | |
|     end
 | |
|   end
 | |
| end
 |