vondruch / rpms / ruby

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