From 39d04c4b2af0662b8c731103dd05f56200832705 Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Sun, 15 Sep 2019 12:30:30 -0700 Subject: [PATCH] Add linux arm64 build (Fixes for PR #1650) --- bin/package.js | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/bin/package.js b/bin/package.js index 6cb22c2a..5f401658 100755 --- a/bin/package.js +++ b/bin/package.js @@ -485,11 +485,18 @@ function buildLinux (cb) { const tasks = [] buildPath.forEach(function (filesPath) { + let destArch = filesPath.split('-').pop() + + // Linux convention for 'x64' is 'amd64' + if (destArch === 'x64') { + destArch = 'amd64' + } + if (argv.package === 'deb' || argv.package === 'all') { - tasks.push((cb) => packageDeb(filesPath, cb)) + tasks.push((cb) => packageDeb(filesPath, destArch, cb)) } if (argv.package === 'zip' || argv.package === 'all') { - tasks.push((cb) => packageZip(filesPath, cb)) + tasks.push((cb) => packageZip(filesPath, destArch, cb)) } }) series(tasks, cb) @@ -497,16 +504,16 @@ function buildLinux (cb) { cb(err) }) - function packageDeb (filesPath, cb) { + function packageDeb (filesPath, destArch, cb) { // Create .deb file for Debian-based platforms - console.log('Linux: Creating deb...') + console.log(`Linux: Creating ${destArch} deb...`) const installer = require('electron-installer-debian') const options = { src: filesPath + '/', dest: DIST_PATH, - arch: 'amd64', + arch: destArch, bin: 'WebTorrent', icon: { '48x48': path.join(config.STATIC_PATH, 'linux/share/icons/hicolor/48x48/apps/webtorrent-desktop.png'), @@ -519,22 +526,22 @@ function buildLinux (cb) { installer(options).then( () => { - console.log('Linux: Created deb.') + console.log(`Linux: Created ${destArch} deb.`) cb(null) }, (err) => cb(err) ) } - function packageZip (filesPath, cb) { + function packageZip (filesPath, destArch, cb) { // Create .zip file for Linux - console.log('Linux: Creating zip...') + console.log(`Linux: Creating ${destArch} zip...`) const inPath = path.join(DIST_PATH, path.basename(filesPath)) - const outPath = path.join(DIST_PATH, BUILD_NAME + '-linux.zip') + const outPath = path.join(DIST_PATH, `${BUILD_NAME}-linux-${destArch}.zip`) zip.zipSync(inPath, outPath) - console.log('Linux: Created zip.') + console.log(`Linux: Created ${destArch} zip.`) cb(null) } }