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