diff -Naur ruby-2.1.2/configure.in ruby-2.1.2-msys2/configure.in --- ruby-2.1.2/configure.in 2014-05-07 20:21:02.000000000 +0400 +++ ruby-2.1.2-msys2/configure.in 2014-05-13 12:47:28.321200000 +0400 @@ -57,7 +57,7 @@ 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__ @@ -104,7 +104,7 @@ 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-" @@ -515,14 +515,14 @@ 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-/-/"` @@ -802,7 +802,7 @@ # comments. We bypass ANSI C mode for them. Otherwise # extension libs cannot include those headers. ], - [cygwin*|darwin*|netbsd*], [ + [cygwin*|msys*|darwin*|netbsd*], [ # need lgamma_r(), finite() ], [haiku], [ @@ -1007,7 +1007,7 @@ [haiku*], [ ac_cv_func_shutdown=no]) LIBS="$LIBS" # m lib is include in root under BeOS/Haiku ], -[cygwin*], [ ac_cv_header_langinfo_h=yes +[cygwin*|msys*], [ ac_cv_header_langinfo_h=yes AC_CHECK_FUNCS(cygwin_conv_path) AC_LIBOBJ([langinfo]) ], @@ -2045,7 +2045,7 @@ 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= @@ -2627,7 +2627,7 @@ # 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*|beos*|haiku*|cygwin*|mingw*|aix*|interix*], [ ], + [bsdi*|beos*|haiku*|cygwin*|msys*|mingw*|aix*|interix*], [ ], [ RUBY_APPEND_OPTION(CCDLFLAGS, -fPIC)]) else @@ -2764,9 +2764,9 @@ : ${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=""} rb_cv_dlopen=yes], @@ -3086,7 +3086,7 @@ SOLIBS= AS_CASE(["$target_os"], - [cygwin*|mingw*|beos*|haiku*|darwin*|os2-emx*], [ + [cygwin*|msys*|mingw*|beos*|haiku*|darwin*|os2-emx*], [ : ${DLDLIBS=""} ], [ @@ -3432,7 +3432,7 @@ AS_CASE(["$target_cpu"],[powerpc*], [CFLAGS="$CFLAGS -relax_pointers"]) CPPFLAGS="$CPPFLAGS -I/boot/home/config/include" ], - [cygwin*|mingw*], [ + [cygwin*|msys*|mingw*], [ RUBY_SO_NAME="${RUBY_SO_NAME}"'$(MAJOR)$(MINOR)$(TEENY)' LIBRUBY_DLDFLAGS="${DLDFLAGS}"' -Wl,--out-implib=$(LIBRUBY)' AS_CASE(["$target_os"], @@ -3442,6 +3442,12 @@ 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.1.2/cygwin/GNUmakefile.in ruby-2.1.2-msys2/cygwin/GNUmakefile.in --- ruby-2.1.2/cygwin/GNUmakefile.in 2012-11-05 18:00:35.000000000 +0400 +++ ruby-2.1.2-msys2/cygwin/GNUmakefile.in 2014-05-13 12:19:34.013800000 +0400 @@ -6,6 +6,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 @@ -103,6 +105,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 -Naur ruby-2.1.2/ext/etc/extconf.rb ruby-2.1.2-msys2/ext/etc/extconf.rb --- ruby-2.1.2/ext/etc/extconf.rb 2010-09-16 03:27:48.000000000 +0400 +++ ruby-2.1.2-msys2/ext/etc/extconf.rb 2014-05-13 12:22:34.967200000 +0400 @@ -22,7 +22,7 @@ $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 -Naur ruby-2.1.2/ext/readline/extconf.rb ruby-2.1.2-msys2/ext/readline/extconf.rb --- ruby-2.1.2/ext/readline/extconf.rb 2014-05-01 15:59:37.000000000 +0400 +++ ruby-2.1.2-msys2/ext/readline/extconf.rb 2014-05-13 12:22:58.871400000 +0400 @@ -29,7 +29,7 @@ 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 -Naur ruby-2.1.2/ext/socket/extconf.rb ruby-2.1.2-msys2/ext/socket/extconf.rb --- ruby-2.1.2/ext/socket/extconf.rb 2013-06-13 00:32:42.000000000 +0400 +++ ruby-2.1.2-msys2/ext/socket/extconf.rb 2014-05-13 12:46:52.272400000 +0400 @@ -253,7 +253,7 @@ # [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 @@ -373,7 +373,7 @@ 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 /beos/ test_func = "socket(0,0,0)" diff -Naur ruby-2.1.2/ext/tk/extconf.rb ruby-2.1.2-msys2/ext/tk/extconf.rb --- ruby-2.1.2/ext/tk/extconf.rb 2013-11-30 06:46:47.000000000 +0400 +++ ruby-2.1.2-msys2/ext/tk/extconf.rb 2014-05-13 12:22:58.887000000 +0400 @@ -553,7 +553,7 @@ exts = [CONFIG['DLEXT']] exts.concat %w(dll) if is_win32? exts.concat %w(bundle dylib) if is_macosx? - exts.concat %w(dll.a) if /cygwin/ =~ RUBY_PLATFORM + exts.concat %w(dll.a) if /cygwin|msys/ =~ RUBY_PLATFORM if TkLib_Config["tcltk-stubs"] || TkLib_Config['enable-shared'] == false exts.unshift "lib" if is_win32? diff -Naur ruby-2.1.2/ext/tk/lib/tk.rb ruby-2.1.2-msys2/ext/tk/lib/tk.rb --- ruby-2.1.2/ext/tk/lib/tk.rb 2011-05-27 03:36:33.000000000 +0400 +++ ruby-2.1.2-msys2/ext/tk/lib/tk.rb 2014-05-13 12:22:58.902600000 +0400 @@ -1180,7 +1180,7 @@ if WITH_RUBY_VM ### check Ruby 1.9 !!!!!!! # *** NEED TO FIX *** case RUBY_PLATFORM - when /cygwin/ + when /cygwin|msys/ RUN_EVENTLOOP_ON_MAIN_THREAD = true when /darwin/ # MacOS X =begin diff -Naur ruby-2.1.2/ext/tk/old-extconf.rb ruby-2.1.2-msys2/ext/tk/old-extconf.rb --- ruby-2.1.2/ext/tk/old-extconf.rb 2009-07-13 06:43:44.000000000 +0400 +++ ruby-2.1.2-msys2/ext/tk/old-extconf.rb 2014-05-13 12:22:58.902600000 +0400 @@ -2,7 +2,7 @@ require 'mkmf' -is_win32 = (/mswin|mingw|cygwin|bccwin/ =~ RUBY_PLATFORM) +is_win32 = (/mswin|mingw|cygwin|msys|bccwin/ =~ RUBY_PLATFORM) #is_macosx = (/darwin/ =~ RUBY_PLATFORM) have_func("ruby_native_thread_p", "ruby.h") @@ -405,7 +405,7 @@ find_tcl(tcllib, stubs, tclver, *tcl_ldir_list) && find_tk(tklib, stubs, tkver, *tk_ldir_list) ) ) $CPPFLAGS += ' -DUSE_TCL_STUBS -DUSE_TK_STUBS' if stubs - $CPPFLAGS += ' -D_WIN32' if /cygwin/ =~ RUBY_PLATFORM + $CPPFLAGS += ' -D_WIN32' if /cygwin|msys/ =~ RUBY_PLATFORM if tcltk_framework if tcl_framework_header diff -Naur ruby-2.1.2/ext/win32/extconf.rb ruby-2.1.2-msys2/ext/win32/extconf.rb --- ruby-2.1.2/ext/win32/extconf.rb 2013-07-13 07:24:28.000000000 +0400 +++ ruby-2.1.2-msys2/ext/win32/extconf.rb 2014-05-13 13:15:28.369600000 +0400 @@ -1,3 +1,3 @@ -if (compiled?('dl') or compiled?('fiddle')) and $mswin||$mingw||$cygwin +if (compiled?('dl') or compiled?('fiddle')) and $mswin||$mingw||$cygwin||$msys create_makefile('win32') end diff -Naur ruby-2.1.2/ext/win32ole/extconf.rb ruby-2.1.2-msys2/ext/win32ole/extconf.rb --- ruby-2.1.2/ext/win32ole/extconf.rb 2013-01-18 06:23:37.000000000 +0400 +++ ruby-2.1.2-msys2/ext/win32ole/extconf.rb 2014-05-13 12:22:58.902600000 +0400 @@ -5,7 +5,7 @@ require 'mkmf' case RUBY_PLATFORM -when /cygwin/ +when /cygwin|msys/ inc = nil lib = '/usr/lib/w32api' end diff -Naur ruby-2.1.2/lib/fileutils.rb ruby-2.1.2-msys2/lib/fileutils.rb --- ruby-2.1.2/lib/fileutils.rb 2013-12-07 14:25:33.000000000 +0400 +++ ruby-2.1.2-msys2/lib/fileutils.rb 2014-05-13 12:23:06.172200000 +0400 @@ -545,7 +545,7 @@ OPT_TABLE['move'] = [:force, :noop, :verbose, :secure] def rename_cannot_overwrite_file? #:nodoc: - /cygwin|mswin|mingw|bccwin|emx/ =~ RUBY_PLATFORM + /cygwin|msys|mswin|mingw|bccwin|emx/ =~ RUBY_PLATFORM end private_module_function :rename_cannot_overwrite_file? diff -Naur ruby-2.1.2/lib/mkmf.rb ruby-2.1.2-msys2/lib/mkmf.rb --- ruby-2.1.2/lib/mkmf.rb 2014-02-21 18:14:26.000000000 +0400 +++ ruby-2.1.2-msys2/lib/mkmf.rb 2014-05-13 12:23:06.172200000 +0400 @@ -130,6 +130,7 @@ $bccwin = /bccwin/ =~ RUBY_PLATFORM $mingw = /mingw/ =~ RUBY_PLATFORM $cygwin = /cygwin/ =~ RUBY_PLATFORM + $msys = /msys/ =~ RUBY_PLATFORM $netbsd = /netbsd/ =~ RUBY_PLATFORM $os2 = /os2/ =~ RUBY_PLATFORM $beos = /beos/ =~ RUBY_PLATFORM @@ -1812,6 +1812,12 @@ 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) @@ -1828,7 +1834,7 @@ 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 -Naur ruby-2.1.2/lib/rake/application.rb ruby-2.1.2-msys2/lib/rake/application.rb --- ruby-2.1.2/lib/rake/application.rb 2013-10-12 01:35:01.000000000 +0400 +++ ruby-2.1.2-msys2/lib/rake/application.rb 2014-05-13 13:08:17.484000000 +0400 @@ -310,7 +310,7 @@ def unix? 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? diff -Naur ruby-2.1.2/lib/resolv.rb ruby-2.1.2-msys2/lib/resolv.rb --- ruby-2.1.2/lib/resolv.rb 2014-02-22 10:01:44.000000000 +0400 +++ ruby-2.1.2-msys2/lib/resolv.rb 2014-05-13 13:16:20.676400000 +0400 @@ -166,7 +166,7 @@ class Hosts begin - raise LoadError unless /mswin|mingw|cygwin/ =~ RUBY_PLATFORM + raise LoadError unless /mswin|mingw|cygwin|msys/ =~ RUBY_PLATFORM require 'win32/resolv' DefaultFileName = Win32::Resolv.get_hosts_path rescue LoadError @@ -962,7 +962,7 @@ if File.exist? filename config_hash = Config.parse_resolv_conf(filename) else - if /mswin|cygwin|mingw|bccwin/ =~ RUBY_PLATFORM + if /mswin|cygwin|msys|mingw|bccwin/ =~ RUBY_PLATFORM require 'win32/resolv' search, nameserver = Win32::Resolv.get_resolv_info config_hash = {} diff -Naur ruby-2.1.2/lib/rubygems/platform.rb ruby-2.1.2-msys2/lib/rubygems/platform.rb --- ruby-2.1.2/lib/rubygems/platform.rb 2014-02-06 06:59:36.000000000 +0400 +++ ruby-2.1.2-msys2/lib/rubygems/platform.rb 2014-05-13 12:23:06.187800000 +0400 @@ -78,6 +78,7 @@ @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 -Naur ruby-2.1.2/test/dbm/test_dbm.rb ruby-2.1.2-msys2/test/dbm/test_dbm.rb --- ruby-2.1.2/test/dbm/test_dbm.rb 2013-06-19 11:47:31.000000000 +0400 +++ ruby-2.1.2-msys2/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 -Naur ruby-2.1.2/test/dl/test_base.rb ruby-2.1.2-msys2/test/dl/test_base.rb --- ruby-2.1.2/test/dl/test_base.rb 2014-01-15 06:29:58.000000000 +0400 +++ ruby-2.1.2-msys2/test/dl/test_base.rb 2014-05-13 12:23:06.187800000 +0400 @@ -9,6 +9,9 @@ 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 -Naur ruby-2.1.2/test/fiddle/helper.rb ruby-2.1.2-msys2/test/fiddle/helper.rb --- ruby-2.1.2/test/fiddle/helper.rb 2014-01-15 06:29:58.000000000 +0400 +++ ruby-2.1.2-msys2/test/fiddle/helper.rb 2014-05-13 12:23:06.187800000 +0400 @@ -10,6 +10,9 @@ 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 -Naur ruby-2.1.2/test/gdbm/test_gdbm.rb ruby-2.1.2-msys2/test/gdbm/test_gdbm.rb --- ruby-2.1.2/test/gdbm/test_gdbm.rb 2013-08-20 08:46:37.000000000 +0400 +++ ruby-2.1.2-msys2/test/gdbm/test_gdbm.rb 2014-05-13 12:23:06.187800000 +0400 @@ -20,6 +20,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 -Naur ruby-2.1.2/test/ruby/test_argf.rb ruby-2.1.2-msys2/test/ruby/test_argf.rb --- ruby-2.1.2/test/ruby/test_argf.rb 2013-10-09 19:17:20.000000000 +0400 +++ ruby-2.1.2-msys2/test/ruby/test_argf.rb 2014-05-13 12:23:06.187800000 +0400 @@ -54,7 +54,7 @@ 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 -Naur ruby-2.1.2/test/ruby/test_file_exhaustive.rb ruby-2.1.2-msys2/test/ruby/test_file_exhaustive.rb --- ruby-2.1.2/test/ruby/test_file_exhaustive.rb 2013-12-13 13:18:05.000000000 +0400 +++ ruby-2.1.2-msys2/test/ruby/test_file_exhaustive.rb 2014-05-13 13:11:09.751600000 +0400 @@ -133,7 +133,7 @@ assert_nothing_raised { File.stat(File.basename(prefix)) } end end - end if /mswin|mingw|cygwin/ =~ RUBY_PLATFORM + end if /mswin|mingw|cygwin|msys/ =~ RUBY_PLATFORM def test_directory_p assert_file.directory?(@dir) @@ -181,7 +181,7 @@ end def test_readable_p - return if /cygwin|mswin|bccwin|mingw|emx/ =~ RUBY_PLATFORM + return if /cygwin|msys|mswin|bccwin|mingw|emx/ =~ RUBY_PLATFORM return if Process.euid == 0 File.chmod(0200, @file) assert_file.not_readable?(@file) @@ -191,7 +191,7 @@ end def test_readable_real_p - return if /cygwin|mswin|bccwin|mingw|emx/ =~ RUBY_PLATFORM + return if /cygwin|msys|mswin|bccwin|mingw|emx/ =~ RUBY_PLATFORM return if Process.euid == 0 File.chmod(0200, @file) assert_file.not_readable_real?(@file) @@ -201,7 +201,7 @@ end def test_world_readable_p - return if /cygwin|mswin|bccwin|mingw|emx/ =~ RUBY_PLATFORM + return if /cygwin|msys|mswin|bccwin|mingw|emx/ =~ RUBY_PLATFORM File.chmod(0006, @file) assert_file.world_readable?(@file) File.chmod(0060, @file) @@ -212,7 +212,7 @@ end def test_writable_p - return if /cygwin|mswin|bccwin|mingw|emx/ =~ RUBY_PLATFORM + return if /cygwin|msys|mswin|bccwin|mingw|emx/ =~ RUBY_PLATFORM return if Process.euid == 0 File.chmod(0400, @file) assert_file.not_writable?(@file) @@ -222,7 +222,7 @@ end def test_writable_real_p - return if /cygwin|mswin|bccwin|mingw|emx/ =~ RUBY_PLATFORM + return if /cygwin|msys|mswin|bccwin|mingw|emx/ =~ RUBY_PLATFORM return if Process.euid == 0 File.chmod(0400, @file) assert_file.not_writable_real?(@file) @@ -232,7 +232,7 @@ end def test_world_writable_p - return if /cygwin|mswin|bccwin|mingw|emx/ =~ RUBY_PLATFORM + return if /cygwin|msys|mswin|bccwin|mingw|emx/ =~ RUBY_PLATFORM File.chmod(0006, @file) assert_file.world_writable?(@file) File.chmod(0060, @file) @@ -243,7 +243,7 @@ end def test_executable_p - return if /cygwin|mswin|bccwin|mingw|emx/ =~ RUBY_PLATFORM + return if /cygwin|msys|mswin|bccwin|mingw|emx/ =~ RUBY_PLATFORM File.chmod(0100, @file) assert_file.executable?(@file) File.chmod(0600, @file) @@ -252,7 +252,7 @@ end def test_executable_real_p - return if /cygwin|mswin|bccwin|mingw|emx/ =~ RUBY_PLATFORM + return if /cygwin|msys|mswin|bccwin|mingw|emx/ =~ RUBY_PLATFORM File.chmod(0100, @file) assert_file.executable_real?(@file) File.chmod(0600, @file) @@ -281,7 +281,7 @@ end def test_owned_p ## xxx - return if /cygwin|mswin|bccwin|mingw|emx/ =~ RUBY_PLATFORM + return if /cygwin|msys|mswin|bccwin|mingw|emx/ =~ RUBY_PLATFORM assert_file.owned?(@file) assert_file.grpowned?(@file) end @@ -342,7 +342,7 @@ end def test_chmod - return if /cygwin|mswin|bccwin|mingw|emx/ =~ RUBY_PLATFORM + return if /cygwin|msys|mswin|bccwin|mingw|emx/ =~ RUBY_PLATFORM assert_equal(1, File.chmod(0444, @file)) assert_equal(0444, File.stat(@file).mode % 01000) assert_equal(0, File.open(@file) {|f| f.chmod(0222)}) @@ -352,7 +352,7 @@ end def test_lchmod - return if /cygwin|mswin|bccwin|mingw|emx/ =~ RUBY_PLATFORM + return if /cygwin|msys|mswin|bccwin|mingw|emx/ =~ RUBY_PLATFORM assert_equal(1, File.lchmod(0444, @file)) assert_equal(0444, File.stat(@file).mode % 01000) File.lchmod(0600, @file) @@ -429,7 +429,7 @@ end def test_umask - return if /cygwin|mswin|bccwin|mingw|emx/ =~ RUBY_PLATFORM + return if /cygwin|msys|mswin|bccwin|mingw|emx/ =~ RUBY_PLATFORM prev = File.umask(0777) assert_equal(0777, File.umask) open(@nofile, "w") { } @@ -441,7 +441,7 @@ def test_expand_path assert_equal(@file, File.expand_path(File.basename(@file), File.dirname(@file))) - if /cygwin|mingw|mswin|bccwin/ =~ RUBY_PLATFORM + if /cygwin|msys|mingw|mswin|bccwin/ =~ RUBY_PLATFORM assert_equal(@file, File.expand_path(@file + " ")) assert_equal(@file, File.expand_path(@file + ".")) assert_equal(@file, File.expand_path(@file + "::$DATA")) @@ -784,7 +784,7 @@ assert_equal("foo", File.basename("foo", ".ext")) assert_equal("foo", File.basename("foo.ext", ".ext")) assert_equal("foo", File.basename("foo.ext", ".*")) - if /cygwin|mingw|mswin|bccwin/ =~ RUBY_PLATFORM + if /cygwin|msys|mingw|mswin|bccwin/ =~ RUBY_PLATFORM basename = File.basename(@file) assert_equal(basename, File.basename(@file + " ")) assert_equal(basename, File.basename(@file + ".")) @@ -833,7 +833,7 @@ infixes = ["", " ", "."] infixes2 = infixes + [".ext "] appendixes = [""] - if /cygwin|mingw|mswin|bccwin/ =~ RUBY_PLATFORM + if /cygwin|msys|mingw|mswin|bccwin/ =~ RUBY_PLATFORM appendixes << " " << "." << "::$DATA" << "::$DATA.bar" end prefixes.each do |prefix| @@ -967,7 +967,7 @@ assert_equal(true, test(?=, @file, @file)) assert_equal(false, test(?>, @file, @file)) assert_equal(false, test(?<, @file, @file)) - unless /cygwin/ =~ RUBY_PLATFORM + unless /cygwin|msys/ =~ RUBY_PLATFORM assert_equal(false, test(?=, @file, @file + "2")) assert_equal(false, test(?>, @file, @file + "2")) assert_equal(true, test(?>, @file + "2", @file)) @@ -1061,7 +1061,7 @@ end def test_stat_readable_p - return if /cygwin|mswin|bccwin|mingw|emx/ =~ RUBY_PLATFORM + return if /cygwin|msys|mswin|bccwin|mingw|emx/ =~ RUBY_PLATFORM return if Process.euid == 0 File.chmod(0200, @file) assert(!(File::Stat.new(@file).readable?)) @@ -1070,7 +1070,7 @@ end def test_stat_readable_real_p - return if /cygwin|mswin|bccwin|mingw|emx/ =~ RUBY_PLATFORM + return if /cygwin|msys|mswin|bccwin|mingw|emx/ =~ RUBY_PLATFORM return if Process.euid == 0 File.chmod(0200, @file) assert(!(File::Stat.new(@file).readable_real?)) @@ -1079,7 +1079,7 @@ end def test_stat_world_readable_p - return if /cygwin|mswin|bccwin|mingw|emx/ =~ RUBY_PLATFORM + return if /cygwin|msys|mswin|bccwin|mingw|emx/ =~ RUBY_PLATFORM File.chmod(0006, @file) assert(File::Stat.new(@file).world_readable?) File.chmod(0060, @file) @@ -1089,7 +1089,7 @@ end def test_stat_writable_p - return if /cygwin|mswin|bccwin|mingw|emx/ =~ RUBY_PLATFORM + return if /cygwin|msys|mswin|bccwin|mingw|emx/ =~ RUBY_PLATFORM return if Process.euid == 0 File.chmod(0400, @file) assert(!(File::Stat.new(@file).writable?)) @@ -1098,7 +1098,7 @@ end def test_stat_writable_real_p - return if /cygwin|mswin|bccwin|mingw|emx/ =~ RUBY_PLATFORM + return if /cygwin|msys|mswin|bccwin|mingw|emx/ =~ RUBY_PLATFORM return if Process.euid == 0 File.chmod(0400, @file) assert(!(File::Stat.new(@file).writable_real?)) @@ -1107,7 +1107,7 @@ end def test_stat_world_writable_p - return if /cygwin|mswin|bccwin|mingw|emx/ =~ RUBY_PLATFORM + return if /cygwin|msys|mswin|bccwin|mingw|emx/ =~ RUBY_PLATFORM File.chmod(0006, @file) assert(File::Stat.new(@file).world_writable?) File.chmod(0060, @file) @@ -1117,7 +1117,7 @@ end def test_stat_executable_p - return if /cygwin|mswin|bccwin|mingw|emx/ =~ RUBY_PLATFORM + return if /cygwin|msys|mswin|bccwin|mingw|emx/ =~ RUBY_PLATFORM File.chmod(0100, @file) assert(File::Stat.new(@file).executable?) File.chmod(0600, @file) @@ -1125,7 +1125,7 @@ end def test_stat_executable_real_p - return if /cygwin|mswin|bccwin|mingw|emx/ =~ RUBY_PLATFORM + return if /cygwin|msys|mswin|bccwin|mingw|emx/ =~ RUBY_PLATFORM File.chmod(0100, @file) assert(File::Stat.new(@file).executable_real?) File.chmod(0600, @file) @@ -1150,7 +1150,7 @@ end def test_stat_owned_p ## xxx - return if /cygwin|mswin|bccwin|mingw|emx/ =~ RUBY_PLATFORM + return if /cygwin|msys|mswin|bccwin|mingw|emx/ =~ RUBY_PLATFORM assert(File::Stat.new(@file).owned?) assert(File::Stat.new(@file).grpowned?) end diff -Naur ruby-2.1.2/test/ruby/test_path.rb ruby-2.1.2-msys2/test/ruby/test_path.rb --- ruby-2.1.2/test/ruby/test_path.rb 2011-10-26 10:24:29.000000000 +0400 +++ ruby-2.1.2-msys2/test/ruby/test_path.rb 2014-05-13 12:23:06.203400000 +0400 @@ -47,7 +47,7 @@ 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')) @@ -103,7 +103,7 @@ 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')) @@ -137,7 +137,7 @@ 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')) @@ -193,7 +193,7 @@ 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.1.2/test/ruby/test_require.rb ruby-2.1.2-msys2/test/ruby/test_require.rb --- ruby-2.1.2/test/ruby/test_require.rb 2013-12-13 13:18:05.000000000 +0400 +++ ruby-2.1.2-msys2/test/ruby/test_require.rb 2014-05-13 13:18:39.828400000 +0400 @@ -75,7 +75,7 @@ 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.1.2/test/rubygems/test_gem_platform.rb ruby-2.1.2-msys2/test/rubygems/test_gem_platform.rb --- ruby-2.1.2/test/rubygems/test_gem_platform.rb 2014-02-06 06:59:36.000000000 +0400 +++ ruby-2.1.2-msys2/test/rubygems/test_gem_platform.rb 2014-05-13 12:23:06.203400000 +0400 @@ -45,6 +45,7 @@ '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'], diff -Naur ruby-2.1.2/test/socket/test_addrinfo.rb ruby-2.1.2-msys2/test/socket/test_addrinfo.rb --- ruby-2.1.2/test/socket/test_addrinfo.rb 2012-10-30 04:40:54.000000000 +0400 +++ ruby-2.1.2-msys2/test/socket/test_addrinfo.rb 2014-05-13 12:23:06.203400000 +0400 @@ -6,7 +6,7 @@ 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 -Naur ruby-2.1.2/test/socket/test_unix.rb ruby-2.1.2-msys2/test/socket/test_unix.rb --- ruby-2.1.2/test/socket/test_unix.rb 2014-02-22 11:19:41.000000000 +0400 +++ ruby-2.1.2-msys2/test/socket/test_unix.rb 2014-05-13 12:23:06.234600000 +0400 @@ -627,4 +627,4 @@ assert(s0.closed?) end -end if defined?(UNIXSocket) && /cygwin/ !~ RUBY_PLATFORM +end if defined?(UNIXSocket) && /cygwin|msys/ !~ RUBY_PLATFORM diff -Naur ruby-2.1.2/test/webrick/test_cgi.rb ruby-2.1.2-msys2/test/webrick/test_cgi.rb --- ruby-2.1.2/test/webrick/test_cgi.rb 2013-08-07 11:39:23.000000000 +0400 +++ ruby-2.1.2-msys2/test/webrick/test_cgi.rb 2014-05-13 12:23:06.250200000 +0400 @@ -20,7 +20,7 @@ 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){|server, addr, port, log| @@ -40,7 +40,7 @@ req = Net::HTTP::Get.new("/webrick.cgi/%A4%DB%A4%B2/%A4%DB%A4%B2") # Path info of res.body is passed via ENV. # ENV[] returns different value on Windows depending on locale. - unless RUBY_PLATFORM =~ /mswin|mingw|cygwin|bccwin32/ && + unless RUBY_PLATFORM =~ /mswin|mingw|cygwin|msys|bccwin32/ && Encoding.find("locale") != Encoding.find("filesystem") http.request(req){|res| assert_equal("/\xA4\xDB\xA4\xB2/\xA4\xDB\xA4\xB2", res.body, log.call)} diff -Naur ruby-2.1.2/tool/config.guess ruby-2.1.2-msys2/tool/config.guess --- ruby-2.1.2/tool/config.guess 2014-05-08 19:52:16.000000000 +0400 +++ ruby-2.1.2-msys2/tool/config.guess 2014-05-13 12:23:06.250200000 +0400 @@ -866,6 +866,9 @@ 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 -Naur ruby-2.1.2/win32/mkexports.rb ruby-2.1.2-msys2/win32/mkexports.rb --- ruby-2.1.2/win32/mkexports.rb 2012-11-12 09:29:52.000000000 +0400 +++ ruby-2.1.2-msys2/win32/mkexports.rb 2014-05-13 13:20:08.779600000 +0400 @@ -158,6 +158,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