From 951a5bb0b567486fe6c8145af37c85fd17c6df05 Mon Sep 17 00:00:00 2001 From: Niv Sardi Date: Sat, 17 Jun 2017 16:57:01 -0300 Subject: [PATCH] flatpak bundles fur alles Signed-off-by: Niv Sardi --- dist/linux/butter.desktop | 9 ++ gulpfile.js | 70 ++++++++++--- package.json | 205 +++++++++++++++++++------------------- 3 files changed, 169 insertions(+), 115 deletions(-) create mode 100644 dist/linux/butter.desktop diff --git a/dist/linux/butter.desktop b/dist/linux/butter.desktop new file mode 100644 index 0000000000..723b66fb24 --- /dev/null +++ b/dist/linux/butter.desktop @@ -0,0 +1,9 @@ +[Desktop Entry] +Comment=Watch Movies and TV Shows instantly +Name=Butter +Exec=/app/share/butter/Butter %U +Icon=org.butterproject.Desktop +MimeType=application/x-bittorrent;x-scheme-handler/magnet; +StartupNotify=false +Categories=AudioVideo;Video;Network;Player;P2P; +Type=Application diff --git a/gulpfile.js b/gulpfile.js index 24056a06b4..c07b021b26 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -14,22 +14,23 @@ const nwVersion = '0.18.6', * dependencies * ***************/ const gulp = require('gulp'), - glp = require('gulp-load-plugins')(), - runSequence = require('run-sequence'), - del = require('del'), + glp = require('gulp-load-plugins')(), + runSequence = require('run-sequence'), + del = require('del'), - nwBuilder = require('nw-builder'), - currentPlatform = require('nw-builder/lib/detectCurrentPlatform.js'), + nwBuilder = require('nw-builder'), + currentPlatform = require('nw-builder/lib/detectCurrentPlatform.js'), - yargs = require('yargs'), - nib = require('nib'), - git = require('git-rev'), + yargs = require('yargs'), + nib = require('nib'), + git = require('git-rev'), - fs = require('fs'), - path = require('path'), - exec = require('child_process').exec, - spawn = require('child_process').spawn, - pkJson = require('./package.json'); + fs = require('fs'), + flatpak = require('flatpak-bundler'), + path = require('path'), + exec = require('child_process').exec, + spawn = require('child_process').spawn, + pkJson = require('./package.json'); /*********** @@ -302,6 +303,45 @@ gulp.task('nsis', () => { })).catch(console.log.bind(console)); }); +gulp.task('build-flatpak', () => { + return new Promise((accept, reject) => { + flatpak.bundle({ + id: 'org.butterproject.Desktop', + base: 'io.atom.electron.BaseApp', + baseFlatpakref: 'https://s3-us-west-2.amazonaws.com/electron-flatpak.endlessm.com/electron-base-app-master.flatpakref', + runtime: 'org.freedesktop.Platform', + runtimeVersion: '1.4', + runtimeFlatpakref: 'https://raw.githubusercontent.com/endlessm/flatpak-bundler/master/refs/freedesktop-runtime-1.4.flatpakref', + sdk: 'org.freedesktop.Sdk', + files: [ + [ './dist/linux/butter.desktop', '/share/applications/org.butterproject.Desktop.desktop'], + [ './src/app/images/icon.png', '/share/icons/org.butterproject.Desktop.png'], + [ releasesDir + '/Butter/linux64', '/share/butter' ] + ], + symlinks: [ + [ '/share/butter/Butter', '/bin/Butter' ] + ], + finishArgs: [ + '--share=ipc', '--socket=x11', + '--socket=pulseaudio', + '--filesystem=home', + '--share=network', + '--device=dri' + ] + }, { // Build options + arch: 'x86_64', + bundlePath: 'build/Butter/linux64-flatpak/butter-desktop_x86_64.flatpak', + gpgSign: 'CF953E76C24B9018' // Gpg key to sign with + }, function (error) { + if (error) { + reject(error); + } + console.log('Flatpak built successfully.'); + accept(true); + }); + }); +}); + // compile debian packages // TODO: https://www.npmjs.com/package/nobin-debian-installer gulp.task('deb', () => { @@ -457,6 +497,10 @@ gulp.task('test', (callback) => { runSequence('jshint', 'injectgit', 'css', callback); }); +gulp.task('flatpak', (callback) => ( + runSequence('build', 'build-flatpak', callback) +)) + //TODO: //setexecutable? //bower_clean diff --git a/package.json b/package.json index c6f62bf218..0fcb926010 100644 --- a/package.json +++ b/package.json @@ -1,104 +1,105 @@ { - "name": "Butter", - "companyName": "Butter Project", - "installIcon": "src/app/images/butter.ico", - "unInstallIcon": "src/app/images/butter_uninstall.ico", - "homepage": "http://butterproject.org/", - "bugs": "https://github.com/butterproject/butter-desktop/issues", - "repository": { - "type": "git", - "url": "https://github.com/butterproject/butter-desktop.git" - }, - "license": "GPL-3.0", - "main": "src/app/index.html", - "version": "0.3.8-5a", - "releaseName": "There's nothing on TV", - "scripts": { - "postinstall": "node_modules/.bin/bower install --config.interactive=false", - "postupdate": "node_modules/.bin/bower update --config.interactive=false", - "test": "gulp test" - }, - "engines": { - "npm": ">=3.0.0", - "node": ">=4.4.0" - }, - "window": { - "title": "Butter", - "icon": "src/app/images/icon.png", - "toolbar": false, - "frame": false, - "min_width": 960, - "min_height": 520, - "resizable": true, - "show": false, - "position": "center" - }, - "chromium-args": "--enable-node-worker", - "dependencies": { - "butter-provider": "0.6.0", - "butter-provider-ccc": "git+https://github.com/butterproviders/butter-provider-ccc", - "butter-provider-youtube": "git+https://github.com/butterproviders/butter-provider-youtube", - "butter-provider-vodo": "git+https://github.com/butterproviders/butter-provider-vodo", - "butter-provider-archive": "git+https://github.com/butterproviders/butter-provider-archive", - "adm-zip": "0.4.7", - "airplay-protocol": "^2.0.2", - "async": "2.x.x", - "bonjour": "^3.5.0", - "chromecasts": "1.9.0", - "defer-request": "0.0.3", - "dlnacasts": "0.1.0", - "i18n": "0.x.x", - "iconv-lite": "0.x.x", - "jschardet": "1.4.1", - "json-rpc2": "1.0.2", - "markdown": "0.5.x", - "memoizee": "0.x.x", - "mkdirp": "*", - "moment": ">=2.11.2", - "mv": "2.x.x", - "nedb": "1.4.0", - "node-captions": "0.4.6", - "node-webkit-fdialogs": "latest", - "nodecast-js": "^1.0.1", - "opensubtitles-api": "^3.1.0", - "q": "2.0.3", - "readdirp": "*", - "request": "2.x.x", - "rimraf": "2.x.x", - "sanitizer": "0.x.x", - "semver": "5.x.x", - "send": "0.14.2", - "strike-api": "0.2.0", - "tar": "2.2.1", - "temp": "0.x.x", - "webtorrent-health": "1.x.x", - "trakt.tv": "5.0.1", - "trakt.tv-ondeck": "5.0.1", - "trakt.tv-matcher": "5.0.0", - "trakt.tv-images": "5.0.0", - "underscore": "1.x.x", - "urijs": "1.x.x", - "webtorrent": "^0.98.0" - }, - "devDependencies": { - "bower": "^1.7.9", - "del": "^2.2.0", - "jshint": "^2.9.1", - "jshint-stylish": "^2.1.0", - "git-rev": "^0.2.1", - "gulp": "^3.9.0", - "gulp-stylus": "^2.3.1", - "gulp-tar": "^1.8.0", - "gulp-gzip": "^1.2.0", - "gulp-jshint": "^2.0.0", - "gulp-jsbeautifier": "^2.0.3", - "gulp-filter": "^4.0.0", - "gulp-load-plugins": "^1.2.0", - "guppy-pre-commit": "^0.4.0", - "nib": "^1.1.0", - "nw-builder": "^3.1.2", - "run-sequence": "^1.1.5", - "stylus": "^0.54.2", - "yargs": "^6.3.0" - } + "name": "Butter", + "companyName": "Butter Project", + "installIcon": "src/app/images/butter.ico", + "unInstallIcon": "src/app/images/butter_uninstall.ico", + "homepage": "http://butterproject.org/", + "bugs": "https://github.com/butterproject/butter-desktop/issues", + "repository": { + "type": "git", + "url": "https://github.com/butterproject/butter-desktop.git" + }, + "license": "GPL-3.0", + "main": "src/app/index.html", + "version": "0.3.8-5a", + "releaseName": "There's nothing on TV", + "scripts": { + "postinstall": "node_modules/.bin/bower install --config.interactive=false", + "postupdate": "node_modules/.bin/bower update --config.interactive=false", + "test": "gulp test" + }, + "engines": { + "npm": ">=3.0.0", + "node": ">=4.4.0" + }, + "window": { + "title": "Butter", + "icon": "src/app/images/icon.png", + "toolbar": false, + "frame": false, + "min_width": 960, + "min_height": 520, + "resizable": true, + "show": false, + "position": "center" + }, + "chromium-args": "--enable-node-worker", + "dependencies": { + "adm-zip": "0.4.7", + "airplay-protocol": "^2.0.2", + "async": "2.x.x", + "bonjour": "^3.5.0", + "butter-provider": "0.6.0", + "butter-provider-archive": "git+https://github.com/butterproviders/butter-provider-archive", + "butter-provider-ccc": "git+https://github.com/butterproviders/butter-provider-ccc", + "butter-provider-vodo": "git+https://github.com/butterproviders/butter-provider-vodo", + "butter-provider-youtube": "git+https://github.com/butterproviders/butter-provider-youtube", + "chromecasts": "1.9.0", + "defer-request": "0.0.3", + "dlnacasts": "0.1.0", + "flatpak-bundler": "^0.1.3", + "i18n": "0.x.x", + "iconv-lite": "0.x.x", + "jschardet": "1.4.1", + "json-rpc2": "1.0.2", + "markdown": "0.5.x", + "memoizee": "0.x.x", + "mkdirp": "*", + "moment": ">=2.11.2", + "mv": "2.x.x", + "nedb": "1.4.0", + "node-captions": "0.4.6", + "node-webkit-fdialogs": "latest", + "nodecast-js": "^1.0.1", + "opensubtitles-api": "^3.1.0", + "q": "2.0.3", + "readdirp": "*", + "request": "2.x.x", + "rimraf": "2.x.x", + "sanitizer": "0.x.x", + "semver": "5.x.x", + "send": "0.14.2", + "strike-api": "0.2.0", + "tar": "2.2.1", + "temp": "0.x.x", + "trakt.tv": "5.0.1", + "trakt.tv-images": "5.0.0", + "trakt.tv-matcher": "5.0.0", + "trakt.tv-ondeck": "5.0.1", + "underscore": "1.x.x", + "urijs": "1.x.x", + "webtorrent": "^0.98.0", + "webtorrent-health": "1.x.x" + }, + "devDependencies": { + "bower": "^1.7.9", + "del": "^2.2.0", + "jshint": "^2.9.1", + "jshint-stylish": "^2.1.0", + "git-rev": "^0.2.1", + "gulp": "^3.9.0", + "gulp-stylus": "^2.3.1", + "gulp-tar": "^1.8.0", + "gulp-gzip": "^1.2.0", + "gulp-jshint": "^2.0.0", + "gulp-jsbeautifier": "^2.0.3", + "gulp-filter": "^4.0.0", + "gulp-load-plugins": "^1.2.0", + "guppy-pre-commit": "^0.4.0", + "nib": "^1.1.0", + "nw-builder": "^3.1.2", + "run-sequence": "^1.1.5", + "stylus": "^0.54.2", + "yargs": "^6.3.0" + } }