Commit 63d11fbf authored by Gordon Ball's avatar Gordon Ball

New upstream version 4.6.0

parent 59dda5dc
......@@ -24,3 +24,5 @@ windows/lib/libzmq.lib
coverage
.nyc_output
coverage.lcov
package-lock.json
package-lock=false
language: node_js
sudo: false
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- gcc-4.9
- g++-4.9
node_js: "6"
sudo: required
matrix:
include:
- node_js: "6"
env: DEPLOY="true"
- node_js: "6"
env: ELECTRON="1.4.10"
- os: linux
dist: trusty
env:
- DEPLOY="true"
- MAIN="true"
- os: linux
dist: trusty
env:
- DEPLOY="true"
- ARCH="armv7"
- os: linux
dist: trusty
env:
- DEPLOY="true"
- ARCH="armv8"
- os: linux
dist: trusty
env:
- ELECTRON="1.4.10"
- os: osx
node_js: "6"
env: DEPLOY="true"
env:
- DEPLOY="true"
env:
global:
- GH_REF: github.com/nteract/zmq-prebuilt.git
......@@ -26,26 +35,28 @@ env:
before_install:
- export DISPLAY=':99.0'
- Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
- test "$(uname)" = "Darwin" || export CXX=g++-4.9 CC=gcc-4.9
- if [ -n "$ELECTRON" ]; then npm install electron@${ELECTRON}; fi
install:
- '[ -z "$ELECTRON" ] || npm install electron@${ELECTRON}'
- 'if [[ -z "$ELECTRON" ]]; then npm install; else npm install --runtime=electron --target=${ELECTRON} --disturl=https://atom.io/download/electron; fi'
- if [ -n "$ARCH" ]; then bash ./scripts/cross_compile.sh ${ARCH}; fi
- if [ -n "$ELECTRON" ]; then npm install --runtime=electron --target=${ELECTRON} --disturl=https://atom.io/download/electron; fi
- if [ -z "$ARCH" ] && [ -z "$ELECTRON" ]; then npm install; fi
script: if [[ -z "$ELECTRON" ]]; then travis_retry npm run coverage; else travis_retry npm run test:electron; fi
script:
- if [ -n "$ELECTRON" ]; then travis_retry npm run test:electron; fi
- if [ -z "$ARCH" ] && [ -z "$ELECTRON" ]; then travis_retry npm run coverage; fi
after_success:
- bash ./scripts/publish_docs.sh
- 'if [[ $DEPLOY == true && $TRAVIS_OS_NAME == linux ]]; then bash <(curl -s https://codecov.io/bash); fi'
- if [ "$MAIN" = "true" ]; then bash <(curl -s https://codecov.io/bash); fi
- if [ "$MAIN" = "true" ]; then bash ./scripts/publish_docs.sh; fi
deploy:
provider: script
skip_cleanup: true
# Linking to prebuild directly since it doesn't work inside a npm script.
script:
- node_modules/prebuild/bin.js --all --strip -u $GH_TOKEN
- if [ -z "$ARCH" ]; then ./node_modules/prebuild/bin.js --all --strip -u ${GH_TOKEN}; else bash ./scripts/cross_compile.sh ${ARCH} ${GH_TOKEN}; fi
on:
condition: "$DEPLOY = true"
condition: $DEPLOY = "true"
tags: true
notifications:
......
# zeromq
[![codecov](https://codecov.io/gh/zeromq/zeromq.js/branch/master/graph/badge.svg)](https://codecov.io/gh/zeromq/zeromq.js)
[![Greenkeeper badge](https://badges.greenkeeper.io/zeromq/zeromq.js.svg)](https://greenkeeper.io/)
[![](https://img.shields.io/badge/version-latest-blue.svg)](https://github.com/zeromq/zeromq.js)
[![Build Status](https://travis-ci.org/zeromq/zeromq.js.svg?branch=master)](https://travis-ci.org/zeromq/zeromq.js)
[![Build status](https://ci.appveyor.com/api/projects/status/6u7saauir2msxpou?svg=true)](https://ci.appveyor.com/project/zeromq/zeromq.js)
[![Build status](https://ci.appveyor.com/api/projects/status/6u7saauir2msxpou?svg=true)](https://ci.appveyor.com/project/zeromq/zeromq-js/branch/master)
[![](https://img.shields.io/badge/version-stable-blue.svg)](https://github.com/zeromq/zeromq.js/releases)
[![Build Status](https://travis-ci.org/zeromq/zeromq.js.svg?branch=prebuilt-testing)](https://travis-ci.org/zeromq/zeromq.js)
[![Build status](https://ci.appveyor.com/api/projects/status/w189dgubmg9darun/branch/master?svg=true)](https://ci.appveyor.com/project/zeromq/zeromq-js/branch/prebuilt-testing)
......@@ -21,9 +22,9 @@ source can lead to developer frustration.
application by providing well-tested, ready to use ØMQ bindings.
zeromq supports all major operating systems, including:
* OS X/Darwin 64-bit
* Linux 64-bit
* Windows (64-bit and 32-bit)
* OS X/Darwin (x64)
* Linux (x64, ARMv7 and ARMv8)
* Windows (x64 and x86)
Use **zeromq** and take advantage of the *elegant simplicity of binaries*.
......@@ -40,10 +41,30 @@ npm install zeromq
Now, prepare to be amazed by the wonders of binaries.
## Installation - From Source
To use your system's libzmq (if it has been installed and development headers
are available):
```bash
npm install zeromq --zmq-external
```
### Rebuilding for Electron
If you want to use `zeromq` inside your [Electron](http://electron.atom.io/) application
or if you are working on a Linux 32-bit system, you have to build `zeromq` from source.
it needs to be rebuild against Electron headers. We ship prebuilt binaries for Electron so you won't need to build `zeromq` from source.
You can rebuild `zeromq` manually by running:
```bash
npm rebuild zeromq --runtime=electron --target=1.4.5
```
Where `target` is your desired Electron version. This will download the correct binary for usage in Electron.
For packaging your Electron application we recommend using [`electron-builder`](https://github.com/electron-userland/electron-builder) which handles rebuilding automatically. Enable the `npmSkipBuildFromSource` option to make use of the prebuilt binaries. For a real world example take a look at [nteract](https://github.com/nteract/nteract/blob/master/package.json).
## Installation - From Source
If you are working on a Linux 32-bit system or want to install a developement version, you have to build `zeromq` from source.
### Prerequisites
......@@ -65,7 +86,7 @@ Use your distribution's package manager to install.
- **Option 2:** Install dependencies and configuration manually
1. Visual C++ Build Environment:
* **Option 1:** Install [Visual C++ Build Tools](http://go.microsoft.com/fwlink/?LinkId=691126) using the *Default Install* option.
* **Option 2:** Install [Visual Studio 2015](https://www.visualstudio.com/products/visual-studio-community-vs) (or modify an existing installation) and select *Common Tools for Visual C++* during setup.
* **Option 2:** Install [Visual Studio 2015](https://www.visualstudio.com/products/visual-studio-community-vs) (or modify an existing installation) and select *Common Tools for Visual C++* during setup.
> :bulb: [Windows Vista / 7 only] requires [.NET Framework 4.5.1](http://www.microsoft.com/en-us/download/details.aspx?id=40773)
......@@ -81,24 +102,6 @@ Now you can install `zeromq` with the following:
npm install zeromq
```
### Rebuilding for Electron
If you want to use `zeromq` inside your [Electron](http://electron.atom.io/) application
it needs to be rebuild against Electron headers.
We highly recommend [`electron-builder`](https://github.com/electron-userland/electron-builder)
which handles this automatically.
If you don't want to use `electron-builder` you can rebuild `zeromq` manually by running:
```
npm rebuild zeromq --runtime=electron --target=1.4.5 --disturl=https://atom.io/download/atom-shell --build-from-source
```
Where `target` is your desired Electron version.
You can find more information on the [Electron website](http://electron.atom.io/docs/tutorial/using-native-node-modules/).
## Installation - Contributors and Development
To set up `zeromq` for development, fork this repository and
......@@ -222,5 +225,6 @@ prebuilds are uploaded, run the following to publish the release:
npm publish
```
To check if the binaries are packaged correctly, you can push a commit to
[`nteract/zmq-prebuilt-testing`](https://github.com/nteract/zmq-prebuilt-testing).
## Background
This codebase largely came from the npm module `zmq` and was, at one point, named `nteract/zmq-prebuilt`. It started as a community run fork of `zmq` that fixed up the build process and automated prebuilt binaries. In the process of setting up a way to do statically compiled binaries of zeromq for node, `zmq-static` was created. Eventually `zmq-prebuilt` was able to do the job of `zmq-static` and it was deprecated. Once `zmq-prebuilt` was shipping for a while, allowed building from source, and suggesting people use it for electron + node.js, the repository moved to the zeromq org and it became official.
......@@ -340,6 +340,7 @@ namespace zmq {
}
Socket::~Socket() {
Unmonitor();
Close();
}
......@@ -434,12 +435,22 @@ namespace zmq {
return;
}
Local<Value> argv[3];
Local<Value> argv[4];
argv[0] = Nan::New<Integer>(event_id);
argv[1] = Nan::New<Integer>(event_value);
argv[2] = Nan::New<String>(event_endpoint).ToLocalChecked();
switch (event_id) {
case ZMQ_EVENT_BIND_FAILED:
case ZMQ_EVENT_ACCEPT_FAILED:
case ZMQ_EVENT_CLOSE_FAILED:
argv[3] = ExceptionFromError();
break;
default:
argv[3] = Nan::Undefined();
break;
}
Nan::MakeCallback(this->handle(), callback_v.As<Function>(), 3, argv);
Nan::MakeCallback(this->handle(), callback_v.As<Function>(), 4, argv);
}
void
......@@ -1533,7 +1544,14 @@ namespace zmq {
opts_binary.insert(50); // ZMQ_CURVE_SERVERKEY
opts_int.insert(51); //ZMQ_PROBE_ROUTER
opts_binary.insert(55); // ZMQ_ZAP_DOMAIN
opts_int.insert(56); // ZMQ_ROUTER_HANDOVER
opts_int.insert(66); //ZMQ_HANDSHAKE_IVL
#if ZMQ_VERSION_MINOR >= 2
opts_int.insert(75); //ZMQ_HEARTBEAT_IVL
opts_int.insert(76); //ZMQ_HEARTBEAT_TTL
opts_int.insert(77); //ZMQ_HEARTBEAT_TIMEOUT
opts_int.insert(79); //ZMQ_CONNECT_TIMEOUT
#endif
#endif
NODE_DEFINE_CONSTANT(target, ZMQ_CAN_DISCONNECT);
......
{
'variables': {
'zmq_external%': 'false',
},
'targets': [
{
'target_name': 'zmq',
'sources': [ 'binding.cc' ],
'sources': ['binding.cc'],
'include_dirs' : ["<!(node -e \"require('nan')\")"],
'cflags!': ['-fno-exceptions'],
'cflags_cc!': ['-fno-exceptions'],
'conditions': [
['OS=="win"', {
'msbuild_toolset': 'v140',
'defines': ['ZMQ_STATIC'],
'include_dirs': ['windows/include'],
'libraries': [
'<(PRODUCT_DIR)/../../windows/lib/libzmq',
'ws2_32.lib',
'iphlpapi'
],
}],
['OS=="mac" or OS=="solaris"', {
'xcode_settings': {
'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',
'MACOSX_DEPLOYMENT_TARGET': '10.9',
["zmq_external == 'true'", {
'link_settings': {
'libraries': ['-lzmq'],
},
'libraries': [ '<(PRODUCT_DIR)/../../zmq/lib/libzmq.a' ],
'include_dirs': [ '<(PRODUCT_DIR)/../../zmq/include' ],
}],
['OS=="openbsd" or OS=="freebsd"', {
}],
['OS=="linux"', {
'libraries': [ '<(PRODUCT_DIR)/../../zmq/lib/libzmq.a' ],
'include_dirs': [ '<(PRODUCT_DIR)/../../zmq/include' ],
}, {
'conditions': [
['OS=="win"', {
'msbuild_toolset': 'v140',
'defines': ['ZMQ_STATIC'],
'include_dirs': ['windows/include'],
'libraries': [
'<(PRODUCT_DIR)/../../windows/lib/libzmq',
'ws2_32.lib',
'iphlpapi',
],
}],
['OS=="mac" or OS=="solaris"', {
'xcode_settings': {
'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',
'MACOSX_DEPLOYMENT_TARGET': '10.9',
},
'libraries': ['<(PRODUCT_DIR)/../../zmq/lib/libzmq.a'],
'include_dirs': ['<(PRODUCT_DIR)/../../zmq/include'],
}],
['OS=="openbsd" or OS=="freebsd"', {
}],
['OS=="linux"', {
'libraries': ['<(PRODUCT_DIR)/../../zmq/lib/libzmq.a'],
'include_dirs': ['<(PRODUCT_DIR)/../../zmq/include'],
}],
],
}],
]
],
}
]
}
......@@ -93,8 +93,13 @@ var longOptions = {
, ZMQ_CURVE_SECRETKEY: 49
, ZMQ_CURVE_SERVERKEY: 50
, ZMQ_ZAP_DOMAIN: 55
, ZMQ_HEARTBEAT_IVL: 75
, ZMQ_HEARTBEAT_TTL: 76
, ZMQ_HEARTBEAT_TIMEOUT: 77
, ZMQ_CONNECT_TIMEOUT: 79
, ZMQ_IO_THREADS: 1
, ZMQ_MAX_SOCKETS: 2
, ZMQ_ROUTER_HANDOVER: 56
};
Object.keys(longOptions).forEach(function(name){
......@@ -138,6 +143,10 @@ var opts = exports.options = {
, curve_secretkey: zmq.ZMQ_CURVE_SECRETKEY
, curve_serverkey: zmq.ZMQ_CURVE_SERVERKEY
, zap_domain: zmq.ZMQ_ZAP_DOMAIN
, heartbeat_ivl: zmq.ZMQ_HEARTBEAT_IVL
, heartbeat_ttl: zmq.ZMQ_HEARTBEAT_TTL
, heartbeat_timeout: zmq.ZMQ_HEARTBEAT_TIMEOUT
, connect_timeout: zmq.ZMQ_CONNECT_TIMEOUT
};
/**
......@@ -530,8 +539,8 @@ Socket.prototype.monitor = function(interval, numOfEvents) {
if (zmq.ZMQ_CAN_MONITOR) {
var self = this;
self._zmq.onMonitorEvent = function(event_id, event_value, event_endpoint_addr) {
self.emit(events[event_id], event_value, event_endpoint_addr);
self._zmq.onMonitorEvent = function(event_id, event_value, event_endpoint_addr, ex) {
self.emit(events[event_id], event_value, event_endpoint_addr, ex);
}
self._zmq.onMonitorError = function(error) {
......@@ -623,20 +632,26 @@ Socket.prototype.send = function(msg, flags, cb) {
return this;
};
Socket.prototype._flushRead = function () {
var message = this._zmq.readv(); // can throw
if (!message) {
return false;
}
// Handle received message immediately to prevent memory leak in driver
Socket.prototype._emitMessage = function (message) {
if (message.length === 1) {
// hot path
this.emit('message', message[0]);
} else {
this.emit.apply(this, ['message'].concat(message));
}
}
Socket.prototype._flushRead = function () {
try {
var message = this._zmq.readv(); // can throw
if (!message) {
return false;
}
// Handle received message immediately to prevent memory leak in driver
this._emitMessage(message)
} catch (error) {
this.emit('error', error); // can throw
}
return true;
};
......@@ -669,17 +684,7 @@ Socket.prototype._flushReads = function() {
this._isFlushingReads = true;
var received;
do {
try {
received = this._flushRead();
} catch (error) {
this._isFlushingReads = false;
this.emit('error', error); // can throw
return;
}
} while (received);
while (this._flushRead());
this._isFlushingReads = false;
......@@ -780,26 +785,26 @@ function proxy (frontend, backend, capture){
case 'xpub/xsub':
if(capture){
frontend.on('message',function (msg){
backend.send(msg);
frontend.on('message',function (){
backend.send([].slice.call(arguments));
});
backend.on('message',function (msg){
frontend.send(msg);
backend.on('message',function (){
frontend.send([].slice.call(arguments));
//forwarding messages over capture socket
capture.send(msg);
capture.send([].slice.call(arguments));
});
} else {
//no capture socket provided, just forwarding msgs to respective sockets
frontend.on('message',function (msg){
backend.send(msg);
frontend.on('message',function (){
backend.send([].slice.call(arguments));
});
backend.on('message',function (msg){
frontend.send(msg);
backend.on('message',function (){
frontend.send([].slice.call(arguments));
});
}
......
{
"name": "zeromq",
"version": "4.0.0",
"version": "4.6.0",
"description": "Prebuilt bindings for node.js to ZeroMQ",
"main": "index",
"gypfile": true,
......@@ -9,23 +9,24 @@
"url": "https://github.com/zeromq/zeromq.js.git"
},
"dependencies": {
"nan": "^2.4.0",
"prebuild": "^5.0.0"
"nan": "^2.6.2",
"prebuild-install": "^2.2.2"
},
"devDependencies": {
"electron-mocha": "^3.2.1",
"jsdoc": "^3.4.2",
"mocha": "^3.2.0",
"nyc": "^10.0.0",
"semver": "^5.3.0",
"should": "^11.1.0"
"electron-mocha": "^4.0.0",
"jsdoc": "^3.5.4",
"mocha": "^3.5.0",
"nyc": "^11.1.0",
"prebuild": "^6.2.1",
"semver": "^5.4.1",
"should": "^12.0.0"
},
"engines": {
"node": ">=0.10"
},
"scripts": {
"build:libzmq": "node scripts/preinstall.js",
"install": "prebuild --install --preinstall \"npm run build:libzmq\"",
"install": "node scripts/prebuild-install.js || (node scripts/preinstall.js && node-gyp rebuild)",
"prebuild": "prebuild --all --strip",
"build:docs": "jsdoc -R README.md -d docs lib/*.js",
"postpublish": "./scripts/trigger_travis_build.sh",
......
......@@ -23,9 +23,9 @@ cd "${ZMQ_SRC_DIR}"
test -f configure || ./autogen.sh
if [ "$ZMQ" = "4.1.6" ]; then
./configure "--prefix=${ZMQ_PREFIX}" --with-relaxed --enable-static --disable-shared ;
./configure "--prefix=${ZMQ_PREFIX}" --with-relaxed --enable-static --disable-shared --without-documentation ${ZMQ_BUILD_OPTIONS}
else
./configure "--prefix=${ZMQ_PREFIX}" --disable-pedantic --enable-static --disable-shared ;
./configure "--prefix=${ZMQ_PREFIX}" --disable-pedantic --enable-static --disable-shared --without-docs ${ZMQ_BUILD_OPTIONS}
fi
make -j 2
make install
......
#!/bin/bash
ARCH=$1
GH_TOKEN=$2
if [[ "${ARCH}" == "armv7" ]]; then
TRIPLE="arm-linux-gnueabihf"
GCC="4.8"
elif [[ "${ARCH}" == "armv8" ]]; then
TRIPLE="aarch64-linux-gnu"
GCC="4.8"
else
exit 1
fi
PACKAGES="gcc-${GCC}-${TRIPLE} g++-${GCC}-${TRIPLE}"
export CC="${TRIPLE}-gcc-${GCC}"
export CXX="${TRIPLE}-g++-${GCC}"
export STRIP="${TRIPLE}-strip"
export ZMQ_BUILD_OPTIONS="--host=${TRIPLE}"
echo "Building zeromq.js for ${ARCH}"
if [[ -z $GH_TOKEN ]]; then
sudo apt-get -qq update
sudo apt-get install -y ${PACKAGES}
npm install "--arch=${TRIPLE}"
else
./node_modules/prebuild/bin.js "--arch=${ARCH}" --all --strip -u "${GH_TOKEN}"
fi
var https = require('https');
var fs = require('fs');
var url = require('url');
var https = require("https");
var fs = require("fs");
var url = require("url");
function writeToFile(filename, response, callback) {
response.pipe(fs.createWriteStream(filename));
response.on('end', callback)
response.on("end", callback);
}
function download(fileUrl, filename, callback) {
https.get(fileUrl, function(response) {
if (response.statusCode > 300 && response.statusCode < 400 && response.headers.location) {
if (url.parse(response.headers.location).hostname) {
https.get(response.headers.location, function(res) {
writeToFile(filename, res, callback);
});
https
.get(fileUrl, function(response) {
if (
response.statusCode > 300 &&
response.statusCode < 400 &&
response.headers.location
) {
if (url.parse(response.headers.location).hostname) {
https.get(response.headers.location, function(res) {
writeToFile(filename, res, callback);
});
} else {
https
.get(
url.resolve(
url.parse(fileUrl).hostname,
response.headers.location
),
function(res) {
writeToFile(filename, res, callback);
}
)
.on("error", callback);
}
} else {
https.get(url.resolve(url.parse(fileUrl).hostname, response.headers.location), function(res) {
writeToFile(filename, res, callback);
});
writeToFile(filename, response, callback);
}
} else {
writeToFile(filename, response, callback);
}
});
})
.on("error", callback);
}
module.exports = {
......
var exec = require('child_process').exec;
var pbi = 'prebuild-install';
var platform = process.platform;
var arch = process.arch;
if (process.env.npm_config_zmq_external == "true") {
console.log('Requested to use external libzmq. Skipping download of prebuilt binaries.');
process.exit(1);
}
if (
platform === 'linux' &&
(arch === 'arm' || arch === 'arm64')
) {
var armv = (arch === 'arm64') ? '8' : process.config.variables.arm_version;
pbi += ' --arch=armv' + armv;
}
exec(pbi, function(err, stdout, stderr) {
console.log(stdout);
console.log(stderr);
if (err) process.exit(1);
});
var download = require('./download').download;
var spawn = require('child_process').spawn;
var path = require('path');
var fs = require('fs');
var download = require("./download").download;
var spawn = require("child_process").spawn;
var path = require("path");
var fs = require("fs");
var ZMQ;
var ZMQ_REPO;
if (process.platform == 'linux') {
ZMQ = '4.1.6';
ZMQ_REPO = 'zeromq4-1';
} else {
ZMQ = '4.2.0';
ZMQ_REPO = 'libzmq';
var ZMQ = "4.2.2";
var ZMQ_REPO = "libzmq";
if (process.env.npm_config_zmq_external == "true") {
console.log("Requested to use external libzmq. Skipping libzmq build");
process.exit(0);
}
function buildZMQ(scriptPath, zmqDir) {
console.log('Building libzmq for ' + process.platform);
console.log("Building libzmq for " + process.platform);
var child = spawn(scriptPath, [ZMQ]);
child.stdout.pipe(process.stdout);
child.stderr.pipe(process.stderr);
child.on('error', function(err) {
console.error('Failed to start child process.');
child.on("error", function(err) {
console.error("Failed to start child process.");
});
child.on('close', function(code) {
child.on("close", function(code) {
if (code !== 0) {
return console.error('child process exited with code ' + code);
return console.error("child process exited with code " + code);
}
var message = 'Succesfully build libzmq on ' + Date();
fs.writeFile(path.join(zmqDir, 'BUILD_SUCCESS'), message, function(err) {
var message = "Succesfully build libzmq on " + Date();
fs.writeFile(path.join(zmqDir, "BUILD_SUCCESS"), message, function(err) {
if (err) {
return console.error(err.message);
}
console.log(message);
});
});
});
}
function handleError(err) {
if (!err) {
return;
}
console.error(err);
if (err.code === "ECONNRESET") {
console.error("\n** Your connection was reset. **");
console.error(
"\n** Are you behind a proxy or a firewall that is preventing a connection? **"
);
}
process.exit(1);
}
if (process.platform === 'win32') {
var LIB_URL = 'https://github.com/nteract/libzmq-win/releases/download/v2.0.0/libzmq-' + ZMQ + '-' + process.arch + '.lib';
var DIR_NAME = path.join(__dirname, '..', 'windows', 'lib');
var FILE_NAME = path.join(DIR_NAME, 'libzmq.lib');
if (process.platform === "win32") {
var LIB_URL =
"https://github.com/nteract/libzmq-win/releases/download/v2.1.0/libzmq-" +
ZMQ +
"-" +
process.arch +
".lib";
var DIR_NAME = path.join(__dirname, "..", "windows", "lib");
var FILE_NAME = path.join(DIR_NAME, "libzmq.lib");
if (!fs.existsSync(DIR_NAME)) {
fs.mkdirSync(DIR_NAME);
}
if (!fs.existsSync(FILE_NAME)) {
console.log('Downloading libzmq for Windows');
download(LIB_URL, FILE_NAME, function() {
console.log('Download finished');
console.log("Downloading libzmq for Windows");
download(LIB_URL, FILE_NAME, function(err) {
if (err) {
handleError(err);
}
console.log("Download finished");
});
}
} else {
var SCRIPT_PATH = path.join(__dirname, 'build_libzmq.sh');
var TAR_URL = 'https://github.com/zeromq/' + ZMQ_REPO + '/releases/download/v' + ZMQ + '/zeromq-' + ZMQ + '.tar.gz';
var DIR_NAME = path.join(__dirname, '..', 'zmq');
var FILE_NAME = path.join(DIR_NAME, 'zeromq-' + ZMQ + '.tar.gz');
var SCRIPT_PATH = path.join(__dirname, "build_libzmq.sh");
var TAR_URL =
"https://github.com/zeromq/" +
ZMQ_REPO +
"/releases/download/v" +
ZMQ +
"/zeromq-" +
ZMQ +
".tar.gz";
var DIR_NAME = path.join(__dirname, "..", "zmq");
var FILE_NAME = path.join(DIR_NAME, "zeromq-" + ZMQ + ".tar.gz");
if (!fs.existsSync(DIR_NAME)) {
fs.mkdirSync(DIR_NAME);
}
if (fs.existsSync(path.join(DIR_NAME, 'BUILD_SUCCESS'))) {
return console.log('Libzmq found, skipping rebuild.');
if (fs.existsSync(path.join(DIR_NAME, "BUILD_SUCCESS"))) {
console.log("Libzmq found, skipping rebuild.");