From f637738730d87852daddaeb111a85a954064151e Mon Sep 17 00:00:00 2001 From: Grant Nestor Date: Mon, 10 Oct 2016 23:21:49 -0700 Subject: [PATCH 1/5] Use download-zmq.js to download zeromq vs. wget --- build_libzmq.sh | 2 +- download-zmq.js | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 download-zmq.js diff --git a/build_libzmq.sh b/build_libzmq.sh index 7964a624..721b21fc 100755 --- a/build_libzmq.sh +++ b/build_libzmq.sh @@ -17,7 +17,7 @@ export CFLAGS=-fPIC export CXXFLAGS=-fPIC export PKG_CONFIG_PATH=$ZMQ_PREFIX/lib/pkgconfig -test -f zeromq-$ZMQ.tar.gz || wget https://github.com/$ZMQ_REPO/releases/download/v$ZMQ/zeromq-$ZMQ.tar.gz -O zeromq-$ZMQ.tar.gz +test -f zeromq-$ZMQ.tar.gz || ZMQ=$ZMQ ZMQ_REPO=$ZMQ_REPO node "$(dirname $(realpath $0))/download-zmq.js" test -d $ZMQ_SRC_DIR || tar xzf zeromq-$ZMQ.tar.gz cd $ZMQ_SRC_DIR diff --git a/download-zmq.js b/download-zmq.js new file mode 100644 index 00000000..bffd6939 --- /dev/null +++ b/download-zmq.js @@ -0,0 +1,7 @@ +var https = require('https'); +var fs = require('fs'); + +var file = fs.createWriteStream('zeromq-' + process.env.ZMQ + '.tar.gz'); +var request = https.get('https://github.com/' + process.env.ZMQ_REPO + '/releases/download/v' + process.env.ZMQ + '/zeromq-' + process.env.ZMQ + '.tar.gz', function(response) { + response.pipe(file); +}); From 5131964015d10ee3a4131dfa3e831552e45b15a6 Mon Sep 17 00:00:00 2001 From: Grant Nestor Date: Wed, 12 Oct 2016 11:48:36 -0700 Subject: [PATCH 2/5] Follow redirect in download-zmq.js --- download-zmq.js | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/download-zmq.js b/download-zmq.js index bffd6939..21e971c8 100644 --- a/download-zmq.js +++ b/download-zmq.js @@ -1,7 +1,22 @@ var https = require('https'); var fs = require('fs'); +var url = require('url'); -var file = fs.createWriteStream('zeromq-' + process.env.ZMQ + '.tar.gz'); -var request = https.get('https://github.com/' + process.env.ZMQ_REPO + '/releases/download/v' + process.env.ZMQ + '/zeromq-' + process.env.ZMQ + '.tar.gz', function(response) { - response.pipe(file); +var TAR_URL = 'https://github.com/' + process.env.ZMQ_REPO + '/releases/download/v' + process.env.ZMQ + '/zeromq-' + process.env.ZMQ + '.tar.gz'; +var FILE_NAME = 'zeromq-' + process.env.ZMQ + '.tar.gz'; + +function writeToFile(response) { + response.pipe(fs.createWriteStream(FILE_NAME)); +} + +https.get(TAR_URL, function(response) { + if (response.statusCode > 300 && response.statusCode < 400 && response.headers.location) { + if (url.parse(response.headers.location).hostname) { + https.get(response.headers.location, writeToFile); + } else { + https.get(url.resolve(url.parse(TAR_URL).hostname, response.headers.location), writeToFile); + } + } else { + writeToFile(response); + } }); From 65ab7372f52eb94031588d024f8aa737daede3fb Mon Sep 17 00:00:00 2001 From: Lukas Geiger Date: Fri, 14 Oct 2016 19:45:06 +0200 Subject: [PATCH 3/5] Redirect node output to zmq-build.log --- build_libzmq.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_libzmq.sh b/build_libzmq.sh index 721b21fc..93769195 100755 --- a/build_libzmq.sh +++ b/build_libzmq.sh @@ -17,7 +17,7 @@ export CFLAGS=-fPIC export CXXFLAGS=-fPIC export PKG_CONFIG_PATH=$ZMQ_PREFIX/lib/pkgconfig -test -f zeromq-$ZMQ.tar.gz || ZMQ=$ZMQ ZMQ_REPO=$ZMQ_REPO node "$(dirname $(realpath $0))/download-zmq.js" +test -f zeromq-$ZMQ.tar.gz || ZMQ=$ZMQ ZMQ_REPO=$ZMQ_REPO node "$(dirname $(realpath $0))/download-zmq.js" 2>&1 > ../zmq-build.log test -d $ZMQ_SRC_DIR || tar xzf zeromq-$ZMQ.tar.gz cd $ZMQ_SRC_DIR From 293b7e2e2e72c276cc68fd25a56a513687d5ab93 Mon Sep 17 00:00:00 2001 From: Lukas Geiger Date: Fri, 14 Oct 2016 19:46:47 +0200 Subject: [PATCH 4/5] Fix path to download script --- build_libzmq.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_libzmq.sh b/build_libzmq.sh index 93769195..a229f013 100755 --- a/build_libzmq.sh +++ b/build_libzmq.sh @@ -17,7 +17,7 @@ export CFLAGS=-fPIC export CXXFLAGS=-fPIC export PKG_CONFIG_PATH=$ZMQ_PREFIX/lib/pkgconfig -test -f zeromq-$ZMQ.tar.gz || ZMQ=$ZMQ ZMQ_REPO=$ZMQ_REPO node "$(dirname $(realpath $0))/download-zmq.js" 2>&1 > ../zmq-build.log +test -f zeromq-$ZMQ.tar.gz || ZMQ=$ZMQ ZMQ_REPO=$ZMQ_REPO node ../download-zmq.js 2>&1 > ../zmq-build.log test -d $ZMQ_SRC_DIR || tar xzf zeromq-$ZMQ.tar.gz cd $ZMQ_SRC_DIR From 29ee69d0c5d6750e310804413d28535bf724c7e8 Mon Sep 17 00:00:00 2001 From: Lukas Geiger Date: Fri, 14 Oct 2016 20:08:31 +0200 Subject: [PATCH 5/5] Update README --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index 4c404dd7..773c9629 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,6 @@ clone your fork to your system. Be sure you have [`git-lfs`](https://git-lfs.git **Prerequisites for Linux** - `python` (`v2.7` recommended, `v3.x.x` is not supported) - `make` -- `wget` - A proper C/C++ compiler toolchain, like [GCC](https://gcc.gnu.org/) Use your distribution's package manager to install. @@ -67,7 +66,6 @@ Use your distribution's package manager to install. - `python` (`v2.7` recommended, `v3.x.x` is not supported): already installed on Mac OS X - `Xcode Command Line Tools`: Can be installed with `xcode-select --install` -- `wget`: Can be installed via [Homebrew](http://brew.sh) with `brew install wget` **Prerequisites for Windows**