From e2f3465dd4e7dbb2c6aeb00ea867668b1783c883 Mon Sep 17 00:00:00 2001 From: Michael Lumish Date: Wed, 27 Jan 2016 16:41:54 -0800 Subject: Make Node library build on Windows --- .gitignore | 4 ++++ binding.gyp | 47 ++++++++++++++++++++++++++++++++--------------- src/node/ext/node_grpc.cc | 4 ++-- 3 files changed, 38 insertions(+), 17 deletions(-) diff --git a/.gitignore b/.gitignore index cc70659661..7652908e5c 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,10 @@ htmlcov/ dist/ *.egg +# Node installation output +node_modules/ +src/node/extension_binary/ + # gcov coverage data reports coverage diff --git a/binding.gyp b/binding.gyp index b1c0214d5f..d0932da957 100644 --- a/binding.gyp +++ b/binding.gyp @@ -37,29 +37,46 @@ # Some of this file is built with the help of # https://n8.io/converting-a-c-library-to-gyp/ { - 'variables': { - 'config': '0. - # io.js always reports versions >0 and always exports ALPN symbols. - # Therefore, Node's major version will be truthy if and only if it - # supports ALPN. The output of "node -v" is v[major].[minor].[patch], - # like "v4.1.1" in a recent version. We use cut to split by period and - # take the first field (resulting in "v[major]"), then use cut again - # to take all but the first character, removing the "v". - 'defines': [ - 'TSI_OPENSSL_ALPN_SUPPORT=0. + # io.js always reports versions >0 and always exports ALPN symbols. + # Therefore, Node's major version will be truthy if and only if it + # supports ALPN. The output of "node -v" is v[major].[minor].[patch], + # like "v4.1.1" in a recent version. We use cut to split by period and + # take the first field (resulting in "v[major]"), then use cut again + # to take all but the first character, removing the "v". + 'defines': [ + 'TSI_OPENSSL_ALPN_SUPPORT= exports) { Nan::Set(exports, Nan::New("callError").ToLocalChecked(), call_error); Local OK(Nan::New(GRPC_CALL_OK)); Nan::Set(call_error, Nan::New("OK").ToLocalChecked(), OK); - Local ERROR(Nan::New(GRPC_CALL_ERROR)); - Nan::Set(call_error, Nan::New("ERROR").ToLocalChecked(), ERROR); + Local CALL_ERROR(Nan::New(GRPC_CALL_ERROR)); + Nan::Set(call_error, Nan::New("ERROR").ToLocalChecked(), CALL_ERROR); Local NOT_ON_SERVER( Nan::New(GRPC_CALL_ERROR_NOT_ON_SERVER)); Nan::Set(call_error, Nan::New("NOT_ON_SERVER").ToLocalChecked(), -- cgit v1.2.3 From af6c1785fe7cab40ae54cc99338c6e75e976ba6f Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Thu, 28 Jan 2016 13:14:24 -0800 Subject: Update template, add comment and message about Windows build --- binding.gyp | 43 +++++++++++++++++---------- templates/binding.gyp.template | 67 ++++++++++++++++++++++++++++++------------ 2 files changed, 77 insertions(+), 33 deletions(-) diff --git a/binding.gyp b/binding.gyp index d0932da957..eacc7c44f6 100644 --- a/binding.gyp +++ b/binding.gyp @@ -37,7 +37,6 @@ # Some of this file is built with the help of # https://n8.io/converting-a-c-library-to-gyp/ { - # TODO: Finish windows support 'target_defaults': { 'include_dirs': [ '.', @@ -64,16 +63,16 @@ "ws2_32" ] }, { # OS != "win" - # Empirically, Node only exports ALPN symbols if its major version is >0. - # io.js always reports versions >0 and always exports ALPN symbols. - # Therefore, Node's major version will be truthy if and only if it - # supports ALPN. The output of "node -v" is v[major].[minor].[patch], - # like "v4.1.1" in a recent version. We use cut to split by period and - # take the first field (resulting in "v[major]"), then use cut again - # to take all but the first character, removing the "v". - 'defines': [ - 'TSI_OPENSSL_ALPN_SUPPORT=0. + # io.js always reports versions >0 and always exports ALPN symbols. + # Therefore, Node's major version will be truthy if and only if it + # supports ALPN. The output of "node -v" is v[major].[minor].[patch], + # like "v4.1.1" in a recent version. We use cut to split by period and + # take the first field (resulting in "v[major]"), then use cut again + # to take all but the first character, removing the "v". + 'defines': [ + 'TSI_OPENSSL_ALPN_SUPPORT=0. - # io.js always reports versions >0 and always exports ALPN symbols. - # Therefore, Node's major version will be truthy if and only if it - # supports ALPN. The output of "node -v" is v[major].[minor].[patch], - # like "v4.1.1" in a recent version. We use cut to split by period and - # take the first field (resulting in "v[major]"), then use cut again - # to take all but the first character, removing the "v". - 'defines': [ - 'TSI_OPENSSL_ALPN_SUPPORT=0. + # io.js always reports versions >0 and always exports ALPN symbols. + # Therefore, Node's major version will be truthy if and only if it + # supports ALPN. The output of "node -v" is v[major].[minor].[patch], + # like "v4.1.1" in a recent version. We use cut to split by period and + # take the first field (resulting in "v[major]"), then use cut again + # to take all but the first character, removing the "v". + 'defines': [ + 'TSI_OPENSSL_ALPN_SUPPORT= Date: Thu, 28 Jan 2016 14:53:33 -0800 Subject: Fixed windows build warning --- binding.gyp | 11 +++++++++-- templates/binding.gyp.template | 11 +++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/binding.gyp b/binding.gyp index eacc7c44f6..651c2e13af 100644 --- a/binding.gyp +++ b/binding.gyp @@ -118,10 +118,17 @@ # when including the Node headers. The remedy for this is to remove # the OpenSSL headers, from the downloaded Node development package, # which is typically located in `.node-gyp` in your home directory. - 'target_name': 'windows_build_warning', + 'target_name': 'WINDOWS_BUILD_WARNING', 'actions': [ { - 'message': "IMPORTANT: Due to https://github.com/nodejs/node/issues/4932, to build this library on Windows, you must first remove <(node_root_dir)/include/node/openssl/" + 'action_name': 'WINDOWS_BUILD_WARNING', + 'inputs': [ + 'package.json' + ], + 'outputs': [ + 'ignore_this_part' + ], + 'action': ['echo', 'IMPORTANT: Due to https://github.com/nodejs/node/issues/4932, to build this library on Windows, you must first remove <(node_root_dir)/include/node/openssl/'] } ] }, diff --git a/templates/binding.gyp.template b/templates/binding.gyp.template index 650670b750..a913585240 100644 --- a/templates/binding.gyp.template +++ b/templates/binding.gyp.template @@ -120,10 +120,17 @@ # when including the Node headers. The remedy for this is to remove # the OpenSSL headers, from the downloaded Node development package, # which is typically located in `.node-gyp` in your home directory. - 'target_name': 'windows_build_warning', + 'target_name': 'WINDOWS_BUILD_WARNING', 'actions': [ { - 'message': "IMPORTANT: Due to https://github.com/nodejs/node/issues/4932, to build this library on Windows, you must first remove <(node_root_dir)/include/node/openssl/" + 'action_name': 'WINDOWS_BUILD_WARNING', + 'inputs': [ + 'package.json' + ], + 'outputs': [ + 'ignore_this_part' + ], + 'action': ['echo', 'IMPORTANT: Due to https://github.com/nodejs/node/issues/4932, to build this library on Windows, you must first remove <(node_root_dir)/include/node/openssl/'] } ] }, -- cgit v1.2.3