Skip to content

Commit 0575d7b

Browse files
committed
config: Print host glibc version [Linux]
1 parent 9cabda8 commit 0575d7b

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

Library/Homebrew/extend/os/linux/system_config.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
require "formula"
2+
require "os/linux/glibc"
23

34
class SystemConfig
45
class << self
@@ -14,6 +15,12 @@ def host_os_version
1415
end
1516
end
1617

18+
def host_glibc_version
19+
version = OS::Linux::Glibc.system_version
20+
return "N/A" if version.null?
21+
version
22+
end
23+
1724
def host_gcc_version
1825
gcc = Pathname.new "/usr/bin/gcc"
1926
return "N/A" unless gcc.executable?
@@ -31,6 +38,7 @@ def dump_verbose_config(out = $stdout)
3138
dump_generic_verbose_config(out)
3239
out.puts "Kernel: #{`uname -mors`.chomp}"
3340
out.puts "OS: #{host_os_version}"
41+
out.puts "Host glibc: #{host_glibc_version}"
3442
out.puts "/usr/bin/gcc: #{host_gcc_version}"
3543
["glibc", "gcc", "xorg"].each do |f|
3644
out.puts "#{f}: #{formula_linked_version f}"

Library/Homebrew/os/linux/glibc.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
module OS
2+
module Linux
3+
module Glibc
4+
module_function
5+
6+
def system_version
7+
return @system_version if @system_version
8+
version = Utils.popen_read("/usr/bin/ldd", "--version")[/ (\d+\.\d+)/, 1]
9+
return Version::NULL unless version
10+
@system_version = Version.new version
11+
end
12+
end
13+
end
14+
end

0 commit comments

Comments
 (0)