[前][次][番号順一覧][スレッド一覧]

ruby-changes:60613

From: Paul <ko1@a...>
Date: Wed, 1 Apr 2020 11:49:22 +0900 (JST)
Subject: [ruby-changes:60613] 3e386d76c2 (master): Fix helper to not assume glibc

https://git.ruby-lang.org/ruby.git/commit/?id=3e386d76c2

From 3e386d76c2d2f4a38ddf7101344178bff84c824f Mon Sep 17 00:00:00 2001
From: Paul Jordan <paullj1@g...>
Date: Wed, 1 Apr 2020 02:18:23 +0100
Subject: Fix helper to not assume glibc


diff --git a/test/fiddle/helper.rb b/test/fiddle/helper.rb
index 348131e..f5c7bd2 100644
--- a/test/fiddle/helper.rb
+++ b/test/fiddle/helper.rb
@@ -32,7 +32,11 @@ when /linux/ https://github.com/ruby/ruby/blob/trunk/test/fiddle/helper.rb#L32
       # 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/ https://github.com/ruby/ruby/blob/trunk/test/fiddle/helper.rb#L44
     # 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'
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]