1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Fix helper to not assume glibc

This commit is contained in:
Paul Jordan 2020-04-01 02:18:23 +01:00 committed by Samuel Williams
parent 0091fac1d8
commit 3e386d76c2
Notes: git 2020-04-01 11:49:36 +09:00

View file

@ -32,7 +32,11 @@ when /linux/
# libc.so and libm.so are installed to /lib/arm-linux-gnu*.
# It's not installed to /lib32.
dirs = Dir.glob('/lib/arm-linux-gnu*')
libdir = dirs[0] if dirs && File.directory?(dirs[0])
if dirs.length > 0
libdir = dirs[0] if dirs && File.directory?(dirs[0])
else # handle alpine environment
libdir = '/lib' if File.directory? '/lib'
end
else
libdir = '/lib32' if File.directory? '/lib32'
end
@ -40,8 +44,17 @@ when /linux/
# 64-bit ruby
libdir = '/lib64' if File.directory? '/lib64'
end
libc_so = File.join(libdir, "libc.so.6")
libm_so = File.join(libdir, "libm.so.6")
# Handle musl libc
libc = Dir.glob(File.join(libdir, "libc.musl*.so*"))
if libc && libc.length > 0
libc_so = libc[0]
libm_so = libc[0]
else
# glibc
libc_so = File.join(libdir, "libc.so.6")
libm_so = File.join(libdir, "libm.so.6")
end
when /mingw/, /mswin/
require "rbconfig"
crtname = RbConfig::CONFIG["RUBY_SO_NAME"][/msvc\w+/] || 'ucrtbase'