--- deps/cares/cares.gyp Tue Jun 18 23:50:53 2013 +++ deps/cares/cares.gyp Tue Jun 25 09:03:16 2013 @@ -114,8 +114,8 @@ 'src/ares_platform.c' ], 'libraries': [ - '-lws2_32.lib', - '-liphlpapi.lib' + '-lws2_32', + '-liphlpapi' ], }, { # Not Windows i.e. POSIX --- deps/openssl/openssl.gyp Tue Jun 18 23:50:53 2013 +++ deps/openssl/openssl.gyp Thu Jun 27 12:49:45 2013 @@ -663,7 +663,7 @@ ['exclude', 'store/.*$'] ], 'conditions': [ - ['target_arch!="ia32" and target_arch!="x64"', { + ['gcc_version>=43 and OS=="win"', { # Disable asm 'defines': [ 'OPENSSL_NO_ASM' @@ -891,8 +891,8 @@ ], 'link_settings': { 'libraries': [ - '-lgdi32.lib', - '-luser32.lib', + '-lgdi32', + '-luser32', ] } }, { --- deps/uv/include/uv-private/uv-win.h Tue Jun 18 23:50:53 2013 +++ deps/uv/include/uv-private/uv-win.h Wed Jun 26 10:57:35 2013 @@ -34,6 +34,11 @@ #include #include +#ifdef __MINGW64_VERSION_MAJOR +typedef PVOID RTL_SRWLOCK; +typedef RTL_SRWLOCK SRWLOCK, *PSRWLOCK; +#endif + #include #include #include --- deps/uv/src/win/core.c Tue Jun 18 23:50:53 2013 +++ deps/uv/src/win/core.c Wed Jun 26 13:40:52 2013 @@ -55,7 +55,7 @@ /* Tell the CRT to not exit the application when an invalid parameter is */ /* passed. The main issue is that invalid FDs will trigger this behavior. */ -#if !defined(__MINGW32__) || __MSVCRT_VERSION__ >= 0x800 +#if !defined(__MINGW32__) || (defined (_MSC_VER) && __MSVCRT_VERSION__ >= 0x800) _set_invalid_parameter_handler(uv__crt_invalid_parameter_handler); #endif --- deps/uv/src/win/pipe.c Tue Jun 18 23:50:53 2013 +++ deps/uv/src/win/pipe.c Tue Jun 25 09:03:17 2013 @@ -30,6 +30,9 @@ #include "stream-inl.h" #include "req-inl.h" +#ifndef FILE_FLAG_FIRST_PIPE_INSTANCE +#define FILE_FLAG_FIRST_PIPE_INSTANCE 524288 +#endif /* A zero-size buffer for use by uv_pipe_read */ static char uv_zero_[] = ""; --- deps/uv/src/win/process.c Tue Jun 18 23:50:53 2013 +++ deps/uv/src/win/process.c Tue Jun 25 09:03:17 2013 @@ -30,6 +30,9 @@ #include "handle-inl.h" #include "req-inl.h" +#ifndef JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE +#define JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE 0x2000 +#endif #define SIGKILL 9 --- deps/uv/uv.gyp Tue Jun 18 23:50:53 2013 +++ deps/uv/uv.gyp Tue Jun 25 09:03:17 2013 @@ -110,11 +110,11 @@ ], 'link_settings': { 'libraries': [ - '-ladvapi32.lib', - '-liphlpapi.lib', - '-lpsapi.lib', - '-lshell32.lib', - '-lws2_32.lib' + '-ladvapi32', + '-liphlpapi', + '-lpsapi', + '-lshell32', + '-lws2_32' ], }, }, { # Not Windows i.e. POSIX @@ -370,7 +370,7 @@ 'test/runner-win.c', 'test/runner-win.h' ], - 'libraries': [ 'ws2_32.lib' ] + 'libraries': [ 'ws2_32' ] }, { # POSIX 'defines': [ '_GNU_SOURCE' ], 'sources': [ @@ -434,7 +434,7 @@ 'test/runner-win.c', 'test/runner-win.h', ], - 'libraries': [ 'ws2_32.lib' ] + 'libraries': [ 'ws2_32' ] }, { # POSIX 'defines': [ '_GNU_SOURCE' ], 'sources': [ --- deps/v8/tools/gyp/v8.gyp Tue Jun 18 23:50:53 2013 +++ deps/v8/tools/gyp/v8.gyp Tue Jun 25 09:03:17 2013 @@ -731,7 +731,7 @@ ], 'msvs_disabled_warnings': [4351, 4355, 4800], 'link_settings': { - 'libraries': [ '-lwinmm.lib', '-lws2_32.lib' ], + 'libraries': [ '-lwinmm', '-lws2_32' ], }, }], ['component=="shared_library"', { --- lib/path.js Tue Jun 18 23:50:53 2013 +++ lib/path.js Thu Jun 27 12:42:45 2013 @@ -466,6 +466,8 @@ return ''; } + if (path.indexOf('/') == 0) path = mingwToWindowsPath(path); + var resolvedPath = exports.resolve(path); if (/^[a-zA-Z]\:\\/.test(resolvedPath)) { @@ -484,4 +486,57 @@ exports._makeLong = function(path) { return path; }; +} + +var mingwMounts = [], mingwGotMounts = false; +function mingwGetMounts() { + if (mingwGotMounts) return mingwMounts; + var spawn = require('child_process').spawn; + var fs = require('fs'); + var os = require('os'); + var tmp = os.tmpdir() + '/node-mount.tmp'; + var fd = fs.openSync(tmp, 'w+'); + var mount = spawn('sh', ['-c', 'mount; echo "EOF"'], { + 'stdio': ['ignore', fd, 'ignore'] + }); + var eof = os.EOL + 'EOF' + os.EOL; + var buflen = 4096; + var buf = new Buffer (buflen); + do { + var bytes = fs.readSync(fd, buf, 0, buflen, 0); + if (bytes >= buflen) { + console.error('mount overran the buffer'); + mingwGotMounts = true; + return mingwMounts; + } + } while (buf.slice(bytes - eof.length, bytes).toString() != eof); + fs.closeSync(fd); + var lines = buf.slice(0, bytes).toString().split(os.EOL); + var splitLineRe = /^(.+) on (.+) type /; + for (var i = 0; i < lines.length; i++) { + var match = splitLineRe.exec(lines[i]); + if (! match) continue; + mingwMounts.push([match[1], match[2]]); + } + mingwMounts.sort(function(a, b) { + var cmp = b[1].length - a[1].length; + if (cmp) return cmp; + else return a[1] > b[1]; + }); + mingwGotMounts = true; + return mingwMounts; +} +function mingwToWindowsPath(path) { + var mounts = mingwGetMounts(); + for (var i = 0; i < mounts.length; i++) { + var to = mounts[i][0], from = mounts[i][1]; + from = from.replace(/\/$/, ''); + var re = new RegExp('^' + from + '(.*)$'); + var match = re.exec(path); + if (match && (match[1].length == 0 || match[1][0] == '/')) { + return to + match[1]; + } + } + console.error(path + ' not found in mount'); + return path; } --- src/node_internals.h Tue Jun 18 23:50:53 2013 +++ src/node_internals.h Tue Jun 25 09:03:17 2013 @@ -34,7 +34,7 @@ // Defined in node.cc at startup. extern v8::Persistent process; -#ifdef _WIN32 +#ifdef _MSC_VER // emulate snprintf() on windows, _snprintf() doesn't zero-terminate the buffer // on overflow... #include --- src/node_main.cc Tue Jun 18 23:50:53 2013 +++ src/node_main.cc Wed Jun 26 17:49:16 2013 @@ -21,7 +21,10 @@ #include "node.h" -#ifdef _WIN32 +#if defined(_MSC_VER) || defined(__MINGW64_VERSION_MAJOR) +#if defined (__cplusplus) && defined(__MINGW64_VERSION_MAJOR) +extern "C" { +#endif int wmain(int argc, wchar_t *wargv[]) { // Convert argv to to UTF8 char** argv = new char*[argc]; @@ -59,6 +62,9 @@ // Now that conversion is done, we can finally start. return node::Start(argc, argv); } +#if defined (__cplusplus) && defined(__MINGW64_VERSION_MAJOR) +} +#endif #else // UNIX int main(int argc, char *argv[]) { --- node.gyp Tue Jun 18 23:50:53 2013 +++ node.gyp Thu Jun 27 12:53:18 2013 @@ -256,7 +256,7 @@ 'PLATFORM="win32"', '_UNICODE=1', ], - 'libraries': [ '-lpsapi.lib' ] + 'libraries': [ '-municode', '-lpsapi' ] }, { # POSIX 'defines': [ '__POSIX__' ], }],