From 9f45799dd249878de8827d911a8e01bebcb4e4ba Mon Sep 17 00:00:00 2001 From: Vladimir Kurchatkin Date: Fri, 9 Jan 2015 15:38:09 +0300 Subject: [PATCH] build: fix `process.platform` e1fe270 introduces the NODE_PLATFORM macro which had to be redefined in node.gyp for `process.platform` to return expected values. PR-URL: https://github.com/iojs/io.js/pull/271 Reviewed-By: Ben Noordhuis Reviewed-By: Bert Belder --- node.gyp | 10 +++++----- src/node.cc | 11 +++-------- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/node.gyp b/node.gyp index 4362295..1063e18 100644 --- a/node.gyp +++ b/node.gyp @@ -325,7 +325,7 @@ 'defines': [ 'FD_SETSIZE=1024', # we need to use node's preferred "win32" rather than gyp's preferred "win" - 'PLATFORM="win32"', + 'NODE_PLATFORM="win32"', '_UNICODE=1', ], 'libraries': [ '-lpsapi.lib' ] @@ -337,11 +337,11 @@ # like Instruments require it for some features 'libraries': [ '-framework CoreFoundation' ], 'defines!': [ - 'PLATFORM="mac"', + 'NODE_PLATFORM="mac"', ], 'defines': [ # we need to use node's preferred "darwin" rather than gyp's preferred "mac" - 'PLATFORM="darwin"', + 'NODE_PLATFORM="darwin"', ], }], [ 'OS=="freebsd"', { @@ -356,12 +356,12 @@ '-lumem', ], 'defines!': [ - 'PLATFORM="solaris"', + 'NODE_PLATFORM="solaris"', ], 'defines': [ # we need to use node's preferred "sunos" # rather than gyp's preferred "solaris" - 'PLATFORM="sunos"', + 'NODE_PLATFORM="sunos"', ], }], [ 'OS=="freebsd" or OS=="linux"', { diff --git a/src/node.cc b/src/node.cc index 9b4fd87..9ffaab8 100644 --- a/src/node.cc +++ b/src/node.cc @@ -2625,14 +2625,9 @@ void SetupProcessObject(Environment* env, READONLY_PROPERTY(process, "arch", OneByteString(env->isolate(), NODE_ARCH)); // process.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); + READONLY_PROPERTY(process, + "platform", + OneByteString(env->isolate(), NODE_PLATFORM)); // process.argv Local arguments = Array::New(env->isolate(), argc); -- 2.7.4