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