e227b8
From 346e147ba6480839b87046e9a9efab0bf6ed3660 Mon Sep 17 00:00:00 2001
e227b8
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
e227b8
Date: Wed, 10 Aug 2016 17:35:48 +0200
e227b8
Subject: [PATCH] Rely on ldd to detect glibc.
e227b8
e227b8
This is just workaround, since we know we are quite sure this will be successful
e227b8
on Red Hat platforms.
e227b8
e227b8
This workaround rhbz#1361037
e227b8
---
651d8b
 test/fiddle/helper.rb | 111 ------------------------------------------
651d8b
 1 file changed, 111 deletions(-)
e227b8
e227b8
diff --git a/test/fiddle/helper.rb b/test/fiddle/helper.rb
e227b8
index 1da3d93..65148a1 100644
e227b8
--- a/test/fiddle/helper.rb
e227b8
+++ b/test/fiddle/helper.rb
651d8b
@@ -6,115 +6,6 @@
e227b8
 
e227b8
 libc_so = libm_so = nil
e227b8
 
e227b8
-case RUBY_PLATFORM
e227b8
-when /cygwin/
e227b8
-  libc_so = "cygwin1.dll"
e227b8
-  libm_so = "cygwin1.dll"
e227b8
-when /android/
e227b8
-  libdir = '/system/lib'
e227b8
-  if [0].pack('L!').size == 8
e227b8
-    libdir = '/system/lib64'
e227b8
-  end
e227b8
-  libc_so = File.join(libdir, "libc.so")
e227b8
-  libm_so = File.join(libdir, "libm.so")
e227b8
-when /linux/
e227b8
-  libdir = '/lib'
e227b8
-  case RbConfig::SIZEOF['void*']
e227b8
-  when 4
e227b8
-    # 32-bit ruby
e227b8
-    case RUBY_PLATFORM
e227b8
-    when /armv\w+-linux/
e227b8
-      # In the ARM 32-bit libc package such as libc6:armhf libc6:armel,
e227b8
-      # libc.so and libm.so are installed to /lib/arm-linux-gnu*.
e227b8
-      # It's not installed to /lib32.
e227b8
-      dirs = Dir.glob('/lib/arm-linux-gnu*')
e227b8
-      libdir = dirs[0] if dirs && File.directory?(dirs[0])
e227b8
-    else
e227b8
-      libdir = '/lib32' if File.directory? '/lib32'
e227b8
-    end
e227b8
-  when 8
e227b8
-    # 64-bit ruby
e227b8
-    libdir = '/lib64' if File.directory? '/lib64'
e227b8
-  end
e227b8
-  libc_so = File.join(libdir, "libc.so.6")
e227b8
-  libm_so = File.join(libdir, "libm.so.6")
e227b8
-when /mingw/, /mswin/
e227b8
-  require "rbconfig"
e227b8
-  crtname = RbConfig::CONFIG["RUBY_SO_NAME"][/msvc\w+/] || 'ucrtbase'
e227b8
-  libc_so = libm_so = "#{crtname}.dll"
e227b8
-when /darwin/
651d8b
-  libc_so = libm_so = "/usr/lib/libSystem.B.dylib"
e227b8
-when /kfreebsd/
e227b8
-  libc_so = "/lib/libc.so.0.1"
e227b8
-  libm_so = "/lib/libm.so.1"
e227b8
-when /gnu/	#GNU/Hurd
e227b8
-  libc_so = "/lib/libc.so.0.3"
e227b8
-  libm_so = "/lib/libm.so.6"
e227b8
-when /mirbsd/
e227b8
-  libc_so = "/usr/lib/libc.so.41.10"
e227b8
-  libm_so = "/usr/lib/libm.so.7.0"
e227b8
-when /freebsd/
e227b8
-  libc_so = "/lib/libc.so.7"
e227b8
-  libm_so = "/lib/libm.so.5"
e227b8
-when /bsd|dragonfly/
e227b8
-  libc_so = "/usr/lib/libc.so"
e227b8
-  libm_so = "/usr/lib/libm.so"
e227b8
-when /solaris/
e227b8
-  libdir = '/lib'
e227b8
-  case RbConfig::SIZEOF['void*']
e227b8
-  when 4
e227b8
-    # 32-bit ruby
e227b8
-    libdir = '/lib' if File.directory? '/lib'
e227b8
-  when 8
e227b8
-    # 64-bit ruby
e227b8
-    libdir = '/lib/64' if File.directory? '/lib/64'
e227b8
-  end
e227b8
-  libc_so = File.join(libdir, "libc.so")
e227b8
-  libm_so = File.join(libdir, "libm.so")
e227b8
-when /aix/
e227b8
-  pwd=Dir.pwd
e227b8
-  libc_so = libm_so = "#{pwd}/libaixdltest.so"
e227b8
-  unless File.exist? libc_so
e227b8
-    cobjs=%w!strcpy.o!
e227b8
-    mobjs=%w!floats.o sin.o!
e227b8
-    funcs=%w!sin sinf strcpy strncpy!
e227b8
-    expfile='dltest.exp'
e227b8
-    require 'tmpdir'
e227b8
-    Dir.mktmpdir do |dir|
e227b8
-      begin
e227b8
-        Dir.chdir dir
e227b8
-        %x!/usr/bin/ar x /usr/lib/libc.a #{cobjs.join(' ')}!
e227b8
-        %x!/usr/bin/ar x /usr/lib/libm.a #{mobjs.join(' ')}!
e227b8
-        %x!echo "#{funcs.join("\n")}\n" > #{expfile}!
e227b8
-        require 'rbconfig'
e227b8
-        if RbConfig::CONFIG["GCC"] = 'yes'
e227b8
-          lflag='-Wl,'
e227b8
-        else
e227b8
-          lflag=''
e227b8
-        end
e227b8
-        flags="#{lflag}-bE:#{expfile} #{lflag}-bnoentry -lm"
e227b8
-        %x!#{RbConfig::CONFIG["LDSHARED"]} -o #{libc_so} #{(cobjs+mobjs).join(' ')} #{flags}!
e227b8
-      ensure
e227b8
-        Dir.chdir pwd
e227b8
-      end
e227b8
-    end
e227b8
-  end
e227b8
-else
e227b8
-  libc_so = ARGV[0] if ARGV[0] && ARGV[0][0] == ?/
e227b8
-  libm_so = ARGV[1] if ARGV[1] && ARGV[1][0] == ?/
e227b8
-  if( !(libc_so && libm_so) )
e227b8
-    $stderr.puts("libc and libm not found: #{$0} <libc> <libm>")
e227b8
-  end
e227b8
-end
e227b8
-
e227b8
-libc_so = nil if !libc_so || (libc_so[0] == ?/ && !File.file?(libc_so))
e227b8
-libm_so = nil if !libm_so || (libm_so[0] == ?/ && !File.file?(libm_so))
e227b8
-
651d8b
-# macOS 11.0+ removed libSystem.B.dylib from /usr/lib. But It works with dlopen.
651d8b
-if RUBY_PLATFORM =~ /darwin/
651d8b
-  libc_so = libm_so = "/usr/lib/libSystem.B.dylib"
651d8b
-end
651d8b
-
e227b8
 if !libc_so || !libm_so
e227b8
   ruby = EnvUtil.rubybin
e227b8
   # When the ruby binary is 32-bit and the host is 64-bit,
e227b8
-- 
e227b8
2.9.2
e227b8