Blame SOURCES/ruby-2.3.1-Rely-on-ldd-to-detect-glibc.patch

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