summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans de Graaff <hans@degraaff.org>2017-07-15 16:11:45 +0200
committerHans de Graaff <hans@degraaff.org>2017-07-15 16:11:45 +0200
commitb2474de83c56b3ae9ede43f238b7190ec7cbbd0b (patch)
tree8952ff977e799b3d28fce02365840ce6909a793a
parentAdd patchsets for -r2 revision of current ruby versions (diff)
downloadruby-scripts-b2474de83c56b3ae9ede43f238b7190ec7cbbd0b.tar.gz
ruby-scripts-b2474de83c56b3ae9ede43f238b7190ec7cbbd0b.tar.bz2
ruby-scripts-b2474de83c56b3ae9ede43f238b7190ec7cbbd0b.zip
patchset for ruby 2.4.1-r3
-rw-r--r--patchsets/patches-2.4.1-r3/001_ia64.patch62
-rw-r--r--patchsets/patches-2.4.1-r3/002_windows_crossdev.patch64
-rw-r--r--patchsets/patches-2.4.1-r3/005_no-undefined-ext.patch11
-rw-r--r--patchsets/patches-2.4.1-r3/006_static-linked-ext.patch26
-rw-r--r--patchsets/patches-2.4.1-r3/009_no-gems.patch112
5 files changed, 275 insertions, 0 deletions
diff --git a/patchsets/patches-2.4.1-r3/001_ia64.patch b/patchsets/patches-2.4.1-r3/001_ia64.patch
new file mode 100644
index 0000000..e1e9c89
--- /dev/null
+++ b/patchsets/patches-2.4.1-r3/001_ia64.patch
@@ -0,0 +1,62 @@
+Bug: https://bugs.gentoo.org/show_bug.cgi?id=561780
+
+fix crash on register stack mark/sweep pass
+
+The crash looks like
+
+ Program received signal SIGSEGV, Segmentation fault.
+ mark_locations_array (objspace=0x6000000000045db0, x=0x0, n=864692227966763116) at gc.c:3297
+ 3297 v = *x;
+ (gdb) bt
+ #0 mark_locations_array (objspace=0x6000000000045db0, x=0x0, n=864692227966763116) at gc.c:3297
+ #1 0x400000000014a040 in gc_mark_locations (objspace=0x6000000000045db0, start=0x0, end=0x6000080000000368) at gc.c:3310
+ #2 0x400000000014b3a0 in mark_current_machine_context (objspace=0x6000000000045db0, th=0x60000000000455b0) at gc.c:3500
+ #3 0x400000000014dfe0 in gc_mark_roots (objspace=0x6000000000045db0, full_mark=0, categoryp=0x0) at gc.c:4105
+ #4 0x400000000014e6b0 in gc_marks_body (objspace=0x6000000000045db0, full_mark=0) at gc.c:4164
+ #5 0x400000000014f260 in gc_marks (objspace=0x6000000000045db0, full_mark=0) at gc.c:4526
+ #6 0x40000000001525c0 in garbage_collect_body (objspace=0x6000000000045db0, full_mark=0, immediate_sweep=0, reason=256) at gc.c:5024
+ #7 0x400000000013c010 in heap_prepare_freepage (objspace=0x6000000000045db0, heap=0x6000000000045dc0) at gc.c:1219
+ #8 0x400000000013c140 in heap_get_freeobj_from_next_freepage (objspace=0x6000000000045db0, heap=0x6000000000045dc0) at gc.c:1237
+ #9 0x400000000013c360 in heap_get_freeobj (objspace=0x6000000000045db0, heap=0x6000000000045dc0) at gc.c:1259
+ #10 0x400000000013c950 in newobj_of (klass=0, flags=40, v1=0, v2=0, v3=0) at gc.c:1303
+ #11 0x400000000013ccc0 in rb_newobj_of (klass=0, flags=40) at gc.c:1356
+ #12 0x4000000000163740 in hash_alloc (klass=0) at hash.c:289
+ #13 0x4000000000163860 in rb_hash_new () at hash.c:309
+ #14 0x400000000050e420 in Init_BareVM () at vm.c:2822
+ #15 0x40000000000f6b60 in ruby_setup () at eval.c:54
+ #16 0x40000000000f6f50 in ruby_init () at eval.c:75
+ #17 0x400000000001b010 in main (argc=9, argv=0x60000fffffffb1d8) at main.c:35
+
+The problem here is in call
+ gc_mark_locations (objspace=0x6000000000045db0, start=0x0, end=0x6000080000000368) at gc.c:3310
+where 'start' (native_main_thread.register_stack_start)
+is supposed to be stack start but it's not initialized.
+
+The initialization of 'native_main_thread.register_stack_start'
+is supposed to be done in 'ruby_init_stack()'.
+
+But code under 'MAINSTACKADDR_AVAILABLE' exits early.
+The fix is to move 'register_stack_start' earlier.
+
+diff --git a/thread_pthread.c b/thread_pthread.c
+index c8a7a16..9ad448b 100644
+--- a/thread_pthread.c
++++ b/thread_pthread.c
+@@ -722,2 +722,8 @@ ruby_init_stack(volatile VALUE *addr
+ native_main_thread.id = pthread_self();
++#ifdef __ia64
++ if (!native_main_thread.register_stack_start ||
++ (VALUE*)bsp < native_main_thread.register_stack_start) {
++ native_main_thread.register_stack_start = (VALUE*)bsp;
++ }
++#endif
+ #if MAINSTACKADDR_AVAILABLE
+@@ -745,8 +751,2 @@ ruby_init_stack(volatile VALUE *addr
+ #endif
+-#ifdef __ia64
+- if (!native_main_thread.register_stack_start ||
+- (VALUE*)bsp < native_main_thread.register_stack_start) {
+- native_main_thread.register_stack_start = (VALUE*)bsp;
+- }
+-#endif
+ {
diff --git a/patchsets/patches-2.4.1-r3/002_windows_crossdev.patch b/patchsets/patches-2.4.1-r3/002_windows_crossdev.patch
new file mode 100644
index 0000000..7e290d4
--- /dev/null
+++ b/patchsets/patches-2.4.1-r3/002_windows_crossdev.patch
@@ -0,0 +1,64 @@
+Bug: https://bugs.gentoo.org/show_bug.cgi?id=618878
+
+A few patches to make crossdev for mingw-w64 play nice with ruby's ebuilds.
+Basic gist is that without the following patch to configure.in ruby-2.4.1
+hardcodes 240 into the shared, static, and import library names, which when
+built with the current ruby ebuilds results in names like libx64-msvcrt-ruby24240.dll and so on. The patch is in ruby-trunk[1], but may take a while
+to hit the tarballs that gentoo uses.
+
+Index: configure.in
+===================================================================
+--- a/configure.in (revision 57824)
++++ b/configure.in (revision 57825)
+@@ -3825,7 +3825,23 @@
+
+ AC_ARG_WITH(soname,
+ AS_HELP_STRING([--with-soname=SONAME], [base name of shared library]),
+- [RUBY_SO_NAME=$withval], [RUBY_SO_NAME='$(RUBY_BASE_NAME)'])
++ [RUBY_SO_NAME=$withval],
++ [
++ AS_CASE(["$target_os"],
++ [darwin*], [
++ RUBY_SO_NAME='$(RUBY_BASE_NAME).$(RUBY_PROGRAM_VERSION)'
++ ],
++ [cygwin*], [
++ RUBY_SO_NAME='$(RUBY_BASE_NAME)$(MAJOR)$(MINOR)0'
++ ],
++ [mingw*], [
++ RUBY_SO_NAME="${rb_cv_msvcrt}"'-$(RUBY_BASE_NAME)$(MAJOR)$(MINOR)0'
++ AS_IF([test x"${target_cpu}" != xi386], [
++ RUBY_SO_NAME="${target_cpu}-${RUBY_SO_NAME}"
++ ])
++ ],
++ [RUBY_SO_NAME='$(RUBY_BASE_NAME)'])
++ ])
+
+ LIBRUBY_LDSHARED=$LDSHARED
+ LIBRUBY_DLDFLAGS=$DLDFLAGS
+@@ -3925,7 +3941,6 @@
+ SOLIBS='-lm -lc'
+ ],
+ [darwin*], [
+- RUBY_SO_NAME="$RUBY_SO_NAME"'.$(RUBY_PROGRAM_VERSION)'
+ LIBRUBY_LDSHARED='$(CC) -dynamiclib'
+ if test "$load_relative" = yes; then
+ libprefix="@executable_path/../${libdir_basename}"
+@@ -4157,7 +4172,6 @@
+ fi
+ ],
+ [cygwin*|mingw*], [
+- RUBY_SO_NAME="${RUBY_SO_NAME}"'$(MAJOR)$(MINOR)0'
+ LIBRUBY_DLDFLAGS="${DLDFLAGS}"' -Wl,--out-implib=$(LIBRUBY)'
+ AS_CASE(["$target_os"],
+ [cygwin*], [
+@@ -4167,10 +4181,6 @@
+ fi
+ ],
+ [mingw*], [
+- RUBY_SO_NAME="${rb_cv_msvcrt}-${RUBY_SO_NAME}"
+- if test x"${target_cpu}" != xi386; then
+- RUBY_SO_NAME="${target_cpu}-${RUBY_SO_NAME}"
+- fi
+ if test x"$enable_shared" = xyes; then
+ LIBRUBY_SO='$(RUBY_SO_NAME)'.dll
+ LIBRUBY_DLDFLAGS="${LIBRUBY_DLDFLAGS}"' $(RUBYDEF)'
diff --git a/patchsets/patches-2.4.1-r3/005_no-undefined-ext.patch b/patchsets/patches-2.4.1-r3/005_no-undefined-ext.patch
new file mode 100644
index 0000000..f279932
--- /dev/null
+++ b/patchsets/patches-2.4.1-r3/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.4.1-r3/006_static-linked-ext.patch b/patchsets/patches-2.4.1-r3/006_static-linked-ext.patch
new file mode 100644
index 0000000..7404562
--- /dev/null
+++ b/patchsets/patches-2.4.1-r3/006_static-linked-ext.patch
@@ -0,0 +1,26 @@
+From b3dbeb6e90f316584f70e33f6bfb9d83fa5f30d3 Mon Sep 17 00:00:00 2001
+From: nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>
+Date: Sat, 28 Jan 2017 05:02:39 +0000
+Subject: [PATCH] mkmf.rb: fix script installation
+
+* lib/mkmf.rb (MakeMakefile): fix condition to install script
+ files.
+
+git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57446 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
+---
+ lib/mkmf.rb | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/lib/mkmf.rb b/lib/mkmf.rb
+index 34dbcda657e1..3b500ec782b2 100644
+--- a/lib/mkmf.rb
++++ b/lib/mkmf.rb
+@@ -2306,7 +2306,7 @@ def create_makefile(target, srcprefix = nil)
+ mfile.puts(conf)
+ mfile.print "
+ all: #{$extout ? "install" : target ? "$(DLLIB)" : "Makefile"}
+-static: #{$extmk && !$static ? "all" : "$(STATIC_LIB)#{!$extmk ? " install-rb" : ""}"}
++static: #{$extmk && !$static ? "all" : "$(STATIC_LIB)#{$extout ? " install-rb" : ""}"}
+ .PHONY: all install static install-so install-rb
+ .PHONY: clean clean-so clean-static clean-rb
+ " #"
diff --git a/patchsets/patches-2.4.1-r3/009_no-gems.patch b/patchsets/patches-2.4.1-r3/009_no-gems.patch
new file mode 100644
index 0000000..cdf503c
--- /dev/null
+++ b/patchsets/patches-2.4.1-r3/009_no-gems.patch
@@ -0,0 +1,112 @@
+--- tool/rbinstall.rb.~1~ 2016-10-17 09:17:07.000000000 +0200
++++ tool/rbinstall.rb 2016-12-25 08:20:07.873491045 +0100
+@@ -695,107 +695,11 @@
+ # :startdoc:
+
+ install?(:ext, :comm, :gem) do
+- gem_dir = Gem.default_dir
+- directories = Gem.ensure_gem_subdirectories(gem_dir, :mode => $dir_mode)
+- 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 = Dir.glob(srcdir+"/{lib,ext}/**/*.gemspec").map {|src|
+- spec = Gem::Specification.load(src) || raise("invalid spec in #{src}")
+- file_collector = RbInstall::Specs::FileCollector.new(File.dirname(src))
+- files = file_collector.collect
+- next if files.empty?
+- spec.files = files
+- spec
+- }
+- gems.compact.sort_by(&:name).each do |gemspec|
+- 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
+- gemspec.to_ruby
+- end
+-
+- unless gemspec.executables.empty? then
+- bin_dir = File.join(gem_dir, 'gems', full_name, gemspec.bindir)
+- makedirs(bin_dir)
+-
+- execs = gemspec.executables.map {|exec| File.join(srcdir, 'bin', exec)}
+- install(execs, bin_dir, :mode => $script_mode)
+- end
+- end
++ # gems are unbundled in Gentoo
+ end
+
+ install?(:ext, :comm, :gem) do
+- gem_dir = Gem.default_dir
+- directories = Gem.ensure_gem_subdirectories(gem_dir, :mode => $dir_mode)
+- prepare "bundle gems", gem_dir, directories
+- install_dir = with_destdir(gem_dir)
+- installed_gems = {}
+- options = {
+- :install_dir => install_dir,
+- :bin_dir => with_destdir(bindir),
+- :domain => :local,
+- :ignore_dependencies => true,
+- :dir_mode => $dir_mode,
+- :data_mode => $data_mode,
+- :prog_mode => $prog_mode,
+- :wrappers => true,
+- :format_executable => true,
+- }
+- gem_ext_dir = "#$extout/gems/#{CONFIG['arch']}"
+- extensions_dir = Gem::StubSpecification.gemspec_stub("", gem_dir, gem_dir).extensions_dir
+- Gem::Specification.each_gemspec([srcdir+'/gems/*']) do |path|
+- dir = File.dirname(path)
+- spec = Dir.chdir(dir) {
+- Gem::Specification.load(File.basename(path))
+- }
+- next unless spec.platform == Gem::Platform::RUBY
+- next unless spec.full_name == path[srcdir.size..-1][/\A\/gems\/([^\/]+)/, 1]
+- spec.extension_dir = "#{extensions_dir}/#{spec.full_name}"
+- if File.directory?(ext = "#{gem_ext_dir}/#{spec.full_name}")
+- spec.extensions[0] ||= "-"
+- end
+- ins = RbInstall::UnpackedInstaller.new(spec, options)
+- puts "#{" "*30}#{spec.name} #{spec.version}"
+- ins.install
+- File.chmod($data_mode, File.join(install_dir, "specifications", "#{spec.full_name}.gemspec"))
+- unless spec.extensions.empty?
+- install_recursive(ext, spec.extension_dir)
+- end
+- installed_gems[spec.full_name] = true
+- end
+- installed_gems, gems = Dir.glob(srcdir+'/gems/*.gem').partition {|gem| installed_gems.key?(File.basename(gem, '.gem'))}
+- unless installed_gems.empty?
+- install installed_gems, gem_dir+"/cache"
+- end
+- next if gems.empty?
+- if defined?(Zlib)
+- Gem.instance_variable_set(:@ruby, with_destdir(File.join(bindir, ruby_install_name)))
+- silent = Gem::SilentUI.new
+- gems.each do |gem|
+- inst = Gem::Installer.new(gem, options)
+- inst.spec.extension_dir = with_destdir(inst.spec.extension_dir)
+- begin
+- Gem::DefaultUserInteraction.use_ui(silent) {inst.install}
+- rescue Gem::InstallError => e
+- next
+- end
+- gemname = File.basename(gem)
+- puts "#{" "*30}#{gemname}"
+- end
+- # fix directory permissions
+- # TODO: Gem.install should accept :dir_mode option or something
+- File.chmod($dir_mode, *Dir.glob(install_dir+"/**/"))
+- # fix .gemspec permissions
+- File.chmod($data_mode, *Dir.glob(install_dir+"/specifications/*.gemspec"))
+- else
+- puts "skip installing bundle gems because of lacking zlib"
+- end
++ # gems are unbundled in Gentoo
+ end
+
+ parse_args()