From e1fe270fd7788836b562cf0ddf179584c2ec9bdf Mon Sep 17 00:00:00 2001 From: Bert Belder Date: Thu, 8 Jan 2015 13:05:51 +0100 Subject: [PATCH] src: prefix ARCH and PLATFORM with NODE_ The PLATFORM preprocessor symbol is defined in node.gyp, and on Windows it's set to "win". This conflicts with a built-in preprocessor symbol with a different value ("win32"), which makes the linker(!) complain. Resolve this by renaming these symbols to NODE_ARCH and NODE_PLATFORM. PR-URL: https://github.com/iojs/io.js/pull/261 Reviewed-By: Ben Noordhuis --- node.gyp | 6 +++--- src/node.cc | 13 +++++++++---- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/node.gyp b/node.gyp index 10ca1bc..30a1bdf 100644 --- a/node.gyp +++ b/node.gyp @@ -164,11 +164,11 @@ ], 'defines': [ - 'NODE_WANT_INTERNALS=1', - 'ARCH="<(target_arch)"', - 'PLATFORM="<(OS)"', + 'NODE_ARCH="<(target_arch)"', + 'NODE_PLATFORM="<(OS)"', 'NODE_TAG="<(node_tag)"', 'NODE_V8_OPTIONS="<(node_v8_options)"', + 'NODE_WANT_INTERNALS=1', ], 'conditions': [ diff --git a/src/node.cc b/src/node.cc index 1a4b180..e900e61 100644 --- a/src/node.cc +++ b/src/node.cc @@ -2623,12 +2623,17 @@ void SetupProcessObject(Environment* env, #endif // process.arch - READONLY_PROPERTY(process, "arch", OneByteString(env->isolate(), ARCH)); + READONLY_PROPERTY(process, "arch", OneByteString(env->isolate(), NODE_ARCH)); // process.platform - READONLY_PROPERTY(process, - "platform", - OneByteString(env->isolate(), PLATFORM)); +#ifdef _WIN32 + // As determined by gyp, NODE_PLATFORM equals 'win' on windows. However + // for historic reasons process.platform should be 'win32'. + Local platform = OneByteString(env->isolate(), "win32"); +#else + Local platform = OneByteString(env->isolate(), NODE_PLATFORM); +#endif + READONLY_PROPERTY(process, "platform", platform); // process.argv Local arguments = Array::New(env->isolate(), argc); -- 2.7.4