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