Skip to content

Commit

Permalink
Use latest node, improve make.bat, fix windows build
Browse files Browse the repository at this point in the history
  • Loading branch information
SirAnthony committed Sep 11, 2018
1 parent f35373f commit a0c0fcd
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 14 deletions.
6 changes: 3 additions & 3 deletions nodejs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ dist/uws_%_57.node: $(src)
dist/uws_%_59.node: $(src)
NODE=targets/node-v9.2.0 ABI=59 make $*
dist/uws_%_64.node: $(src)
NODE=targets/node-v10.9.0 ABI=64 make $*
NODE=targets/node-v10.10.0 ABI=64 make $*
targets:
mkdir targets
curl https://nodejs.org/dist/v8.1.2/node-v8.1.2-headers.tar.gz | tar xz -C targets
curl https://nodejs.org/dist/v9.2.0/node-v9.2.0-headers.tar.gz | tar xz -C targets
curl https://nodejs.org/dist/v10.9.0/node-v10.9.0.tar.gz | tar xz -C targets
curl https://nodejs.org/dist/v10.10.0/node-v10.10.0.tar.gz | tar xz -C targets
linux:
g++ $(CPP_SHARED) -static-libstdc++ -static-libgcc -I $$NODE/include/node -I $$NODE/src -I $$NODE/deps/uv/include -I $$NODE/deps/v8/include -I $$NODE/deps/openssl/openssl/include -s -o dist/uws_linux_$$ABI.node
g++ $(CPP_SHARED) -static-libstdc++ -static-libgcc -I $$NODE/include/node -I $$NODE/src -I $$NODE/deps/uv/include -I $$NODE/deps/v8/include -I $$NODE/deps/openssl/openssl/include -I $$NODE/deps/zlib -s -o dist/uws_linux_$$ABI.node
darwin:
g++ $(CPP_SHARED) $(CPP_OSX) -I $$NODE/include/node -o dist/uws_darwin_$$ABI.node
.PHONY: clean
Expand Down
30 changes: 19 additions & 11 deletions nodejs/make.bat
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,26 +1,34 @@
call "%VS140COMNTOOLS%..\..\vc\vcvarsall.bat" amd64
set vspath="%VS140COMNTOOLS%..\"
if defined GYP_MSVS_OVERRIDE_PATH (
set vspath=%GYP_MSVS_OVERRIDE_PATH%
)

call "%vspath%..\vc\vcvarsall.bat" amd64

set v57=v8.1.2
set v59=v9.2.0
set v64=v10.10.0

if not exist targets (
mkdir targets
curl https://nodejs.org/dist/v8.1.2/node-v8.1.2-headers.tar.gz | tar xz -C targets
curl https://nodejs.org/dist/v8.1.2/win-x64/node.lib > targets/node-v8.1.2/node.lib
curl https://nodejs.org/dist/v9.2.0/node-v9.2.0-headers.tar.gz | tar xz -C targets
curl https://nodejs.org/dist/v9.2.0/win-x64/node.lib > targets/node-v9.2.0/node.lib
curl https://nodejs.org/dist/v10.6.0/node-v10.6.0-headers.tar.gz | tar xz -C targets
curl https://nodejs.org/dist/v10.6.0/win-x64/node.lib > targets/node-v10.6.0/node.lib
curl https://nodejs.org/dist/%v57%/node-%v57%-headers.tar.gz | tar xz -C targets
curl https://nodejs.org/dist/%v57%/win-x64/node.lib > targets/node-v8.1.2/node.lib
curl https://nodejs.org/dist/%v59%/node-%v59%-headers.tar.gz | tar xz -C targets
curl https://nodejs.org/dist/%v59%/win-x64/node.lib > targets/node-v9.2.0/node.lib
curl https://nodejs.org/dist/%v64%/node-%v64%.tar.gz | tar xz -C targets
curl https://nodejs.org/dist/%v64%/win-x64/node.lib > targets/node-v10.10.0/node.lib
)

cp README.md dist/README.md
cp ../uWebSockets/LICENSE dist/LICENSE
cp -r ../uWebSockets/src dist/
cp src/addon.cpp dist/src/addon.cpp
cp src/addon.h dist/src/addon.h
cp src/http.h dist/src/http.h
cp src/uws.js dist/uws.js

cl /I targets/node-v8.1.2/include/node /EHsc /Ox /LD /Fedist/uws_win32_57.node dist/src/*.cpp targets/node-v8.1.2/node.lib
cl /I targets/node-v9.2.0/include/node /EHsc /Ox /LD /Fedist/uws_win32_59.node dist/src/*.cpp targets/node-v9.2.0/node.lib
cl /I targets/node-v10.6.0/include/node /EHsc /Ox /LD /Fedist/uws_win32_64.node dist/src/*.cpp targets/node-v10.6.0/node.lib
cl /I targets/node-%v57%/include/node /EHsc /Ox /LD /Fedist/uws_win32_57.node dist/src/*.cpp targets/node-%v57%/node.lib
cl /I targets/node-%v59%/include/node /EHsc /Ox /LD /Fedist/uws_win32_59.node dist/src/*.cpp targets/node-%v59%/node.lib
cl /I targets/node-%v64%/src /I targets/node-%v64%/deps/uv/include /I targets/node-%v64%/deps/v8/include /I targets/node-%v64%/deps/openssl/openssl/include /I targets/node-%v64%/deps/zlib /EHsc /Ox /LD /Fedist/uws_win32_64.node dist/src/*.cpp targets/node-%v64%/node.lib

rm *.obj
rm dist/*.exp
Expand Down
20 changes: 20 additions & 0 deletions nodejs/src/addon.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,26 @@ class TLSWrapSSLGetter : public node::TLSWrap {
public:
SSL* getSSL(){ return this->ssl_.get(); }
};

#if defined(_MSC_VER)
NO_RETURN void node::Assert(const char* const (*args)[4]) {
auto filename = (*args)[0];
auto linenum = (*args)[1];
auto message = (*args)[2];
auto function = (*args)[3];

char name[1024];
char title[1024] = "Node.js";
uv_get_process_title(title, sizeof(title));
snprintf(name, sizeof(name), "%s[%d]", title, uv_os_getpid());

fprintf(stderr, "%s: %s:%s:%s%s Assertion `%s' failed.\n",
name, filename, linenum, function, *function ? ":" : "", message);
fflush(stderr);
ABORT_NO_BACKTRACE();
}
#endif

#undef NODE_WANT_INTERNALS
#endif

Expand Down

0 comments on commit a0c0fcd

Please sign in to comment.