summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNobuyoshi Nakada <[email protected]>2024-11-04 09:39:15 +0900
committerNobuyoshi Nakada <[email protected]>2024-11-05 23:04:49 +0900
commit74fcf437676f0019c55368753252fbe4afdf52ac (patch)
treeefd3b60e6e2a06f28e7440f286821a35135f3bd4
parented06f018bdffe9bb7f8bdbf15fa5a727e402bfe9 (diff)
Use wide character startup
Mingw crt-git 12.0.0.r369.g0d4221712-1 now prohibits "command line contains characters that are not supported in the active code page". https://sourceforge.net/p/mingw-w64/mingw-w64/ci/0d42217123d3aec0341b79f6d959c76e09648a1e/ Already Ruby builds `argv` in `rb_w32_sysinit`, instead of mswin- or mingw-made `argv`. Just bypass the conversion in mingw crt.
-rw-r--r--cygwin/GNUmakefile.in4
-rw-r--r--main.c4
-rw-r--r--test/.excludes/TestArgf.rb9
-rw-r--r--test/.excludes/TestRubyOptions.rb11
4 files changed, 7 insertions, 21 deletions
diff --git a/cygwin/GNUmakefile.in b/cygwin/GNUmakefile.in
index 192a8cc711..04f16cd201 100644
--- a/cygwin/GNUmakefile.in
+++ b/cygwin/GNUmakefile.in
@@ -2,6 +2,8 @@ gnumake = yes
include Makefile
+override EXE_LDFLAGS += -municode
+
DLLWRAP = @DLLWRAP@ --target=$(target_os) --driver-name="$(CC)"
ifeq (@USE_LLVM_WINDRES@,yes) # USE_LLVM_WINDRES
# llvm-windres fails when preprocessor options are added
@@ -69,7 +71,7 @@ $(PROGRAM): $(RUBY_INSTALL_NAME).res.$(OBJEXT)
$(WPROGRAM): $(RUBYW_INSTALL_NAME).res.$(OBJEXT)
@rm -f $@
$(ECHO) linking $@
- $(Q) $(PURIFY) $(CC) -mwindows -e $(SYMBOL_PREFIX)mainCRTStartup $(LDFLAGS) $(XLDFLAGS) \
+ $(Q) $(PURIFY) $(CC) -municode -mwindows -e $(SYMBOL_PREFIX)mainCRTStartup $(LDFLAGS) $(XLDFLAGS) \
$(MAINOBJ) $(EXTOBJS) $(LIBRUBYARG) $(LIBS) -o $@
$(STUBPROGRAM): $(RUBY_INSTALL_NAME).res.$(OBJEXT)
diff --git a/main.c b/main.c
index 92363d3fb7..5e29de8009 100644
--- a/main.c
+++ b/main.c
@@ -62,6 +62,10 @@ main(int argc, char **argv)
return rb_main(argc, argv);
}
+#ifdef _WIN32
+int wmain(void) {return main(0, NULL);}
+#endif
+
#ifdef RUBY_ASAN_ENABLED
/* Compile in the ASAN options Ruby needs, rather than relying on environment variables, so
* that even tests which fork ruby with a clean environment will run ASAN with the right
diff --git a/test/.excludes/TestArgf.rb b/test/.excludes/TestArgf.rb
deleted file mode 100644
index 8cdda716e0..0000000000
--- a/test/.excludes/TestArgf.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-if RUBY_PLATFORM.include?("mingw")
- reason = <<~EOS
- Mingw crt-git 12.0.0.r369.g0d4221712-1 now prohibits "command line
- contains characters that are not supported in the active code page".
- https://sourceforge.net/p/mingw-w64/mingw-w64/ci/0d42217123d3aec0341b79f6d959c76e09648a1e/
- EOS
-
- exclude(:test_inplace_nonascii, reason)
-end
diff --git a/test/.excludes/TestRubyOptions.rb b/test/.excludes/TestRubyOptions.rb
deleted file mode 100644
index 0aad715f60..0000000000
--- a/test/.excludes/TestRubyOptions.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-if RUBY_PLATFORM.include?("mingw")
- reason = <<~EOS
- Mingw crt-git 12.0.0.r369.g0d4221712-1 now prohibits "command line
- contains characters that are not supported in the active code page".
- https://sourceforge.net/p/mingw-w64/mingw-w64/ci/0d42217123d3aec0341b79f6d959c76e09648a1e/
- EOS
-
- exclude(:test_chdir, reason)
- exclude(:test_locale_codepage, reason)
- exclude(:test_command_line_progname_nonascii, reason)
-end