Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 406f44a

Browse filesBrowse files
committed
Build on windows again
1 parent 126e3ba commit 406f44a
Copy full SHA for 406f44a

File tree

Expand file treeCollapse file tree

8 files changed

+63
-38
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

8 files changed

+63
-38
lines changed
Open diff view settings
Collapse file

‎src/node.cc‎

Copy file name to clipboardExpand all lines: src/node.cc
+9-3Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,18 @@
5252

5353
#include <platform.h>
5454
#include <node_buffer.h>
55-
#include <node_io_watcher.h>
55+
#ifdef __POSIX__
56+
# include <node_io_watcher.h>
57+
#endif
5658
#include <node_net.h>
5759
#include <node_events.h>
5860
#include <node_cares.h>
5961
#include <node_file.h>
6062
#include <node_http_parser.h>
61-
#include <node_signal_watcher.h>
62-
#include <node_stat_watcher.h>
63+
#ifdef __POSIX__
64+
# include <node_signal_watcher.h>
65+
# include <node_stat_watcher.h>
66+
#endif
6367
#include <node_child_process.h>
6468
#include <node_constants.h>
6569
#include <node_stdio.h>
@@ -1865,10 +1869,12 @@ static Handle<Value> Binding(const Arguments& args) {
18651869
DefineConstants(exports);
18661870
binding_cache->Set(module, exports);
18671871

1872+
#ifdef __POSIX__
18681873
} else if (!strcmp(*module_v, "io_watcher")) {
18691874
exports = Object::New();
18701875
IOWatcher::Initialize(exports);
18711876
binding_cache->Set(module, exports);
1877+
#endif
18721878

18731879
} else if (!strcmp(*module_v, "natives")) {
18741880
exports = Object::New();
Collapse file

‎src/node.js‎

Copy file name to clipboardExpand all lines: src/node.js
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,10 @@
194194

195195
startup.processStdio = function() {
196196
var binding = process.binding('stdio'),
197-
net = NativeModule.require('net'),
197+
// FIXME Remove conditional when net is supported again on windows.
198+
net = (process.platform !== "win32")
199+
? NativeModule.require('net')
200+
: undefined,
198201
fs = NativeModule.require('fs'),
199202
tty = NativeModule.require('tty');
200203

Collapse file

‎src/node_child_process.h‎

Copy file name to clipboardExpand all lines: src/node_child_process.h
+6-2Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@
2626
#include <node_object_wrap.h>
2727

2828
#include <v8.h>
29-
#include <ev.h>
29+
#include <uv.h>
30+
31+
#ifdef __POSIX__
32+
# include <ev.h>
33+
#endif
3034

3135
#ifdef __MINGW32__
3236
# include <platform_win32.h> // HANDLE type
@@ -120,7 +124,7 @@ class ChildProcess : ObjectWrap {
120124
static void watch(ChildProcess *child);
121125
static void CALLBACK watch_wait_callback(void *data, BOOLEAN didTimeout);
122126
static void notify_spawn_failure(ChildProcess *child);
123-
static void notify_exit(EV_P_ ev_async *ev, int revent);
127+
static void notify_exit(uv_handle_t* watcher, int status);
124128
static int do_kill(ChildProcess *child, int sig);static void close_stdio_handles(ChildProcess *child);
125129

126130
int pid_;
Collapse file

‎src/node_child_process_win32.cc‎

Copy file name to clipboardExpand all lines: src/node_child_process_win32.cc
+7-16Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,11 @@
2424
#include <node_child_process.h>
2525

2626
#include <v8.h>
27-
#include <ev.h>
27+
#include <uv.h>
2828
#include <eio.h>
2929

3030
#include <assert.h>
31+
#include <signal.h>
3132
#include <string.h>
3233
#include <stdlib.h>
3334
#include <errno.h>
@@ -51,7 +52,7 @@ static Persistent<String> onexit_symbol;
5152

5253

5354
static struct watcher_status_struct {
54-
ev_async async_watcher;
55+
uv_async_t async_watcher;
5556
ChildProcess *child;
5657
HANDLE lock;
5758
int num_active;
@@ -350,15 +351,10 @@ void ChildProcess::close_stdio_handles(ChildProcess *child) {
350351

351352

352353
// Called from the main thread
353-
void ChildProcess::notify_exit(EV_P_ ev_async *ev, int revent) {
354+
void ChildProcess::notify_exit(uv_handle_t* watcher, int status) {
354355
// Get the child process, then release the lock
355356
ChildProcess *child = watcher_status.child;
356357

357-
// Stop the watcher if appropriate
358-
if (!--watcher_status.num_active) {
359-
ev_async_stop(EV_DEFAULT_UC_ &watcher_status.async_watcher);
360-
}
361-
362358
ReleaseSemaphore(watcher_status.lock, 1, NULL);
363359

364360
DWORD exit_code = -127;
@@ -398,7 +394,7 @@ void ChildProcess::notify_spawn_failure(ChildProcess *child) {
398394

399395
watcher_status.child = child;
400396

401-
ev_async_send(EV_DEFAULT_UC_ &watcher_status.async_watcher);
397+
uv_async_send(&watcher_status.async_watcher);
402398
}
403399

404400

@@ -418,7 +414,7 @@ void CALLBACK ChildProcess::watch_wait_callback(void *data,
418414
assert(result == WAIT_OBJECT_0);
419415

420416
watcher_status.child = child;
421-
ev_async_send(EV_DEFAULT_UC_ &watcher_status.async_watcher);
417+
uv_async_send(&watcher_status.async_watcher);
422418
}
423419

424420

@@ -810,11 +806,6 @@ Handle<Value> ChildProcess::Spawn(const Arguments& args) {
810806
// Grab a reference so it doesn't get GC'ed
811807
child->Ref();
812808

813-
// Start the async watcher
814-
if (!watcher_status.num_active++) {
815-
ev_async_start(EV_DEFAULT_UC_ &watcher_status.async_watcher);
816-
}
817-
818809
eio_custom(do_spawn, EIO_PRI_DEFAULT, after_spawn, (void*)child);
819810

820811
return scope.Close(result);
@@ -892,7 +883,7 @@ void ChildProcess::Initialize(Handle<Object> target) {
892883

893884
target->Set(String::NewSymbol("ChildProcess"), t->GetFunction());
894885

895-
ev_async_init(EV_DEFAULT_UC_ &watcher_status.async_watcher, notify_exit);
886+
uv_async_init(&watcher_status.async_watcher, notify_exit, NULL, NULL);
896887
watcher_status.lock = CreateSemaphore(NULL, 1, 1, NULL);
897888
}
898889

Collapse file

‎src/node_extensions.h‎

Copy file name to clipboardExpand all lines: src/node_extensions.h
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,22 @@
2222

2323
NODE_EXT_LIST_START
2424
NODE_EXT_LIST_ITEM(node_buffer)
25+
#ifdef __POSIX__
2526
NODE_EXT_LIST_ITEM(node_cares)
27+
#endif
2628
NODE_EXT_LIST_ITEM(node_child_process)
2729
#ifdef HAVE_OPENSSL
2830
NODE_EXT_LIST_ITEM(node_crypto)
2931
#endif
3032
NODE_EXT_LIST_ITEM(node_evals)
3133
NODE_EXT_LIST_ITEM(node_fs)
34+
#ifdef __POSIX__
3235
NODE_EXT_LIST_ITEM(node_net)
36+
#endif
3337
NODE_EXT_LIST_ITEM(node_http_parser)
38+
#ifdef __POSIX__
3439
NODE_EXT_LIST_ITEM(node_signal_watcher)
40+
#endif
3541
NODE_EXT_LIST_ITEM(node_stdio)
3642
NODE_EXT_LIST_ITEM(node_os)
3743
NODE_EXT_LIST_ITEM(node_timer_wrap)
Collapse file

‎src/node_file.cc‎

Copy file name to clipboardExpand all lines: src/node_file.cc
+13-4Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222
#include <node.h>
2323
#include <node_file.h>
2424
#include <node_buffer.h>
25-
#include <node_stat_watcher.h>
25+
#ifdef __POSIX__
26+
# include <node_stat_watcher.h>
27+
#endif
2628

2729
#include <sys/types.h>
2830
#include <sys/stat.h>
@@ -816,6 +818,7 @@ static Handle<Value> Chmod(const Arguments& args) {
816818
}
817819

818820

821+
#ifdef __POSIX__
819822
/* fs.fchmod(fd, mode);
820823
* Wrapper for fchmod(1) / EIO_FCHMOD
821824
*/
@@ -836,6 +839,7 @@ static Handle<Value> FChmod(const Arguments& args) {
836839
return Undefined();
837840
}
838841
}
842+
#endif // __POSIX__
839843

840844

841845
#ifdef __POSIX__
@@ -909,6 +913,7 @@ static inline void ToTimevals(eio_tstamp atime,
909913
}
910914

911915

916+
#ifdef __POSIX__
912917
static Handle<Value> UTimes(const Arguments& args) {
913918
HandleScope scope;
914919

@@ -937,6 +942,7 @@ static Handle<Value> UTimes(const Arguments& args) {
937942

938943
return Undefined();
939944
}
945+
#endif // __POSIX__
940946

941947

942948
static Handle<Value> FUTimes(const Arguments& args) {
@@ -1002,16 +1008,16 @@ void File::Initialize(Handle<Object> target) {
10021008
NODE_SET_METHOD(target, "write", Write);
10031009

10041010
NODE_SET_METHOD(target, "chmod", Chmod);
1005-
NODE_SET_METHOD(target, "fchmod", FChmod);
10061011
#ifdef __POSIX__
1012+
NODE_SET_METHOD(target, "fchmod", FChmod);
10071013
//NODE_SET_METHOD(target, "lchmod", LChmod);
10081014

10091015
NODE_SET_METHOD(target, "chown", Chown);
10101016
NODE_SET_METHOD(target, "fchown", FChown);
10111017
//NODE_SET_METHOD(target, "lchown", LChown);
1012-
#endif // __POSIX__
10131018

10141019
NODE_SET_METHOD(target, "utimes", UTimes);
1020+
#endif // __POSIX__
10151021
NODE_SET_METHOD(target, "futimes", FUTimes);
10161022

10171023
errno_symbol = NODE_PSYMBOL("errno");
@@ -1026,9 +1032,12 @@ void InitFs(Handle<Object> target) {
10261032
stats_constructor_template = Persistent<FunctionTemplate>::New(stat_templ);
10271033
target->Set(String::NewSymbol("Stats"),
10281034
stats_constructor_template->GetFunction());
1029-
StatWatcher::Initialize(target);
10301035
File::Initialize(target);
10311036

1037+
#ifdef __POSIX__
1038+
StatWatcher::Initialize(target);
1039+
#endif
1040+
10321041
#ifdef __MINGW32__
10331042
// Open files in binary mode by default
10341043
_fmode = _O_BINARY;
Collapse file

‎src/node_stdio_win32.cc‎

Copy file name to clipboardExpand all lines: src/node_stdio_win32.cc
+7-4Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ void *tty_keypress_callback;
422422
void *tty_resize_callback;
423423
static bool tty_watcher_initialized = false;
424424
static bool tty_watcher_active = false;
425-
static uv_handle_t tty_avail_notifier;
425+
static uv_async_t tty_avail_notifier;
426426

427427

428428
static void CALLBACK tty_want_poll(void *context, BOOLEAN didTimeout) {
@@ -469,6 +469,7 @@ static void tty_watcher_start() {
469469
assert(tty_watcher_initialized);
470470
if (!tty_watcher_active) {
471471
tty_watcher_active = true;
472+
uv_ref();
472473
tty_watcher_arm();
473474
}
474475
}
@@ -477,6 +478,7 @@ static void tty_watcher_start() {
477478
static void tty_watcher_stop() {
478479
if (tty_watcher_active) {
479480
tty_watcher_active = false;
481+
uv_unref();
480482
tty_watcher_disarm();
481483
}
482484
}
@@ -492,7 +494,7 @@ static inline void tty_emit_error(Handle<Value> err) {
492494

493495

494496
static void tty_poll(uv_handle_t* handle, int status) {
495-
assert(handle == &tty_avail_notifier);
497+
assert((uv_async_t*) handle == &tty_avail_notifier);
496498
assert(status == 0);
497499

498500
HandleScope scope;
@@ -609,8 +611,6 @@ static Handle<Value> InitTTYWatcher(const Arguments& args) {
609611
? cb_persist(args[3])
610612
: NULL;
611613

612-
uv_async_init(&tty_avail_notifier, tty_poll, NULL, NULL);
613-
614614
tty_watcher_initialized = true;
615615
tty_wait_handle = NULL;
616616

@@ -657,6 +657,9 @@ static Handle<Value> StopTTYWatcher(const Arguments& args) {
657657

658658
void Stdio::Initialize(v8::Handle<v8::Object> target) {
659659
init_scancode_table();
660+
661+
uv_async_init(&tty_avail_notifier, tty_poll, NULL, NULL);
662+
uv_unref();
660663

661664
name_symbol = NODE_PSYMBOL("name");
662665
shift_symbol = NODE_PSYMBOL("shift");
Collapse file

‎wscript‎

Copy file name to clipboardExpand all lines: wscript
+11-8Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,7 @@ def build_v8(bld):
599599
bld.install_files('${PREFIX}/include/node/', 'deps/v8/include/*.h')
600600

601601
def sh_escape(s):
602-
return s.replace("(","\\(").replace(")","\\)").replace(" ","\\ ")
602+
return s.replace("\\", "\\\\").replace("(","\\(").replace(")","\\)").replace(" ","\\ ")
603603

604604
def uv_cmd(bld, variant):
605605
srcdeps = join(bld.path.abspath(), "deps")
@@ -610,8 +610,11 @@ def uv_cmd(bld, variant):
610610
# build directory before each compile. This could be much improved by
611611
# modifying libuv's build to send object files to a separate directory.
612612
#
613-
cmd = 'cp -r ' + sh_escape(srcdir) + '/* ' + sh_escape(blddir) + \
614-
' && if [[ -z "$NODE_MAKE" ]]; then NODE_MAKE=make; fi; $NODE_MAKE -C ' + sh_escape(blddir)
613+
cmd = 'cp -r ' + sh_escape(srcdir) + '/* ' + sh_escape(blddir)
614+
if not sys.platform.startswith('win32'):
615+
cmd += ' && if [[ -z "$NODE_MAKE" ]]; then NODE_MAKE=make; fi; $NODE_MAKE -C ' + sh_escape(blddir)
616+
else:
617+
cmd += ' && make -C ' + sh_escape(blddir)
615618
return cmd
616619

617620

@@ -834,14 +837,9 @@ def build(bld):
834837
src/node_javascript.cc
835838
src/node_extensions.cc
836839
src/node_http_parser.cc
837-
src/node_net.cc
838-
src/node_io_watcher.cc
839840
src/node_constants.cc
840-
src/node_cares.cc
841841
src/node_events.cc
842842
src/node_file.cc
843-
src/node_signal_watcher.cc
844-
src/node_stat_watcher.cc
845843
src/node_script.cc
846844
src/node_os.cc
847845
src/node_dtrace.cc
@@ -853,6 +851,11 @@ def build(bld):
853851
node.source += " src/node_stdio_win32.cc "
854852
node.source += " src/node_child_process_win32.cc "
855853
else:
854+
node.source += " src/node_cares.cc "
855+
node.source += " src/node_net.cc "
856+
node.source += " src/node_signal_watcher.cc "
857+
node.source += " src/node_stat_watcher.cc "
858+
node.source += " src/node_io_watcher.cc "
856859
node.source += " src/node_stdio.cc "
857860
node.source += " src/node_child_process.cc "
858861

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.