Files
MSYS2-packages/ruby/ruby-2.4.0-msys2.patch

626 lines
26 KiB
Diff

diff -Naur ruby-2.4.0/configure.in.orig ruby-2.4.0/configure.in
--- ruby-2.4.0/configure.in.orig 2017-03-08 04:26:49.357858900 -0500
+++ ruby-2.4.0/configure.in 2017-03-08 04:26:49.490375400 -0500
@@ -60,7 +60,7 @@ AC_SUBST(HAVE_BASERUBY)
AC_DEFUN([RUBY_MINGW32],
[AS_CASE(["$host_os"],
-[cygwin*], [
+[cygwin*|msys*], [
AC_CACHE_CHECK(for mingw32 environment, rb_cv_mingw32,
[AC_TRY_CPP([
#ifndef __MINGW32__
@@ -114,7 +114,7 @@ AC_DEFUN([RUBY_NACL],
AS_CASE(["$build_os"],
[linux*], [nacl_cv_os_nick=linux],
[darwin*], [nacl_cv_os_nick=mac],
- [cygwin*|mingw*], [nacl_cv_os_nick=win],
+ [cygwin*|msys*|mingw*], [nacl_cv_os_nick=win],
[nacl_cv_os_nick=$build_os])
host="$host_cpu-chromium-$host_os-"
@@ -585,14 +585,14 @@ AC_CHECK_TOOL(AS, as)
ASFLAGS=$ASFLAGS
AC_SUBST(ASFLAGS)
-AS_CASE(["$target_os"],[cygwin*|mingw*], [ac_cv_prog_ac_ct_OBJCOPY=":"])
+AS_CASE(["$target_os"],[cygwin*|msys*|mingw*], [ac_cv_prog_ac_ct_OBJCOPY=":"])
# BSD's ports and MacPorts prefix GNU binutils with 'g'
AC_CHECK_TOOLS(OBJDUMP, [objdump gobjdump])
AC_CHECK_TOOLS(OBJCOPY, [objcopy gobjcopy])
AS_CASE(["$target_os"],
-[cygwin*|mingw*], [
+[cygwin*|msys*|mingw*], [
AC_CHECK_TOOL(WINDRES, windres)
AC_CHECK_TOOL(DLLWRAP, dllwrap)
target=`echo $target | sed "s/^$target_cpu-/-/"`
@@ -941,7 +941,7 @@ if test "$GCC" = yes; then
# comments. We bypass ANSI C mode for them. Otherwise
# extension libs cannot include those headers.
],
- [cygwin*|darwin*|netbsd*|nacl], [
+ [cygwin*|msys*|darwin*|netbsd*|nacl], [
# need lgamma_r(), finite()
],
[
@@ -1206,7 +1206,7 @@ main()
[haiku*], [
LIBS="$LIBS" # m lib is include in root
],
-[cygwin*], [ ac_cv_header_langinfo_h=yes
+[cygwin*|msys*], [ ac_cv_header_langinfo_h=yes
RUBY_APPEND_OPTIONS(CPPFLAGS, -D_XOPEN_SOURCE -D_GNU_SOURCE)
AC_CHECK_FUNCS(cygwin_conv_path)
AC_LIBOBJ([langinfo])
@@ -2469,7 +2469,7 @@ main(int argc, char **argv)
rb_cv_getcwd_malloc=yes,
rb_cv_getcwd_malloc=no,
AS_CASE($target_os,
- [linux*|darwin*|*bsd|cygwin*|mingw*|mswin*],
+ [linux*|darwin*|*bsd|cygwin*|msys*|mingw*|mswin*],
[rb_cv_getcwd_malloc=yes],
[rb_cv_getcwd_malloc=no]))])
AS_IF([test "$rb_cv_getcwd_malloc" = no], [AC_DEFINE(NO_GETCWD_MALLOC, 1)])
@@ -2711,7 +2711,7 @@ elif test "$ac_cv_func__setjmp" = yes; t
setjmp_prefix=_
setjmp_suffix=
elif test "$ac_cv_func_sigsetjmp" = yes; then
- AS_CASE([$target_os],[solaris*|cygwin*],[setjmp_prefix=],[setjmp_prefix=sig])
+ AS_CASE([$target_os],[solaris*|cygwin*|msys*],[setjmp_prefix=],[setjmp_prefix=sig])
setjmp_suffix=
else
setjmp_prefix=
@@ -3299,7 +3299,7 @@ if test "$with_dln_a_out" != yes; then
# mkmf.rb's have_header() to fail if the desired resource happens to be
# installed in the /usr/local tree.
RUBY_APPEND_OPTION(CCDLFLAGS, -fno-common)],
- [bsdi*|cygwin*|mingw*|aix*|interix*], [ ],
+ [bsdi*|cygwin*|msys*|mingw*|aix*|interix*], [ ],
[
RUBY_APPEND_OPTION(CCDLFLAGS, -fPIC)])
else
@@ -3401,9 +3401,9 @@ if test "$with_dln_a_out" != yes; then
: ${LDSHARED='$(LD) -Bshareable -x'}
LDFLAGS="$LDFLAGS -L/lib -L/usr/lib -L/usr/local/lib"
rb_cv_dlopen=yes],
- [cygwin*|mingw*], [
+ [cygwin*|msys*|mingw*], [
: ${LDSHARED='$(CC) -shared $(if $(filter-out -g -g0,$(debugflags)),,-s)'}
- XLDFLAGS="$XLDFLAGS -Wl,--stack,0x00200000,--enable-auto-import"
+ XLDFLAGS="$XLDFLAGS -Xlinker --stack -Xlinker 0x00200000,0x00040000 -Xlinker --enable-auto-import"
DLDFLAGS="${DLDFLAGS} -Wl,--enable-auto-image-base,--enable-auto-import"
: ${LIBPATHENV=""}
: ${PRELOADENV=""}
@@ -3775,7 +3775,7 @@ LIBRUBYARG='$(LIBRUBYARG_STATIC)'
SOLIBS=
AS_CASE(["$target_os"],
- [cygwin*|mingw*|haiku*|darwin*], [
+ [cygwin*|msys*|mingw*|haiku*|darwin*], [
: ${DLDLIBS=""}
],
[
@@ -4127,7 +4127,7 @@ AS_CASE(["$target_os"],
CFLAGS="$CFLAGS -std"
fi
],
- [cygwin*|mingw*], [
+ [cygwin*|msys*|mingw*], [
RUBY_SO_NAME="${RUBY_SO_NAME}"'$(MAJOR)$(MINOR)0'
LIBRUBY_DLDFLAGS="${DLDFLAGS}"' -Wl,--out-implib=$(LIBRUBY)'
AS_CASE(["$target_os"],
@@ -4137,6 +4137,12 @@ AS_CASE(["$target_os"],
LIBRUBY_DLDFLAGS="${LIBRUBY_DLDFLAGS}"' $(RUBYDEF)'
fi
],
+ [msys*], [
+ if test x"$enable_shared" = xyes; then
+ LIBRUBY_SO='msys-$(RUBY_SO_NAME)'.dll
+ LIBRUBY_DLDFLAGS="${LIBRUBY_DLDFLAGS}"' $(RUBYDEF)'
+ fi
+ ],
[mingw*], [
RUBY_SO_NAME="${rb_cv_msvcrt}-${RUBY_SO_NAME}"
if test x"${target_cpu}" != xi386; then
diff -Naur ruby-2.4.0/cygwin/GNUmakefile.in.orig ruby-2.4.0/cygwin/GNUmakefile.in
--- ruby-2.4.0/cygwin/GNUmakefile.in.orig 2016-08-19 22:20:34.000000000 -0400
+++ ruby-2.4.0/cygwin/GNUmakefile.in 2017-03-07 11:41:43.416174500 -0500
@@ -9,6 +9,8 @@
ifeq (@target_os@,cygwin)
DLL_BASE_NAME := $(LIBRUBY_SO:.dll=)
+else ifeq (@target_os@,msys)
+ DLL_BASE_NAME := $(LIBRUBY_SO:.dll=)
else
DLL_BASE_NAME := $(RUBY_SO_NAME)
DLLWRAP += -mno-cygwin
@@ -102,6 +104,12 @@
$(ECHO) generating $@
$(Q) @DLLWRAP@ -s --def=$(RUBYDEF) -o $@
endif
+
+ifeq (@target_os@,msys)
+msys2-$(RUBY_INSTALL_NAME)$(MAJOR)$(MINOR)$(TEENY).dll: $(LIBRUBY_A) $(RUBYDEF)
+ $(ECHO) generating $@
+ $(Q) @DLLWRAP@ -s --def=$(RUBYDEF) -o $@
+endif
clean-local::
@$(RM) $(RUBY_EXP) $(RCFILES:.rc=.res.@OBJEXT@)
diff -Naurp ruby-2.4.0/ext/etc/extconf.rb.orig ruby-2.4.0/ext/etc/extconf.rb
--- ruby-2.4.0/ext/etc/extconf.rb.orig 2015-12-16 00:31:54.000000000 -0500
+++ ruby-2.4.0/ext/etc/extconf.rb 2017-03-08 02:06:48.431627600 -0500
@@ -34,7 +34,7 @@ if have_struct_member('struct passwd', '
$defs.push("-DPW_AGE2VAL="+f)
end
have_struct_member('struct passwd', 'pw_class', 'pwd.h')
-have_struct_member('struct passwd', 'pw_comment', 'pwd.h') unless /cygwin/ === RUBY_PLATFORM
+have_struct_member('struct passwd', 'pw_comment', 'pwd.h') unless /cygwin|msys/ === RUBY_PLATFORM
have_struct_member('struct passwd', 'pw_expire', 'pwd.h')
have_struct_member('struct passwd', 'pw_passwd', 'pwd.h')
have_struct_member('struct group', 'gr_passwd', 'grp.h')
diff -Naurp ruby-2.4.0/ext/readline/extconf.rb.orig ruby-2.4.0/ext/readline/extconf.rb
--- ruby-2.4.0/ext/readline/extconf.rb.orig 2016-10-05 22:38:18.000000000 -0400
+++ ruby-2.4.0/ext/readline/extconf.rb 2017-03-08 02:06:48.438627800 -0500
@@ -30,7 +30,7 @@ dir_config('termcap')
dir_config("readline")
enable_libedit = enable_config("libedit")
-have_library("user32", nil) if /cygwin/ === RUBY_PLATFORM
+have_library("user32", nil) if /cygwin|msys/ === RUBY_PLATFORM
have_library("ncurses", "tgetnum") ||
have_library("termcap", "tgetnum") ||
have_library("curses", "tgetnum")
diff -Naurp ruby-2.4.0/ext/Setup.nt.orig ruby-2.4.0/ext/Setup.nt > patch.patch
--- ruby-2.4.0/ext/Setup.nt.orig 2016-08-09 02:44:45.000000000 -0400
+++ ruby-2.4.0/ext/Setup.nt 2017-03-08 01:45:30.833271000 -0500
@@ -1,4 +1,4 @@
-#option platform cygwin|mingw|mswin
+#option platform cygwin|msys|mingw|mswin
#option nodynamic
Win32API
diff -Naur ruby-2.4.0/ext/socket/extconf.rb.orig ruby-2.4.0/ext/socket/extconf.rb
--- ruby-2.4.0/ext/socket/extconf.rb.orig 2015-12-16 00:31:54.000000000 -0500
+++ ruby-2.4.0/ext/socket/extconf.rb 2017-03-08 01:45:30.840771400 -0500
@@ -254,7 +254,7 @@ def test_recvmsg_with_msg_peek_creates_f
# [ruby-dev:44189]
# http://bugs.ruby-lang.org/issues/5075
close_fds = false
- when /cygwin/
+ when /cygwin|msys/
# Cygwin doesn't support fd passing.
# http://cygwin.com/ml/cygwin/2003-09/msg01808.html
close_fds = false
@@ -434,7 +434,7 @@ case RUBY_PLATFORM
when /mswin(32|64)|mingw/
test_func = "WSACleanup"
have_library("ws2_32", "WSACleanup", headers)
-when /cygwin/
+when /cygwin|msys/
test_func = "socket(0,0,0)"
when /haiku/
test_func = "socket(0,0,0)"
diff -aurp ruby-2.4.0/ext/win32/extconf.rb.orig ruby-2.4.0/ext/win32/extconf.rb
--- ruby-2.4.0/ext/win32/extconf.rb.orig 2017-03-07 01:38:41.037947800 -0500
+++ ruby-2.4.0/ext/win32/extconf.rb 2017-03-07 02:51:58.412558900 -0500
@@ -1,4 +1,4 @@
# frozen_string_literal: false
-if $mswin||$mingw||$cygwin
+if $mswin||$mingw||$cygwin||$msys
create_makefile('win32')
end
diff -Naurp ruby-2.4.0/ext/win32ole/extconf.rb.orig ruby-2.4.0/ext/win32ole/extconf.rb
--- ruby-2.4.0/ext/win32ole/extconf.rb.orig 2015-12-16 00:31:54.000000000 -0500
+++ ruby-2.4.0/ext/win32ole/extconf.rb 2017-03-08 01:45:30.853273000 -0500
@@ -6,7 +6,7 @@
require 'mkmf'
case RUBY_PLATFORM
-when /cygwin/
+when /cygwin|msys/
inc = nil
lib = '/usr/lib/w32api'
end
diff -Naurp ruby-2.4.0/gems/rake-12.0.0/lib/rake/application.rb.orig ruby-2.4.0/gems/rake-12.0.0/lib/rake/application.rb
--- ruby-2.4.0/gems/rake-12.0.0/lib/rake/application.rb.orig 2016-12-23 11:07:31.000000000 -0500
+++ ruby-2.4.0/gems/rake-12.0.0/lib/rake/application.rb 2017-03-08 01:45:30.861274200 -0500
@@ -343,7 +343,7 @@ module Rake
def unix? # :nodoc:
RbConfig::CONFIG["host_os"] =~
- /(aix|darwin|linux|(net|free|open)bsd|cygwin|solaris|irix|hpux)/i
+ /(aix|darwin|linux|(net|free|open)bsd|cygwin|msys|solaris|irix|hpux)/i
end
def windows? # :nodoc:
diff -Naurp ruby-2.4.0/lib/mkmf.rb.orig ruby-2.4.0/lib/mkmf.rb
--- ruby-2.4.0/lib/mkmf.rb.orig 2016-09-23 22:28:25.000000000 -0400
+++ ruby-2.4.0/lib/mkmf.rb 2017-03-07 23:55:31.829763900 -0500
@@ -132,6 +132,7 @@ module MakeMakefile
$bccwin = /bccwin/ =~ RUBY_PLATFORM
$mingw = /mingw/ =~ RUBY_PLATFORM
$cygwin = /cygwin/ =~ RUBY_PLATFORM
+ $msys = /msys/ =~ RUBY_PLATFORM
$netbsd = /netbsd/ =~ RUBY_PLATFORM
$haiku = /haiku/ =~ RUBY_PLATFORM
$solaris = /solaris/ =~ RUBY_PLATFORM
@@ -1881,6 +1882,12 @@ SRC
IO.popen(["cygpath", "-u", path], &:read).chomp
end
end
+ when 'msys'
+ if CONFIG['target_os'] != 'msys'
+ def mkintpath(path)
+ IO.popen(["cygpath", "-u", path], &:read).chomp
+ end
+ end
end
end
unless method_defined?(:mkintpath)
@@ -1897,7 +1904,7 @@ SRC
SHELL = /bin/sh
# V=0 quiet, V=1 verbose. other values don't work.
-V = 0
+V = 1
Q1 = $(V:1=)
Q = $(Q1:0=@)
ECHO1 = $(V:1=@ #{CONFIG['NULLCMD']})
diff -Naurp ruby-2.4.0/lib/resolv.rb.orig ruby-2.4.0/lib/resolv.rb
--- ruby-2.4.0/lib/resolv.rb.orig 2016-11-23 18:57:30.000000000 -0500
+++ ruby-2.4.0/lib/resolv.rb 2017-03-08 01:45:30.891278400 -0500
@@ -168,7 +168,7 @@ class Resolv
class Hosts
begin
- raise LoadError unless /mswin|mingw|cygwin/ =~ RUBY_PLATFORM
+ raise LoadError unless /mswin/ =~ RUBY_PLATFORM
require 'win32/resolv'
DefaultFileName = Win32::Resolv.get_hosts_path
rescue LoadError
@@ -961,7 +961,7 @@ class Resolv
if File.exist? filename
config_hash = Config.parse_resolv_conf(filename)
else
- if /mswin|cygwin|mingw|bccwin/ =~ RUBY_PLATFORM
+ if /mswin|bccwin/ =~ RUBY_PLATFORM
require 'win32/resolv'
search, nameserver = Win32::Resolv.get_resolv_info
config_hash = {}
diff -Naurp ruby-2.4.0/lib/rubygems/platform.rb.orig ruby-2.4.0/lib/rubygems/platform.rb
--- ruby-2.4.0/lib/rubygems/platform.rb.orig 2016-02-01 07:43:26.000000000 -0500
+++ ruby-2.4.0/lib/rubygems/platform.rb 2017-03-08 03:18:35.279931300 -0500
@@ -79,6 +79,7 @@ class Gem::Platform
@os, @version = case os
when /aix(\d+)?/ then [ 'aix', $1 ]
when /cygwin/ then [ 'cygwin', nil ]
+ when /msys/ then [ 'msys', nil ]
when /darwin(\d+)?/ then [ 'darwin', $1 ]
when /^macruby$/ then [ 'macruby', nil ]
when /freebsd(\d+)?/ then [ 'freebsd', $1 ]
diff -Naurp ruby-2.4.0/test/dbm/test_dbm.rb.rej.orig ruby-2.4.0/test/dbm/test_dbm.rb.rej
--- ruby-2.4.0/test/dbm/test_dbm.rb.rej.orig 2017-03-08 03:18:35.288436900 -0500
+++ ruby-2.4.0/test/dbm/test_dbm.rb.rej 2017-03-08 03:18:35.287432700 -0500
@@ -0,0 +1,16 @@
+--- test/dbm/test_dbm.rb 2013-06-19 11:47:31.000000000 +0400
++++ test/dbm/test_dbm.rb 2014-05-13 12:23:06.187800000 +0400
+@@ -21,6 +21,13 @@
+ raise 'cannot get system name' if uname.call(utsname) == -1
+
+ utsname.unpack('A20' * 5)[0]
++ when 'msys'
++ require 'Win32API'
++ uname = Win32API.new('msys-2.0', 'uname', 'P', 'I')
++ utsname = ' ' * 100
++ raise 'cannot get system name' if uname.call(utsname) == -1
++
++ utsname.unpack('A21' * 5)[0]
+ else
+ RbConfig::CONFIG['target_os']
+ end
diff -Naurp ruby-2.4.0/test/fiddle/helper.rb.orig ruby-2.4.0/test/fiddle/helper.rb
--- ruby-2.4.0/test/fiddle/helper.rb.orig 2015-12-16 00:07:31.000000000 -0500
+++ ruby-2.4.0/test/fiddle/helper.rb 2017-03-08 03:18:35.293437700 -0500
@@ -10,6 +10,9 @@ case RUBY_PLATFORM
when /cygwin/
libc_so = "cygwin1.dll"
libm_so = "cygwin1.dll"
+when /msys/
+ libc_so = "msys-2.0.dll"
+ libm_so = "msys-2.0.dll"
when /x86_64-linux/
libc_so = "/lib64/libc.so.6"
libm_so = "/lib64/libm.so.6"
diff -aurp ruby-2.4.0/test/fiddle/test_handle.rb.orig ruby-2.4.0/test/fiddle/test_handle.rb
--- ruby-2.4.0/test/fiddle/test_handle.rb.orig 2017-03-08 04:10:40.121172400 -0500
+++ ruby-2.4.0/test/fiddle/test_handle.rb 2017-03-08 04:11:42.390459800 -0500
@@ -183,7 +183,7 @@ module Fiddle
assert_no_memory_leak(%w[-W0 -rfiddle.so], '', '100_000.times {Fiddle::Handle.allocate}; GC.start', rss: true)
end
- if /cygwin|mingw|mswin/ =~ RUBY_PLATFORM
+ if /cygwin|msys|mingw|mswin/ =~ RUBY_PLATFORM
def test_fallback_to_ansi
k = Fiddle::Handle.new("kernel32.dll")
ansi = k["GetFileAttributesA"]
diff -Naurp ruby-2.4.0/test/gdbm/test_gdbm.rb.orig ruby-2.4.0/test/gdbm/test_gdbm.rb
--- ruby-2.4.0/test/gdbm/test_gdbm.rb.orig 2016-05-01 08:50:19.000000000 -0400
+++ ruby-2.4.0/test/gdbm/test_gdbm.rb 2017-03-08 04:26:49.632893500 -0500
@@ -15,6 +15,9 @@ if defined? GDBM
case RbConfig::CONFIG['target_os']
when 'cygwin'
require 'etc'
+ Etc.uname[:sysname
+ when 'msys'
+ require 'etc'
Etc.uname[:sysname]
else
RbConfig::CONFIG['target_os']
diff -Naurp ruby-2.4.0/test/ruby/test_argf.rb.orig ruby-2.4.0/test/ruby/test_argf.rb
--- ruby-2.4.0/test/ruby/test_argf.rb.orig 2016-12-20 03:25:03.000000000 -0500
+++ ruby-2.4.0/test/ruby/test_argf.rb 2017-03-08 03:18:35.315438100 -0500
@@ -54,7 +54,7 @@ class TestArgf < Test::Unit::TestCase
end
def no_safe_rename
- /cygwin|mswin|mingw|bccwin/ =~ RUBY_PLATFORM
+ /cygwin|msys|mswin|mingw|bccwin/ =~ RUBY_PLATFORM
end
def assert_src_expected(line, src, args = nil)
diff -aurp ruby-2.4.0/test/dbm/test_dbm.rb.orig ruby-2.4.0/test/dbm/test_dbm.rb
--- ruby-2.4.0/test/dbm/test_dbm.rb.orig 2017-03-08 03:59:32.357642300 -0500
+++ ruby-2.4.0/test/dbm/test_dbm.rb 2017-03-08 04:05:37.765359500 -0500
@@ -15,7 +15,7 @@ if defined? DBM
def TestDBM_RDONLY.uname_s
require 'rbconfig'
case RbConfig::CONFIG['target_os']
- when 'cygwin'
+ when 'cygwin', 'msys'
require 'etc'
Etc.uname[:sysname]
else
diff -aurp ruby-2.4.0/test/ruby/test_dir_m17n.rb.orig ruby-2.4.0/test/ruby/test_dir_m17n.rb
--- ruby-2.4.0/test/ruby/test_dir_m17n.rb.orig 2017-03-08 02:34:32.459828200 -0500
+++ ruby-2.4.0/test/ruby/test_dir_m17n.rb 2017-03-08 02:38:27.737235800 -0500
@@ -21,7 +21,7 @@ class TestDir_M17N < Test::Unit::TestCas
assert_include(ents, filename)
EOS
- return if /cygwin/ =~ RUBY_PLATFORM
+ return if /cygwin|msys/ =~ RUBY_PLATFORM
assert_separately(%w[-EASCII-8BIT], <<-EOS, :chdir=>dir)
filename = #{code}.chr('UTF-8').force_encoding("ASCII-8BIT")
opts = {:encoding => Encoding.default_external} if /mswin|mingw/ =~ RUBY_PLATFORM
@@ -58,7 +58,7 @@ class TestDir_M17N < Test::Unit::TestCas
end
def test_filename_extutf8_invalid
- return if /cygwin/ =~ RUBY_PLATFORM
+ return if /cygwin|msys/ =~ RUBY_PLATFORM
with_tmpdir {|d|
assert_separately(%w[-EASCII-8BIT], <<-'EOS', :chdir=>d)
filename = "\xff".force_encoding("ASCII-8BIT") # invalid byte sequence as UTF-8
@@ -174,7 +174,7 @@ class TestDir_M17N < Test::Unit::TestCas
## others
def test_filename_bytes_euc_jp
- return if /cygwin/ =~ RUBY_PLATFORM
+ return if /cygwin|msys/ =~ RUBY_PLATFORM
with_tmpdir {|d|
assert_separately(%w[-EEUC-JP], <<-'EOS', :chdir=>d)
filename = "\xA4\xA2".force_encoding("euc-jp")
@@ -191,7 +191,7 @@ class TestDir_M17N < Test::Unit::TestCas
end
def test_filename_euc_jp
- return if /cygwin/ =~ RUBY_PLATFORM
+ return if /cygwin|msys/ =~ RUBY_PLATFORM
with_tmpdir {|d|
assert_separately(%w[-EEUC-JP], <<-'EOS', :chdir=>d)
filename = "\xA4\xA2".force_encoding("euc-jp")
@@ -237,7 +237,7 @@ class TestDir_M17N < Test::Unit::TestCas
end
def test_filename_ext_euc_jp_and_int_utf_8
- return if /cygwin/ =~ RUBY_PLATFORM
+ return if /cygwin|msys/ =~ RUBY_PLATFORM
with_tmpdir {|d|
assert_separately(%w[-EEUC-JP], <<-'EOS', :chdir=>d)
filename = "\xA4\xA2".force_encoding("euc-jp")
diff -Naur ruby-2.4.0/test/ruby/test_file_exhaustive.rb.orig ruby-2.4.0/test/ruby/test_file_exhaustive.rb
--- ruby-2.4.0/test/ruby/test_file_exhaustive.rb.orig 2016-12-06 21:19:29.000000000 -0500
+++ ruby-2.4.0/test/ruby/test_file_exhaustive.rb 2017-03-07 09:26:23.220993000 -0500
@@ -6,7 +6,7 @@
class TestFileExhaustive < Test::Unit::TestCase
DRIVE = Dir.pwd[%r'\A(?:[a-z]:|//[^/]+/[^/]+)'i]
- POSIX = /cygwin|mswin|bccwin|mingw|emx/ !~ RUBY_PLATFORM
+ POSIX = /cygwin|msys|mswin|bccwin|mingw|emx/ !~ RUBY_PLATFORM
NTFS = !(/mingw|mswin|bccwin/ !~ RUBY_PLATFORM)
def assert_incompatible_encoding
@@ -1390,7 +1390,7 @@
assert_equal(true, test(?=, fn1, fn1))
assert_equal(false, test(?>, fn1, fn1))
assert_equal(false, test(?<, fn1, fn1))
- unless /cygwin/ =~ RUBY_PLATFORM
+ unless /cygwin|msys/ =~ RUBY_PLATFORM
assert_equal(false, test(?=, fn1, fn2))
assert_equal(false, test(?>, fn1, fn2))
assert_equal(true, test(?>, fn2, fn1))
diff -aurp ruby-2.4.0/test/ruby/test_rubyoptions.rb.orig ruby-2.4.0/test/ruby/test_rubyoptions.rb
--- ruby-2.4.0/test/ruby/test_rubyoptions.rb.orig 2017-03-08 03:10:33.492619900 -0500
+++ ruby-2.4.0/test/ruby/test_rubyoptions.rb 2017-03-08 03:14:14.612266300 -0500
@@ -796,7 +796,7 @@ class TestRubyOptions < Test::Unit::Test
assert_e_script_encoding(s, %W[-E#{locale.name}])
end
end
- when /cygwin/
+ when /cygwin|msys/
def test_command_line_non_ascii
assert_separately([{"LC_ALL"=>"ja_JP.SJIS"}, "-", "\u{3042}".encode("SJIS")], <<-"end;")
bug12184 = '[ruby-dev:49519] [Bug #12184]'
diff -Naurp ruby-2.4.0/test/ruby/test_path.rb.orig ruby-2.4.0/test/ruby/test_path.rb
--- ruby-2.4.0/test/ruby/test_path.rb.orig 2015-12-16 00:07:31.000000000 -0500
+++ ruby-2.4.0/test/ruby/test_path.rb 2017-03-08 04:26:49.792413600 -0500
@@ -48,7 +48,7 @@ class TestPath < Test::Unit::TestCase
end
def test_dirname
- if /(bcc|ms)win\d|mingw|cygwin|emx/ =~ RUBY_PLATFORM
+ if /(bcc|ms)win\d|mingw|cygwin|msys|emx/ =~ RUBY_PLATFORM
# DOSISH_DRIVE_LETTER
assert_equal('C:.', File.dirname('C:'))
assert_equal('C:.', File.dirname('C:a'))
@@ -104,7 +104,7 @@ class TestPath < Test::Unit::TestCase
assert_equal('/', File.dirname('/a/'))
assert_equal('/a', File.dirname('/a/b'))
- if /(bcc|ms|cyg)win|mingw|emx/ =~ RUBY_PLATFORM
+ if /(bcc|ms|cyg)win|msys|mingw|emx/ =~ RUBY_PLATFORM
# DOSISH_UNC
assert_equal('//', File.dirname('//'))
assert_equal('//a', File.dirname('//a'))
@@ -138,7 +138,7 @@ class TestPath < Test::Unit::TestCase
end
def test_basename
- if /(bcc|ms)win\d|mingw|cygwin|emx/ =~ RUBY_PLATFORM
+ if /(bcc|ms)win\d|mingw|cygwin|msys|emx/ =~ RUBY_PLATFORM
# DOSISH_DRIVE_LETTER
assert_equal('', File.basename('C:'))
assert_equal('a', File.basename('C:a'))
@@ -194,7 +194,7 @@ class TestPath < Test::Unit::TestCase
assert_equal("..", File.basename("..", ".*"))
- if /(bcc|ms|cyg)win|mingw|emx/ =~ RUBY_PLATFORM
+ if /(bcc|ms|cyg)win|msys|mingw|emx/ =~ RUBY_PLATFORM
# DOSISH_UNC
assert_equal('/', File.basename('//'))
assert_equal('/', File.basename('//a'))
diff -Naur ruby-2.4.0/test/ruby/test_require.rb.orig ruby-2.4.0/test/ruby/test_require.rb
--- ruby-2.4.0/test/ruby/test_require.rb.orig 2016-12-06 21:41:00.000000000 -0500
+++ ruby-2.4.0/test/ruby/test_require.rb 2017-03-08 04:26:49.801914400 -0500
@@ -75,7 +75,7 @@ class TestRequire < Test::Unit::TestCase
end
case RUBY_PLATFORM
- when /cygwin/, /mswin/, /mingw/, /darwin/
+ when /cygwin/, /msys/, /mswin/, /mingw/, /darwin/
def self.ospath_encoding(path)
Encoding::UTF_8
end
diff -Naur ruby-2.4.0/test/rubygems/test_gem_platform.rb.orig ruby-2.4.0/test/rubygems/test_gem_platform.rb
--- ruby-2.4.0/test/rubygems/test_gem_platform.rb.orig 2016-02-01 07:43:26.000000000 -0500
+++ ruby-2.4.0/test/rubygems/test_gem_platform.rb 2017-03-08 01:33:56.228602500 -0500
@@ -46,6 +46,7 @@ class TestGemPlatform < Gem::TestCase
'universal-darwin9' => ['universal', 'darwin', '9'],
'universal-macruby' => ['universal', 'macruby', nil],
'i386-cygwin' => ['x86', 'cygwin', nil],
+ 'i386-msys' => ['x86', 'msys', nil],
'i686-darwin' => ['x86', 'darwin', nil],
'i686-darwin8.4.1' => ['x86', 'darwin', '8'],
'i386-freebsd4.11' => ['x86', 'freebsd', '4'],
@@ -76,6 +77,7 @@ class TestGemPlatform < Gem::TestCase
'i386-solaris2.8' => ['x86', 'solaris', '2.8'],
'mswin32' => ['x86', 'mswin32', nil],
'x86_64-linux' => ['x86_64', 'linux', nil],
+ 'x86_64-msys' => ['x86_64', 'msys', nil],
'x86_64-openbsd3.9' => ['x86_64', 'openbsd', '3.9'],
'x86_64-openbsd4.0' => ['x86_64', 'openbsd', '4.0'],
'x86_64-openbsd' => ['x86_64', 'openbsd', nil],
diff -Naurp ruby-2.4.0/test/socket/test_addrinfo.rb.orig ruby-2.4.0/test/socket/test_addrinfo.rb
--- ruby-2.4.0/test/socket/test_addrinfo.rb.orig 2016-05-30 11:33:06.000000000 -0400
+++ ruby-2.4.0/test/socket/test_addrinfo.rb 2017-03-08 04:26:49.821417200 -0500
@@ -8,7 +8,7 @@ end
require "test/unit"
class TestSocketAddrinfo < Test::Unit::TestCase
- HAS_UNIXSOCKET = defined?(UNIXSocket) && /cygwin/ !~ RUBY_PLATFORM
+ HAS_UNIXSOCKET = defined?(UNIXSocket) && /cygwin|msys/ !~ RUBY_PLATFORM
def tcp_unspecified_to_loopback(addrinfo)
if addrinfo.ipv4? && addrinfo.ip_address == "0.0.0.0"
diff -Naurp ruby-2.4.0/test/socket/test_unix.rb.orig ruby-2.4.0/test/socket/test_unix.rb
--- ruby-2.4.0/test/socket/test_unix.rb.orig 2016-08-30 02:22:30.000000000 -0400
+++ ruby-2.4.0/test/socket/test_unix.rb 2017-03-08 04:26:49.835918600 -0500
@@ -699,4 +699,4 @@ class TestSocket_UNIXSocket < Test::Unit
assert_equal :wait_readable, serv.accept_nonblock(exception: false)
}
end
-end if defined?(UNIXSocket) && /cygwin/ !~ RUBY_PLATFORM
+end if defined?(UNIXSocket) && /cygwin|msys/ !~ RUBY_PLATFORM
diff -aurp ruby-2.4.0/test/webrick/test_cgi.rb.orig ruby-2.4.0/test/webrick/test_cgi.rb
--- ruby-2.4.0/test/webrick/test_cgi.rb.orig 2016-07-22 12:43:12.000000000 -0400
+++ ruby-2.4.0/test/webrick/test_cgi.rb 2017-03-08 02:13:09.789786100 -0500
@@ -26,7 +26,7 @@ class TestWEBrickCGI < Test::Unit::TestC
end
},
}
- if RUBY_PLATFORM =~ /mswin|mingw|cygwin|bccwin32/
+ if RUBY_PLATFORM =~ /mswin|mingw|cygwin|msys|bccwin32/
config[:CGIPathEnv] = ENV['PATH'] # runtime dll may not be in system dir.
end
TestWEBrick.start_httpserver(config, log_tester){|server, addr, port, log|
@@ -43,7 +43,7 @@ class TestWEBrickCGI < Test::Unit::TestC
http.request(req){|res| assert_equal("/path/info", res.body, log.call)}
req = Net::HTTP::Get.new("/webrick.cgi/%3F%3F%3F?foo=bar")
http.request(req){|res| assert_equal("/???", res.body, log.call)}
- unless RUBY_PLATFORM =~ /mswin|mingw|cygwin|bccwin32/
+ unless RUBY_PLATFORM =~ /mswin|mingw|cygwin|msys|bccwin32/
# Path info of res.body is passed via ENV.
# ENV[] returns different value on Windows depending on locale.
req = Net::HTTP::Get.new("/webrick.cgi/%A4%DB%A4%B2/%A4%DB%A4%B2")
diff -aurp ruby-2.4.0/tool/config.guess.orig ruby-2.4.0/tool/config.guess
--- ruby-2.4.0/tool/config.guess.orig 2016-12-23 10:55:52.000000000 -0500
+++ ruby-2.4.0/tool/config.guess 2017-03-08 02:18:46.764929600 -0500
@@ -891,6 +891,9 @@ EOF
amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
echo x86_64-unknown-cygwin
exit ;;
+ amd64:MSYS*:*:* | x86_64:MSYS*:*:*)
+ echo x86_64-unknown-msys
+ exit ;;
p*:CYGWIN*:*)
echo powerpcle-unknown-cygwin
exit ;;
diff -Naurp ruby-2.4.0/win32/mkexports.rb.orig ruby-2.4.0/win32/mkexports.rb
--- ruby-2.4.0/win32/mkexports.rb.orig 2016-12-14 12:49:26.000000000 -0500
+++ ruby-2.4.0/win32/mkexports.rb 2017-03-08 02:18:46.773431600 -0500
@@ -161,6 +161,30 @@
end
end
+class Exports::Msys < Exports
+ def self.nm
+ @@nm ||= RbConfig::CONFIG["NM"]
+ end
+
+ def exports(*)
+ super()
+ end
+
+ def each_line(objs, &block)
+ IO.foreach("|#{self.class.nm} --extern --defined #{objs.join(' ')}", &block)
+ end
+
+ def each_export(objs)
+ symprefix = RbConfig::CONFIG["SYMBOL_PREFIX"]
+ symprefix.strip! if symprefix
+ re = /\s(?:(T)|[[:upper:]])\s#{symprefix}((?!Init_|.*_threadptr_|DllMain\b).*)$/
+ objdump(objs) do |l|
+ next if /@.*@/ =~ l
+ yield $2, !$1 if re =~ l
+ end
+ end
+end
+
class Exports::Mingw < Exports::Cygwin
def each_export(objs)
super