Add OS::Linux::Glibc.version

This commit is contained in:
Shaun Jackman 2021-04-01 22:16:33 -07:00
parent 0db0db9516
commit 95e7e010ee
2 changed files with 11 additions and 1 deletions

View File

@ -21,7 +21,7 @@ class DevelopmentTools
end
def build_system_info
generic_build_system_info.merge "glibc_version" => OS::Linux::Glibc.system_version
generic_build_system_info.merge "glibc_version" => OS::Linux::Glibc.version
end
end
end

View File

@ -20,6 +20,16 @@ module OS
@system_version = Version.new version
end
def version
return @version if @version
ldd = HOMEBREW_PREFIX/"opt/glibc/bin/ldd"
version = Utils.popen_read(ldd, "--version")[/ (\d+\.\d+)/, 1] if ldd.executable?
return system_version unless version
@version = Version.new version
end
sig { returns(Version) }
def minimum_version
Version.new(ENV.fetch("HOMEBREW_LINUX_MINIMUM_GLIBC_VERSION"))