Merge branch 'master' into add_package_rpm

This commit is contained in:
Julen Garcia Leunda
2019-09-16 22:13:41 +02:00
2 changed files with 25 additions and 18 deletions

View File

@@ -173,8 +173,8 @@ const linux = {
// Build for Linux. // Build for Linux.
platform: 'linux', platform: 'linux',
// Build x64 binary onle. // Build x64 and arm64 binaries.
arch: 'x64' arch: ['x64', 'arm64']
// Note: Application icon for Linux is specified via the BrowserWindow `icon` option. // Note: Application icon for Linux is specified via the BrowserWindow `icon` option.
} }
@@ -485,14 +485,21 @@ 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 === 'rpm' || argv.package === 'all') { if (argv.package === 'rpm' || argv.package === 'all') {
tasks.push((cb) => packageRpm(filesPath, cb)) tasks.push((cb) => packageRpm(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)
@@ -500,16 +507,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'),
@@ -522,23 +529,23 @@ 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 packageRpm (filesPath, cb) { function packageRpm (filesPath, destArch, cb) {
// Create .rpm file for RedHat-based platforms // Create .rpm file for RedHat-based platforms
console.log('Linux: Creating rpm...') console.log(`Linux: Creating ${destArch} rpm...`)
const installer = require('electron-installer-redhat') const installer = require('electron-installer-redhat')
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'),
@@ -551,22 +558,22 @@ function buildLinux (cb) {
installer(options).then( installer(options).then(
() => { () => {
console.log('Linux: Created rpm.') console.log(`Linux: Created ${destArch} rpm.`)
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)
} }
} }

View File

@@ -97,7 +97,7 @@
"url": "git://github.com/webtorrent/webtorrent-desktop.git" "url": "git://github.com/webtorrent/webtorrent-desktop.git"
}, },
"scripts": { "scripts": {
"build": "buble src --output build", "build": "buble src --target chrome:71 --output build",
"clean": "node ./bin/clean.js", "clean": "node ./bin/clean.js",
"gh-release": "gh-release", "gh-release": "gh-release",
"install-system-deps": "brew install fakeroot dpkg rpmbuild", "install-system-deps": "brew install fakeroot dpkg rpmbuild",