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