Add linux arm64 build (Fixes for PR #1650) (#1696)

Add linux arm64 build (Fixes for PR #1650)
This commit is contained in:
Feross Aboukhadijeh
2019-09-15 14:50:14 -07:00
committed by GitHub

View File

@@ -485,11 +485,18 @@ function buildLinux (cb) {
const tasks = [] const tasks = []
buildPath.forEach(function (filesPath) { 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') { 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') { if (argv.package === 'zip' || argv.package === 'all') {
tasks.push((cb) => packageZip(filesPath, cb)) tasks.push((cb) => packageZip(filesPath, destArch, cb))
} }
}) })
series(tasks, cb) series(tasks, cb)
@@ -497,16 +504,16 @@ function buildLinux (cb) {
cb(err) cb(err)
}) })
function packageDeb (filesPath, cb) { function packageDeb (filesPath, destArch, cb) {
// Create .deb file for Debian-based platforms // 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 installer = require('electron-installer-debian')
const options = { const options = {
src: filesPath + '/', src: filesPath + '/',
dest: DIST_PATH, dest: DIST_PATH,
arch: 'amd64', arch: destArch,
bin: 'WebTorrent', bin: 'WebTorrent',
icon: { icon: {
'48x48': path.join(config.STATIC_PATH, 'linux/share/icons/hicolor/48x48/apps/webtorrent-desktop.png'), '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( installer(options).then(
() => { () => {
console.log('Linux: Created deb.') console.log(`Linux: Created ${destArch} deb.`)
cb(null) cb(null)
}, },
(err) => cb(err) (err) => cb(err)
) )
} }
function packageZip (filesPath, cb) { function packageZip (filesPath, destArch, cb) {
// Create .zip file for Linux // 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 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) zip.zipSync(inPath, outPath)
console.log('Linux: Created zip.') console.log(`Linux: Created ${destArch} zip.`)
cb(null) cb(null)
} }
} }