diff --git a/.gitignore b/.gitignore index e321a01c23..8f5af87992 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,18 @@ tools/all.target.mk tools/node_js2c.host.mk tools/node_js2c.target.mk out/ + +# various stuff that VC++ produces/uses +Debug/ +Release/ +*.sln +*.suo +*.vcproj +*.vcxproj +*.vcxproj.user +*.vcxproj.filters +UpgradeLog*.XML +_UpgradeReport_Files/ +ipch/ +*.sdf +*.opensdf diff --git a/deps/http_parser/http_parser.gyp b/deps/http_parser/http_parser.gyp index e9183b8d55..c6eada707f 100644 --- a/deps/http_parser/http_parser.gyp +++ b/deps/http_parser/http_parser.gyp @@ -6,14 +6,43 @@ # ./out/Debug/test { 'target_defaults': { + 'default_configuration': 'Debug', 'configurations': { + # TODO: hoist these out and put them somewhere common, because + # RuntimeLibrary MUST MATCH across the entire project 'Debug': { - 'defines': [ 'DEBUG', '_DEBUG' ] + 'defines': [ 'DEBUG', '_DEBUG' ], + 'msvs_settings': { + 'VCCLCompilerTool': { + 'RuntimeLibrary': 1, # static debug + }, + }, }, 'Release': { - 'defines': [ 'NDEBUG' ] + 'defines': [ 'NDEBUG' ], + 'msvs_settings': { + 'VCCLCompilerTool': { + 'RuntimeLibrary': 0, # static release + }, + }, } - } + }, + 'msvs_settings': { + 'VCCLCompilerTool': { + }, + 'VCLibrarianTool': { + }, + 'VCLinkerTool': { + 'GenerateDebugInformation': 'true', + }, + }, + 'conditions': [ + ['OS == "win"', { + 'defines': [ + 'WIN32' + ], + }] + ], }, 'targets': [ diff --git a/deps/uv/build/all.gyp b/deps/uv/build/all.gyp index 87eaf29f94..5e1580c9f4 100644 --- a/deps/uv/build/all.gyp +++ b/deps/uv/build/all.gyp @@ -1,14 +1,44 @@ { 'target_defaults': { + 'default_configuration': 'Debug', 'configurations': { + # TODO: hoist these out and put them somewhere common, because + # RuntimeLibrary MUST MATCH across the entire project 'Debug': { - 'defines': [ 'DEBUG', '_DEBUG' ] + 'defines': [ 'DEBUG', '_DEBUG' ], + 'msvs_settings': { + 'VCCLCompilerTool': { + 'RuntimeLibrary': 1, # static debug + }, + }, }, 'Release': { - 'defines': [ 'NDEBUG' ] + 'defines': [ 'NDEBUG' ], + 'msvs_settings': { + 'VCCLCompilerTool': { + 'RuntimeLibrary': 0, # static release + }, + }, } - } + }, + 'msvs_settings': { + 'VCCLCompilerTool': { + }, + 'VCLibrarianTool': { + }, + 'VCLinkerTool': { + 'GenerateDebugInformation': 'true', + }, + }, + 'conditions': [ + ['OS == "win"', { + 'defines': [ + 'WIN32' + ], + }] + ], }, + 'targets': [ { 'target_name': 'uv', @@ -69,12 +99,6 @@ ], 'conditions': [ [ 'OS=="win"', { - 'dependencies': [ - '../deps/pthread-win32/build/all.gyp:pthread-win32' - ], - 'export_dependent_settings': [ - '../deps/pthread-win32/build/all.gyp:pthread-win32' - ], 'include_dirs': [ '../src/ares/config_win32' ], diff --git a/deps/uv/deps/pthread-win32/build/all.gyp b/deps/uv/deps/pthread-win32/build/all.gyp index 54c5608e84..24bf648bc6 100644 --- a/deps/uv/deps/pthread-win32/build/all.gyp +++ b/deps/uv/deps/pthread-win32/build/all.gyp @@ -9,18 +9,34 @@ 'msvs_settings': { 'VCCLCompilerTool': { 'RuntimeLibrary': 1, # static debug - } - } + }, + }, }, 'Release': { 'defines': [ 'NDEBUG' ], 'msvs_settings': { 'VCCLCompilerTool': { 'RuntimeLibrary': 0, # static release - } - } + }, + }, } }, + 'msvs_settings': { + 'VCCLCompilerTool': { + }, + 'VCLibrarianTool': { + }, + 'VCLinkerTool': { + 'GenerateDebugInformation': 'true', + }, + }, + 'conditions': [ + ['OS == "win"', { + 'defines': [ + 'WIN32' + ], + }] + ], }, 'targets': [ diff --git a/deps/uv/include/eio.h b/deps/uv/include/eio.h index bade4e7796..380048c0c1 100644 --- a/deps/uv/include/eio.h +++ b/deps/uv/include/eio.h @@ -69,6 +69,7 @@ typedef int (*eio_cb)(eio_req *req); #ifdef _WIN32 typedef int eio_uid_t; typedef int eio_gid_t; + typedef int eio_mode_t; #ifdef __MINGW32__ /* no intptr_t */ typedef ssize_t eio_ssize_t; #else @@ -84,6 +85,7 @@ typedef int (*eio_cb)(eio_req *req); typedef gid_t eio_gid_t; typedef ssize_t eio_ssize_t; typedef ino_t eio_ino_t; + typedef mode_t eio_mode_t; #endif #ifndef EIO_STRUCT_STATVFS @@ -307,16 +309,16 @@ eio_req *eio_fstat (int fd, int pri, eio_cb cb, void *data); /* stat buffer= eio_req *eio_fstatvfs (int fd, int pri, eio_cb cb, void *data); /* stat buffer=ptr2 allocated dynamically */ eio_req *eio_futime (int fd, eio_tstamp atime, eio_tstamp mtime, int pri, eio_cb cb, void *data); eio_req *eio_ftruncate (int fd, off_t offset, int pri, eio_cb cb, void *data); -eio_req *eio_fchmod (int fd, mode_t mode, int pri, eio_cb cb, void *data); +eio_req *eio_fchmod (int fd, eio_mode_t mode, int pri, eio_cb cb, void *data); eio_req *eio_fchown (int fd, eio_uid_t uid, eio_gid_t gid, int pri, eio_cb cb, void *data); eio_req *eio_dup2 (int fd, int fd2, int pri, eio_cb cb, void *data); eio_req *eio_sendfile (int out_fd, int in_fd, off_t in_offset, size_t length, int pri, eio_cb cb, void *data); -eio_req *eio_open (const char *path, int flags, mode_t mode, int pri, eio_cb cb, void *data); +eio_req *eio_open (const char *path, int flags, eio_mode_t mode, int pri, eio_cb cb, void *data); eio_req *eio_utime (const char *path, eio_tstamp atime, eio_tstamp mtime, int pri, eio_cb cb, void *data); eio_req *eio_truncate (const char *path, off_t offset, int pri, eio_cb cb, void *data); eio_req *eio_chown (const char *path, eio_uid_t uid, eio_gid_t gid, int pri, eio_cb cb, void *data); -eio_req *eio_chmod (const char *path, mode_t mode, int pri, eio_cb cb, void *data); -eio_req *eio_mkdir (const char *path, mode_t mode, int pri, eio_cb cb, void *data); +eio_req *eio_chmod (const char *path, eio_mode_t mode, int pri, eio_cb cb, void *data); +eio_req *eio_mkdir (const char *path, eio_mode_t mode, int pri, eio_cb cb, void *data); eio_req *eio_readdir (const char *path, int flags, int pri, eio_cb cb, void *data); /* result=ptr2 allocated dynamically */ eio_req *eio_rmdir (const char *path, int pri, eio_cb cb, void *data); eio_req *eio_unlink (const char *path, int pri, eio_cb cb, void *data); @@ -325,7 +327,7 @@ eio_req *eio_realpath (const char *path, int pri, eio_cb cb, void *data); /* re eio_req *eio_stat (const char *path, int pri, eio_cb cb, void *data); /* stat buffer=ptr2 allocated dynamically */ eio_req *eio_lstat (const char *path, int pri, eio_cb cb, void *data); /* stat buffer=ptr2 allocated dynamically */ eio_req *eio_statvfs (const char *path, int pri, eio_cb cb, void *data); /* stat buffer=ptr2 allocated dynamically */ -eio_req *eio_mknod (const char *path, mode_t mode, dev_t dev, int pri, eio_cb cb, void *data); +eio_req *eio_mknod (const char *path, eio_mode_t mode, dev_t dev, int pri, eio_cb cb, void *data); eio_req *eio_link (const char *path, const char *new_path, int pri, eio_cb cb, void *data); eio_req *eio_symlink (const char *path, const char *new_path, int pri, eio_cb cb, void *data); eio_req *eio_rename (const char *path, const char *new_path, int pri, eio_cb cb, void *data); @@ -363,6 +365,8 @@ void eio_cancel (eio_req *req); /* convenience functions */ eio_ssize_t eio_sendfile_sync (int ofd, int ifd, off_t offset, size_t count); +eio_ssize_t eio__pread (int fd, void *buf, size_t count, off_t offset); +eio_ssize_t eio__pwrite (int fd, void *buf, size_t count, off_t offset); #ifdef __cplusplus } diff --git a/deps/uv/src/eio/eio.c b/deps/uv/src/eio/eio.c index fe027132a1..c8d1e01802 100644 --- a/deps/uv/src/eio/eio.c +++ b/deps/uv/src/eio/eio.c @@ -200,6 +200,57 @@ static void eio_destroy (eio_req *req); #define D_NAME(entp) entp.cFileName #define D_TYPE(entp) (entp.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ? DT_DIR : DT_REG) +#include +#define utime(path, times) _utime(path, times) +#define utimbuf _utimbuf + +#if defined(_MSC_VER) || defined(_MSC_EXTENSIONS) + #define DELTA_EPOCH_IN_MICROSECS 11644473600000000Ui64 +#else + #define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL +#endif + +struct timezone +{ + int tz_minuteswest; /* minutes W of Greenwich */ + int tz_dsttime; /* type of dst correction */ +}; + +static int gettimeofday(struct timeval *tv, struct timezone *tz) +{ + FILETIME ft; + unsigned __int64 tmpres = 0; + static int tzflag; + + if (NULL != tv) + { + GetSystemTimeAsFileTime(&ft); + + tmpres |= ft.dwHighDateTime; + tmpres <<= 32; + tmpres |= ft.dwLowDateTime; + + /*converting file time to unix epoch*/ + tmpres -= DELTA_EPOCH_IN_MICROSECS; + tmpres /= 10; /*convert into microseconds*/ + tv->tv_sec = (long)(tmpres / 1000000UL); + tv->tv_usec = (long)(tmpres % 1000000UL); + } + + if (NULL != tz) + { + if (!tzflag) + { + _tzset(); + tzflag++; + } + tz->tz_minuteswest = _timezone / 60; + tz->tz_dsttime = _daylight; + } + + return 0; +} + #else #include @@ -912,7 +963,7 @@ int eio_poll (void) # define pread eio__pread # define pwrite eio__pwrite -static eio_ssize_t +eio_ssize_t eio__pread (int fd, void *buf, size_t count, off_t offset) { eio_ssize_t res; @@ -928,7 +979,7 @@ eio__pread (int fd, void *buf, size_t count, off_t offset) return res; } -static eio_ssize_t +eio_ssize_t eio__pwrite (int fd, void *buf, size_t count, off_t offset) { eio_ssize_t res; @@ -2116,21 +2167,21 @@ eio_execute (etp_worker *self, eio_req *req) case EIO_CHOWN: req->result = chown (req->ptr1, req->int2, req->int3); break; case EIO_FCHOWN: req->result = fchown (req->int1, req->int2, req->int3); break; - case EIO_CHMOD: req->result = chmod (req->ptr1, (mode_t)req->int2); break; - case EIO_FCHMOD: req->result = fchmod (req->int1, (mode_t)req->int2); break; + case EIO_CHMOD: req->result = chmod (req->ptr1, (eio_mode_t)req->int2); break; + case EIO_FCHMOD: req->result = fchmod (req->int1, (eio_mode_t)req->int2); break; case EIO_TRUNCATE: req->result = truncate (req->ptr1, req->offs); break; case EIO_FTRUNCATE: req->result = ftruncate (req->int1, req->offs); break; - case EIO_OPEN: req->result = open (req->ptr1, req->int1, (mode_t)req->int2); break; + case EIO_OPEN: req->result = open (req->ptr1, req->int1, (eio_mode_t)req->int2); break; case EIO_CLOSE: req->result = close (req->int1); break; case EIO_DUP2: req->result = dup2 (req->int1, req->int2); break; case EIO_UNLINK: req->result = unlink (req->ptr1); break; case EIO_RMDIR: req->result = rmdir (req->ptr1); break; - case EIO_MKDIR: req->result = mkdir (req->ptr1, (mode_t)req->int2); break; + case EIO_MKDIR: req->result = mkdir (req->ptr1, (eio_mode_t)req->int2); break; case EIO_RENAME: req->result = rename (req->ptr1, req->ptr2); break; case EIO_LINK: req->result = link (req->ptr1, req->ptr2); break; case EIO_SYMLINK: req->result = symlink (req->ptr1, req->ptr2); break; - case EIO_MKNOD: req->result = mknod (req->ptr1, (mode_t)req->int2, (dev_t)req->offs); break; + case EIO_MKNOD: req->result = mknod (req->ptr1, (eio_mode_t)req->int2, (dev_t)req->offs); break; case EIO_REALPATH: eio__realpath (req, self); break; @@ -2311,7 +2362,7 @@ eio_req *eio_ftruncate (int fd, off_t offset, int pri, eio_cb cb, void *data) REQ (EIO_FTRUNCATE); req->int1 = fd; req->offs = offset; SEND; } -eio_req *eio_fchmod (int fd, mode_t mode, int pri, eio_cb cb, void *data) +eio_req *eio_fchmod (int fd, eio_mode_t mode, int pri, eio_cb cb, void *data) { REQ (EIO_FCHMOD); req->int1 = fd; req->int2 = (long)mode; SEND; } @@ -2331,7 +2382,7 @@ eio_req *eio_sendfile (int out_fd, int in_fd, off_t in_offset, size_t length, in REQ (EIO_SENDFILE); req->int1 = out_fd; req->int2 = in_fd; req->offs = in_offset; req->size = length; SEND; } -eio_req *eio_open (const char *path, int flags, mode_t mode, int pri, eio_cb cb, void *data) +eio_req *eio_open (const char *path, int flags, eio_mode_t mode, int pri, eio_cb cb, void *data) { REQ (EIO_OPEN); PATH; req->int1 = flags; req->int2 = (long)mode; SEND; } @@ -2351,12 +2402,12 @@ eio_req *eio_chown (const char *path, eio_uid_t uid, eio_gid_t gid, int pri, eio REQ (EIO_CHOWN); PATH; req->int2 = (long)uid; req->int3 = (long)gid; SEND; } -eio_req *eio_chmod (const char *path, mode_t mode, int pri, eio_cb cb, void *data) +eio_req *eio_chmod (const char *path, eio_mode_t mode, int pri, eio_cb cb, void *data) { REQ (EIO_CHMOD); PATH; req->int2 = (long)mode; SEND; } -eio_req *eio_mkdir (const char *path, mode_t mode, int pri, eio_cb cb, void *data) +eio_req *eio_mkdir (const char *path, eio_mode_t mode, int pri, eio_cb cb, void *data) { REQ (EIO_MKDIR); PATH; req->int2 = (long)mode; SEND; } @@ -2407,7 +2458,7 @@ eio_req *eio_readdir (const char *path, int flags, int pri, eio_cb cb, void *dat REQ (EIO_READDIR); PATH; req->int1 = flags; SEND; } -eio_req *eio_mknod (const char *path, mode_t mode, dev_t dev, int pri, eio_cb cb, void *data) +eio_req *eio_mknod (const char *path, eio_mode_t mode, dev_t dev, int pri, eio_cb cb, void *data) { REQ (EIO_MKNOD); PATH; req->int2 = (long)mode; req->offs = (off_t)dev; SEND; } diff --git a/deps/uv/src/eio/xthread.h b/deps/uv/src/eio/xthread.h index 1879866ffd..7184c7bb73 100644 --- a/deps/uv/src/eio/xthread.h +++ b/deps/uv/src/eio/xthread.h @@ -17,8 +17,6 @@ #ifdef _WIN32 -#define NTDDI_VERSION NTDDI_WIN2K // needed to get win2000 api calls -#define _WIN32_WINNT 0x400 #include //D #include #include diff --git a/src/node_extensions.h b/src/node_extensions.h index 7e55afd212..d33a523045 100644 --- a/src/node_extensions.h +++ b/src/node_extensions.h @@ -26,7 +26,7 @@ NODE_EXT_LIST_ITEM(node_buffer) NODE_EXT_LIST_ITEM(node_cares) NODE_EXT_LIST_ITEM(node_child_process) #endif -#ifdef HAVE_OPENSSL +#if HAVE_OPENSSL NODE_EXT_LIST_ITEM(node_crypto) #endif NODE_EXT_LIST_ITEM(node_evals) diff --git a/src/node_file.cc b/src/node_file.cc index 3485cfbcec..2e7c75a46e 100644 --- a/src/node_file.cc +++ b/src/node_file.cc @@ -602,7 +602,7 @@ static Handle MKDir(const Arguments& args) { } String::Utf8Value path(args[0]->ToString()); - mode_t mode = static_cast(args[1]->Int32Value()); + eio_mode_t mode = static_cast(args[1]->Int32Value()); if (args[2]->IsFunction()) { ASYNC_CALL(mkdir, args[2], *path, mode) @@ -714,7 +714,7 @@ static Handle Open(const Arguments& args) { String::Utf8Value path(args[0]->ToString()); int flags = args[1]->Int32Value(); - mode_t mode = static_cast(args[2]->Int32Value()); + eio_mode_t mode = static_cast(args[2]->Int32Value()); if (args[3]->IsFunction()) { ASYNC_CALL(open, args[3], *path, flags, mode) @@ -875,7 +875,7 @@ static Handle Chmod(const Arguments& args) { return THROW_BAD_ARGS; } String::Utf8Value path(args[0]->ToString()); - mode_t mode = static_cast(args[1]->Int32Value()); + eio_mode_t mode = static_cast(args[1]->Int32Value()); if(args[2]->IsFunction()) { ASYNC_CALL(chmod, args[2], *path, mode); diff --git a/src/node_http_parser.cc b/src/node_http_parser.cc index 6cb78455ba..b99e205041 100644 --- a/src/node_http_parser.cc +++ b/src/node_http_parser.cc @@ -27,8 +27,12 @@ #include -#include /* strcasecmp() */ #include /* strdup() */ +#if !defined(_MSC_VER) +#include /* strcasecmp() */ +#else +#define strcasecmp _stricmp +#endif #include /* free() */ // This is a binding to http_parser (http://github.com/ry/http-parser) diff --git a/tools/all.gyp b/tools/all.gyp index 59027aebcf..25970cfdaa 100644 --- a/tools/all.gyp +++ b/tools/all.gyp @@ -9,18 +9,34 @@ 'msvs_settings': { 'VCCLCompilerTool': { 'RuntimeLibrary': 1, # static debug - } - } + }, + }, }, 'Release': { 'defines': [ 'NDEBUG' ], 'msvs_settings': { 'VCCLCompilerTool': { 'RuntimeLibrary': 0, # static release - } - } + }, + }, } }, + 'msvs_settings': { + 'VCCLCompilerTool': { + }, + 'VCLibrarianTool': { + }, + 'VCLinkerTool': { + 'GenerateDebugInformation': 'true', + }, + }, + 'conditions': [ + ['OS == "win"', { + 'defines': [ + 'WIN32' + ], + }] + ], }, 'variables': { @@ -88,21 +104,34 @@ }], [ 'OS=="win"', { - # until we figure out a good way to get openssl into the build system + 'dependencies': [ + '../deps/uv/deps/pthread-win32/build/all.gyp:pthread-win32', + ], + # openssl is not built using gyp, and needs to be + # built separately and placed outside the hierarchy. + # the dependencies aren't set up yet to put it in + # place, so I'm going to force it off indiscrimately + # for the time being. Because the above condition has + # already kicked in, it's not enough simply to turn + # 'node_use_openssl' off; I need to undo its effects 'node_use_openssl': 'false', + 'defines!': [ 'HAVE_OPENSSL=1' ], + 'defines': [ 'HAVE_OPENSSL=0' ], + 'libraries!': [ '-lssl', '-lcrypto' ], + 'sources!': [ '../src/node_crypto.cc' ], + 'sources': [ + '../src/platform_win32.cc', + '../src/node_stdio_win32.cc', + '../deps/uv/src/eio/eio.c', # file operations depend on eio to link. uv contains eio in unix builds, but not win32. So we need to compile it here instead. + ], 'defines': [ 'PTW32_STATIC_LIB', # we'll need to add pthread-win32 and build/depend on that. - 'FD_SETSIZE=1024' + 'FD_SETSIZE=1024', ], 'libraries': [ '-lws2_32.lib', '-lwinmm.lib', ], - 'sources': [ - '../src/platform_win32.cc', - '../src/node_stdio_win32.cc', - '../deps/uv/src/eio/eio.c', # file operations depend on eio to link. uv contains eio in unix builds, but not win32. So we need to compile it here instead. - ], 'msvs_settings': { 'VCCLCompilerTool': { 'WarningLevel': '3',