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