From f1f061e1e3d5176e2ba3a88cbc4c04d3d48a6156 Mon Sep 17 00:00:00 2001 From: Attila Sukosd Date: Fri, 28 Aug 2015 09:31:55 +0200 Subject: [PATCH 1/2] Added target arch support Previously electron-prebuilt would download the prebuilt binaries for the architecture native to the platform. However there are cases where being able to download for another architecture is favourable. This patch adds support for setting the architecture through npm's --arch= parameter. (Issue #53) --- npm/install.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/npm/install.js b/npm/install.js index 3261c6958ac1..fac56ae5fab9 100755 --- a/npm/install.js +++ b/npm/install.js @@ -23,8 +23,11 @@ var paths = { if (!paths[platform]) throw new Error('Unknown platform: ' + platform) -// downloads if not cached -download({version: version}, extractFile) +if (process.env.npm_config_arch) { + download({version: version, arch: process.env.npm_config_arch}, extractFile) +} else { + download({version: version}, extractFile) +} // unzips and makes path.txt point at the correct executable function extractFile (err, zipPath) { From dd59736393ea4e477af4a6f4921e83270b98a69d Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Tue, 22 Sep 2015 10:34:52 -0700 Subject: [PATCH 2/2] Clean up target arch support based on pull request #55 comments. --- npm/README.md | 5 +++++ npm/install.js | 7 ++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/npm/README.md b/npm/README.md index 8d23ff6e78a4..c40ed94a1859 100644 --- a/npm/README.md +++ b/npm/README.md @@ -39,6 +39,11 @@ electron If you need to use an HTTP proxy you can [set these environment variables](https://github.com/request/request/tree/f0c4ec061141051988d1216c24936ad2e7d5c45d#controlling-proxy-behaviour-using-environment-variables) +If you want to change the architecture that is downloaded (e.g., `ia32` on an `x64` machine), you can use the `--arch` flag with npm install or set the `npm_config_arch` environment variable: +``` +npm install --arch=ia32 electron-prebuilt +``` + ## About Works on Mac, Windows and Linux OSes that Electron supports (e.g. Electron [does not support Windows XP](https://github.com/atom/electron/issues/691)). diff --git a/npm/install.js b/npm/install.js index fac56ae5fab9..034153b60566 100755 --- a/npm/install.js +++ b/npm/install.js @@ -23,11 +23,8 @@ var paths = { if (!paths[platform]) throw new Error('Unknown platform: ' + platform) -if (process.env.npm_config_arch) { - download({version: version, arch: process.env.npm_config_arch}, extractFile) -} else { - download({version: version}, extractFile) -} +// downloads if not cached +download({version: version, arch: process.env.npm_config_arch}, extractFile) // unzips and makes path.txt point at the correct executable function extractFile (err, zipPath) {