Browse Source

Make MSVS build.

MSVS settings don't actually need to be guarded by conditions. gyp will do
the right thing.
v0.7.4-release
Peter Bright 14 years ago
committed by Ryan Dahl
parent
commit
6ac8c55989
  1. 15
      .gitignore
  2. 35
      deps/http_parser/http_parser.gyp
  3. 42
      deps/uv/build/all.gyp
  4. 24
      deps/uv/deps/pthread-win32/build/all.gyp
  5. 14
      deps/uv/include/eio.h
  6. 75
      deps/uv/src/eio/eio.c
  7. 2
      deps/uv/src/eio/xthread.h
  8. 2
      src/node_extensions.h
  9. 6
      src/node_file.cc
  10. 6
      src/node_http_parser.cc
  11. 51
      tools/all.gyp

15
.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

35
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': [

42
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'
],

24
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': [

14
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
}

75
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 <sys/utime.h>
#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 <sys/time.h>
@ -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;
}

2
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 <stdio.h>//D
#include <fcntl.h>
#include <io.h>

2
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)

6
src/node_file.cc

@ -602,7 +602,7 @@ static Handle<Value> MKDir(const Arguments& args) {
}
String::Utf8Value path(args[0]->ToString());
mode_t mode = static_cast<mode_t>(args[1]->Int32Value());
eio_mode_t mode = static_cast<eio_mode_t>(args[1]->Int32Value());
if (args[2]->IsFunction()) {
ASYNC_CALL(mkdir, args[2], *path, mode)
@ -714,7 +714,7 @@ static Handle<Value> Open(const Arguments& args) {
String::Utf8Value path(args[0]->ToString());
int flags = args[1]->Int32Value();
mode_t mode = static_cast<mode_t>(args[2]->Int32Value());
eio_mode_t mode = static_cast<eio_mode_t>(args[2]->Int32Value());
if (args[3]->IsFunction()) {
ASYNC_CALL(open, args[3], *path, flags, mode)
@ -875,7 +875,7 @@ static Handle<Value> Chmod(const Arguments& args) {
return THROW_BAD_ARGS;
}
String::Utf8Value path(args[0]->ToString());
mode_t mode = static_cast<mode_t>(args[1]->Int32Value());
eio_mode_t mode = static_cast<eio_mode_t>(args[1]->Int32Value());
if(args[2]->IsFunction()) {
ASYNC_CALL(chmod, args[2], *path, mode);

6
src/node_http_parser.cc

@ -27,8 +27,12 @@
#include <http_parser.h>
#include <strings.h> /* strcasecmp() */
#include <string.h> /* strdup() */
#if !defined(_MSC_VER)
#include <strings.h> /* strcasecmp() */
#else
#define strcasecmp _stricmp
#endif
#include <stdlib.h> /* free() */
// This is a binding to http_parser (http://github.com/ry/http-parser)

51
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',

Loading…
Cancel
Save