From ebf06041d9f19a9e921e03cd02cc8ae5a36eb830 Mon Sep 17 00:00:00 2001 From: Hans de Graaff Date: Sun, 13 Sep 2015 08:52:15 +0200 Subject: Add patches for x32 support backported from ruby 2.1 https://bugs.gentoo.org/show_bug.cgi?id=480238 --- patchsets/patches-2.0.0_p647-r1/004_gfbsd7.patch | 37 +++++++++++++ .../005_no-undefined-ext.patch | 11 ++++ patchsets/patches-2.0.0_p647-r1/009_no-gems.patch | 63 ++++++++++++++++++++++ patchsets/patches-2.0.0_p647-r1/010_uclibc.patch | 45 ++++++++++++++++ .../patches-2.0.0_p647-r1/012_no_forced_sse2.patch | 27 ++++++++++ .../013_x32_asm_volatile.patch | 16 ++++++ .../patches-2.0.0_p647-r1/014_x32_asm_ilp32.patch | 13 +++++ 7 files changed, 212 insertions(+) create mode 100644 patchsets/patches-2.0.0_p647-r1/004_gfbsd7.patch create mode 100644 patchsets/patches-2.0.0_p647-r1/005_no-undefined-ext.patch create mode 100644 patchsets/patches-2.0.0_p647-r1/009_no-gems.patch create mode 100644 patchsets/patches-2.0.0_p647-r1/010_uclibc.patch create mode 100644 patchsets/patches-2.0.0_p647-r1/012_no_forced_sse2.patch create mode 100644 patchsets/patches-2.0.0_p647-r1/013_x32_asm_volatile.patch create mode 100644 patchsets/patches-2.0.0_p647-r1/014_x32_asm_ilp32.patch diff --git a/patchsets/patches-2.0.0_p647-r1/004_gfbsd7.patch b/patchsets/patches-2.0.0_p647-r1/004_gfbsd7.patch new file mode 100644 index 0000000..450d714 --- /dev/null +++ b/patchsets/patches-2.0.0_p647-r1/004_gfbsd7.patch @@ -0,0 +1,37 @@ +--- configure.in.orig 2013-05-05 19:36:02.800254192 +0200 ++++ configure.in 2013-05-05 19:37:56.573346196 +0200 +@@ -2156,7 +2156,7 @@ + fi + + AS_CASE(["$target_os"], +-[linux* | gnu* | k*bsd*-gnu | bsdi* | kopensolaris*-gnu | nacl], [ ++[linux* | gnu* | k*bsd*-gnu | bsdi* | kopensolaris*-gnu | nacl | freebsd* | dragonfly*], [ + if test "$rb_cv_binary_elf" = no; then + with_dln_a_out=yes + else +@@ -2249,7 +2249,7 @@ + [bsdi3*], [ AS_CASE(["$CC"], + [*shlicc*], [ : ${LDSHARED='$(CC) -r'} + rb_cv_dlopen=yes])], +- [linux* | gnu* | k*bsd*-gnu | netbsd* | bsdi* | kopensolaris*-gnu], [ ++ [linux* | gnu* | k*bsd*-gnu | netbsd* | bsdi* | kopensolaris*-gnu | freebsd7*], [ + : ${LDSHARED='$(CC) -shared'} + if test "$rb_cv_binary_elf" = yes; then + LDFLAGS="$LDFLAGS -Wl,-export-dynamic" +@@ -2262,7 +2262,6 @@ + [freebsd*|dragonfly*], [ + : ${LDSHARED='$(CC) -shared'} + if test "$rb_cv_binary_elf" = yes; then +- LDFLAGS="$LDFLAGS -rdynamic" + DLDFLAGS="$DLDFLAGS "'-Wl,-soname,$@' + else + test "$GCC" = yes && test "$rb_cv_prog_gnu_ld" = yes || LDSHARED='$(LD) -Bshareable' +@@ -2638,7 +2637,7 @@ + [sunos4*], [ + LIBRUBY_ALIASES='lib$(RUBY_SO_NAME).so.$(MAJOR).$(MINOR) lib$(RUBY_SO_NAME).so' + ], +- [linux* | gnu* | k*bsd*-gnu | atheos* | kopensolaris*-gnu], [ ++ [linux* | gnu* | k*bsd*-gnu | atheos* | kopensolaris*-gnu | freebsd7*], [ + LIBRUBY_DLDFLAGS='-Wl,-soname,lib$(RUBY_SO_NAME).so.$(MAJOR).$(MINOR)'" $LDFLAGS_OPTDIR" + LIBRUBY_ALIASES='lib$(RUBY_SO_NAME).so.$(MAJOR).$(MINOR) lib$(RUBY_SO_NAME).so' + if test "$load_relative" = yes; then diff --git a/patchsets/patches-2.0.0_p647-r1/005_no-undefined-ext.patch b/patchsets/patches-2.0.0_p647-r1/005_no-undefined-ext.patch new file mode 100644 index 0000000..f279932 --- /dev/null +++ b/patchsets/patches-2.0.0_p647-r1/005_no-undefined-ext.patch @@ -0,0 +1,11 @@ +--- ruby-1.9.3-preview1.orig/configure.in ++++ ruby-1.9.3-preview1/configure.in +@@ -2038,7 +2038,7 @@ if test "$with_dln_a_out" != yes; then + [linux* | gnu* | k*bsd*-gnu | netbsd* | bsdi* | kopensolaris*-gnu], [ + : ${LDSHARED='$(CC) -shared'} + if test "$rb_cv_binary_elf" = yes; then +- LDFLAGS="$LDFLAGS -Wl,-export-dynamic" ++ LDFLAGS="$LDFLAGS -Wl,-export-dynamic -Wl,--no-undefined" + fi + rb_cv_dlopen=yes], + [interix*], [ : ${LDSHARED='$(CC) -shared'} diff --git a/patchsets/patches-2.0.0_p647-r1/009_no-gems.patch b/patchsets/patches-2.0.0_p647-r1/009_no-gems.patch new file mode 100644 index 0000000..a9271af --- /dev/null +++ b/patchsets/patches-2.0.0_p647-r1/009_no-gems.patch @@ -0,0 +1,63 @@ +--- tool/rbinstall.rb.orig 2013-05-05 19:40:15.417797767 +0200 ++++ tool/rbinstall.rb 2013-05-05 19:41:08.064452389 +0200 +@@ -685,59 +685,7 @@ + # :startdoc: + + install?(:ext, :comm, :gem) do +- $:.unshift(File.join(srcdir, "lib")) +- require("rubygems.rb") +- gem_dir = Gem.default_dir +- # Gem.ensure_gem_subdirectories makes subdirectories group-writable. +- directories = Gem::REPOSITORY_SUBDIRECTORIES +- prepare "default gems", gem_dir, directories +- +- spec_dir = File.join(gem_dir, directories.grep(/^spec/)[0]) +- default_spec_dir = "#{spec_dir}/default" +- makedirs(default_spec_dir) +- +- gems = {} +- File.foreach(File.join(srcdir, "defs/default_gems")) do |line| +- line.chomp! +- line.sub!(/\s*#.*/, '') +- next if line.empty? +- words = [] +- line.scan(/\G\s*([^\[\]\s]+|\[([^\[\]]*)\])/) do +- words << ($2 ? $2.split : $1) +- end +- name, base_dir, src, execs = *words +- next unless name and base_dir and src +- +- src = File.join(srcdir, src) +- base_dir = File.join(srcdir, base_dir) +- specgen = RbInstall::Specs::Generator.new(name, base_dir, src, execs || []) +- gems[name] ||= specgen +- end +- +- Dir.glob(srcdir+"/{lib,ext}/**/*.gemspec").each do |src| +- specgen = RbInstall::Specs::Reader.new(src) +- gems[specgen.gemspec.name] ||= specgen +- end +- +- gems.sort.each do |name, specgen| +- gemspec = specgen.gemspec +- base_dir = specgen.src.sub(/\A#{Regexp.escape(srcdir)}\//, "") +- full_name = "#{gemspec.name}-#{gemspec.version}" +- +- puts "#{" "*30}#{gemspec.name} #{gemspec.version}" +- gemspec_path = File.join(default_spec_dir, "#{full_name}.gemspec") +- open_for_install(gemspec_path, $data_mode) do +- specgen.spec_source +- end +- +- unless gemspec.executables.empty? then +- bin_dir = File.join(gem_dir, 'gems', full_name, 'bin') +- makedirs(bin_dir) +- +- execs = gemspec.executables.map {|exec| File.join(srcdir, 'bin', exec)} +- install(execs, bin_dir, :mode => $prog_mode) +- end +- end ++# gems are unbundled + end + + parse_args() diff --git a/patchsets/patches-2.0.0_p647-r1/010_uclibc.patch b/patchsets/patches-2.0.0_p647-r1/010_uclibc.patch new file mode 100644 index 0000000..c2cf6ee --- /dev/null +++ b/patchsets/patches-2.0.0_p647-r1/010_uclibc.patch @@ -0,0 +1,45 @@ +diff -urp ruby-2.0.0-p353/missing/isinf.c ruby-2.0.0-p353-uclibc/missing/isinf.c +--- ruby-2.0.0-p353/missing/isinf.c 2011-05-15 07:55:52.000000000 -0400 ++++ ruby-2.0.0-p353-uclibc/missing/isinf.c 2014-02-01 09:19:31.000000000 -0500 +@@ -52,6 +52,7 @@ static double zero(void) { return 0.0; } + static double one (void) { return 1.0; } + static double inf (void) { return one() / zero(); } + ++#ifndef isinf + int + isinf(double n) + { +@@ -67,3 +68,4 @@ isinf(double n) + } + #endif + #endif ++#endif +diff -urp ruby-2.0.0-p353/missing/isnan.c ruby-2.0.0-p353-uclibc/missing/isnan.c +--- ruby-2.0.0-p353/missing/isnan.c 2010-07-28 04:12:01.000000000 -0400 ++++ ruby-2.0.0-p353-uclibc/missing/isnan.c 2014-01-31 22:12:44.000000000 -0500 +@@ -2,6 +2,20 @@ + + #include "ruby/missing.h" + ++/* ++ * isnan() may be a macro, a function or both. ++ * (The C99 standard defines that isnan() is a macro, though.) ++ * http://www.gnu.org/software/automake/manual/autoconf/Function-Portability.html ++ * ++ * macro only: uClibc ++ * both: GNU libc ++ * ++ * This file is compile if no isnan() function is available. ++ * (autoconf AC_REPLACE_FUNCS detects only the function.) ++ * The macro is detected by following #ifndef. ++ */ ++ ++#ifndef isnan + static int double_ne(double n1, double n2); + + int +@@ -15,3 +29,4 @@ double_ne(double n1, double n2) + { + return n1 != n2; + } ++#endif diff --git a/patchsets/patches-2.0.0_p647-r1/012_no_forced_sse2.patch b/patchsets/patches-2.0.0_p647-r1/012_no_forced_sse2.patch new file mode 100644 index 0000000..dafb644 --- /dev/null +++ b/patchsets/patches-2.0.0_p647-r1/012_no_forced_sse2.patch @@ -0,0 +1,27 @@ +*** configure.in.orig Wed Nov 5 23:42:58 2014 +--- configure.in Wed Nov 5 23:56:37 2014 +*************** +*** 771,792 **** + for oflag in -fno-fast-math; do + RUBY_TRY_CFLAGS($oflag, [RUBY_APPEND_OPTION(optflags, $oflag)]) + done +- AS_CASE(["$target"], +- [*-darwin*], [ +- # doesn't seem necessary on Mac OS X +- ], +- [[i[4-6]86*|i386*mingw*]], [ +- RUBY_TRY_CFLAGS(-msse2 -mfpmath=sse, [ +- RUBY_APPEND_OPTION(XCFLAGS, -msse2 -mfpmath=sse) +- ]) +- AS_CASE(["$XCFLAGS"], +- [[*-msse2*]], [ +- RUBY_TRY_CFLAGS(-mstackrealign, [ +- RUBY_APPEND_OPTION(XCFLAGS, -mstackrealign) +- ]) +- ]) +- ] +- ) + fi + + test -z "${ac_env_CFLAGS_set}" -a -n "${cflags+set}" && eval CFLAGS="\"$cflags $ARCH_FLAG\"" +--- 771,776 ---- diff --git a/patchsets/patches-2.0.0_p647-r1/013_x32_asm_volatile.patch b/patchsets/patches-2.0.0_p647-r1/013_x32_asm_volatile.patch new file mode 100644 index 0000000..870dc5b --- /dev/null +++ b/patchsets/patches-2.0.0_p647-r1/013_x32_asm_volatile.patch @@ -0,0 +1,16 @@ +Index: gc.h +=================================================================== +--- gc.h (revision 39185) ++++ gc.h (revision 39186) +@@ -3,9 +3,9 @@ + #define RUBY_GC_H 1 + + #if defined(__x86_64__) && defined(__GNUC__) && !defined(__native_client__) +-#define SET_MACHINE_STACK_END(p) __asm__ volatile ("movq\t%%rsp, %0" : "=r" (*(p))) ++#define SET_MACHINE_STACK_END(p) __asm__ __volatile__ ("movq\t%%rsp, %0" : "=r" (*(p))) + #elif defined(__i386) && defined(__GNUC__) && !defined(__native_client__) +-#define SET_MACHINE_STACK_END(p) __asm__ volatile ("movl\t%%esp, %0" : "=r" (*(p))) ++#define SET_MACHINE_STACK_END(p) __asm__ __volatile__ ("movl\t%%esp, %0" : "=r" (*(p))) + #else + NOINLINE(void rb_gc_set_stack_end(VALUE **stack_end_p)); + #define SET_MACHINE_STACK_END(p) rb_gc_set_stack_end(p) diff --git a/patchsets/patches-2.0.0_p647-r1/014_x32_asm_ilp32.patch b/patchsets/patches-2.0.0_p647-r1/014_x32_asm_ilp32.patch new file mode 100644 index 0000000..81b7fe8 --- /dev/null +++ b/patchsets/patches-2.0.0_p647-r1/014_x32_asm_ilp32.patch @@ -0,0 +1,13 @@ +Index: gc.h +=================================================================== +--- gc.h (revision 40635) ++++ gc.h (revision 40636) +@@ -2,7 +2,7 @@ + #ifndef RUBY_GC_H + #define RUBY_GC_H 1 + +-#if defined(__x86_64__) && defined(__GNUC__) && !defined(__native_client__) ++#if defined(__x86_64__) && !defined(_ILP32) && defined(__GNUC__) && !defined(__native_client__) + #define SET_MACHINE_STACK_END(p) __asm__ __volatile__ ("movq\t%%rsp, %0" : "=r" (*(p))) + #elif defined(__i386) && defined(__GNUC__) && !defined(__native_client__) + #define SET_MACHINE_STACK_END(p) __asm__ __volatile__ ("movl\t%%esp, %0" : "=r" (*(p))) -- cgit v1.2.3-65-gdbad