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