Skip to content

Instantly share code, notes, and snippets.

View shirosaki's full-sized avatar

Hiroshi Shirosaki shirosaki

View GitHub Profile
@shirosaki
shirosaki / fenix_win32_file.patch
Created March 6, 2012 15:01
Fenix integration
diff --git a/configure.in b/configure.in
index 9a679de..aad31de 100644
--- a/configure.in
+++ b/configure.in
@@ -1055,7 +1055,7 @@ main()
AC_CHECK_FUNCS(cygwin_conv_path)
AC_LIBOBJ([langinfo])
],
-[mingw*], [ LIBS="-lshell32 -lws2_32 -limagehlp $LIBS"
+[mingw*], [ LIBS="-lshell32 -lws2_32 -limagehlp -lshlwapi $LIBS"
--- a/configure.ac 2011-05-29 14:55:42 +0900
+++ b/configure.ac 2012-02-24 17:48:52 +0900
@@ -58,6 +58,13 @@
AC_CHECK_PROG(DOXYGEN, [doxygen], [true], [false])
AM_CONDITIONAL(DOXYGEN, [test "$DOXYGEN" = true])
+# Checks for host.
+case "$host_os" in
+ mingw*)
+ YAML_LT_LDFLAGS='-no-undefined';;
@shirosaki
shirosaki / webrick_long_name.patch
Created February 18, 2012 12:45
Long name conversion on webrick
diff --git a/lib/webrick/httpservlet/filehandler.rb b/lib/webrick/httpservlet/filehandler.rb
index 8736f57..e03db0f 100644
--- a/lib/webrick/httpservlet/filehandler.rb
+++ b/lib/webrick/httpservlet/filehandler.rb
@@ -327,12 +327,26 @@ module WEBrick
end
end
+ if /mswin|mingw/ =~ RUBY_PLATFORM
+ require 'Win32API'
@shirosaki
shirosaki / bench.txt
Created February 18, 2012 11:57
Benchmark with skipping FindFirstFileW
Rails 3.2.1 empty app
ruby 2.0.0dev (2012-02-18 trunk 34670) [i386-mingw32]
X:\empty>timer ruby script\rails r 'p $:.size, $".size'
59
744
real 6.708
system 4.227
user 2.433
With long name conversion.
Run options: --seed 40925
# Running tests:
...................................S
Finished tests in 2.681746s, 13.4241 tests/s, 22.3735 assertions/s.
@shirosaki
shirosaki / bench.txt
Created February 4, 2012 03:11
Long name conversion benchmark
Long name conversion of the following path.
V:\LONG_P~1\build\samples\LONG_N~1.EXE
GetLongFileName is a GetLongPathName implementation using FindFirstFile.
File exist:
GetLongPathName() time: 177.076
FindFirstFile() time: 44.9106
GetLongFileName() time: 198.462
@shirosaki
shirosaki / xcpa.bat
Created January 19, 2012 00:36
Copies all files and directory trees.
@echo OFF
if "%~1" == "" goto :EOS
if "%~2" == "" goto :EOS
xcopy %1 %2 /D /S /E /H /C /Y /R /Q
goto :eof
:EOS
echo Copies all files and directory trees.
echo usage: xcpa SOURCE DESTINATION
echo.
diff --git a/Makefile.in b/Makefile.in
index a3040b6..e3c5d05 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -12,6 +12,7 @@ NULL = /dev/null
srcdir = @srcdir@
top_srcdir = $(srcdir)
hdrdir = $(srcdir)/include
+PLATFORM_DIR = win32
benchmark results:
minimum results in each 5 measurements.
name ruby 2.0.0dev (2012-01-05 trunk 34217) [i386-mingw32] ruby 2.0.0dev (2012-01-05 bitmapgc 34217) [i386-mingw32] average difference
app_answer 0.344 0.234 -0.087
app_erb 18.516 2.812 -15.666
app_factorial 5.156 5.250 -0.162
app_fib 1.438 1.312 -0.109
app_mandelbrot 4.734 16.641 12.147
app_pentomino 34.250 35.781 -204.197
app_raise 1.266 1.328 0.109
diff --git a/samples/mem_alloc.cpp b/samples/mem_alloc.cpp
index fb04964..4ee16ec 100644
--- a/samples/mem_alloc.cpp
+++ b/samples/mem_alloc.cpp
@@ -17,6 +17,9 @@
#include <stdexcept>
#if defined (_WIN32)
+# undef __MSVCRT_VERSION__
+# define __MSVCRT_VERSION__ 0x0700