Skip to content

Commit

Permalink
fix(AppImage): include libappindicator1 in AppImage
Browse files Browse the repository at this point in the history
Close #1082
  • Loading branch information
develar committed Jan 16, 2017
1 parent ecfdc65 commit df7d316
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
7 changes: 7 additions & 0 deletions docs/Options.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Don't customize paths to background and icon, — just follow conventions.
* [win Windows Specific Options](#WinBuildOptions)
* [dmg.window DMG Windows Position and Size](#DmgWindow)
* [snap [Snap](http://snapcraft.io) Specific Options](#SnapOptions)
* [appImage [AppImage](http://appimage.org) Specific Options](#AppImageOptions)
* [Fields in the package.json](#Metadata)

<a name="Config"></a>
Expand Down Expand Up @@ -235,6 +236,12 @@ To use Squirrel.Windows please install `electron-builder-squirrel-windows` depen
| stagePackages | <a name="SnapOptions-stagePackages"></a><p>The list of Ubuntu packages to use that are needed to support the <code>app</code> part creation. Like <code>depends</code> for <code>deb</code>. Defaults to <code>[&quot;libnotify4&quot;, &quot;libappindicator1&quot;, &quot;libxtst6&quot;, &quot;libnss3&quot;, &quot;libxss1&quot;, &quot;fontconfig-config&quot;, &quot;gconf2&quot;, &quot;libasound2&quot;]</code>.</p>
| ubuntuAppPlatformContent | <a name="SnapOptions-ubuntuAppPlatformContent"></a><p>Specify <code>ubuntu-app-platform1</code> to use [ubuntu-app-platform](https://insights.ubuntu.com/2016/11/17/how-to-create-snap-packages-on-qt-applications/). Snap size will be greatly reduced, but it is not recommended for now because “the snaps must be connected before running uitk-gallery for the first time”.</p>

<a name="AppImageOptions"></a>
### `appImage` [AppImage](http://appimage.org) Specific Options
| Name | Description
| --- | ---
| includeRequiredLib | <a name="AppImageOptions-includeRequiredLib"></a>Whether to include required system libraries (`gconf2`, `libappindicator1`). Defaults to `false`.

<a name="Metadata"></a>
## Fields in the package.json

Expand Down
10 changes: 10 additions & 0 deletions packages/electron-builder/src/options/linuxOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,14 @@ export interface SnapOptions extends LinuxBuildOptions {
Snap size will be greatly reduced, but it is not recommended for now because "the snaps must be connected before running uitk-gallery for the first time".
*/
ubuntuAppPlatformContent?: string | null
}

/*
### `appImage` [AppImage](http://appimage.org) Specific Options
*/
export interface AppImageOptions extends LinuxBuildOptions {
/*
Whether to include required system libraries (`gconf2`, `libappindicator1`). Defaults to `false`.
*/
includeRequiredLib?: boolean | null
}
8 changes: 7 additions & 1 deletion packages/electron-builder/src/targets/appImage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { LinuxPackager } from "../linuxPackager"
import { log } from "electron-builder-util/out/log"
import { Target, Arch } from "electron-builder-core"
import { unlinkIfExists } from "electron-builder-util/out/fs"
import { AppImageOptions } from "../options/linuxOptions"

const appImageVersion = process.platform === "darwin" ? "AppImage-09-07-16-mac" : "AppImage-09-07-16-linux"
//noinspection SpellCheckingInspection
Expand All @@ -17,7 +18,7 @@ const appImageSha256 = process.platform === "darwin" ? "5d4a954876654403698a01ef
const appImagePathPromise = getBin("AppImage", appImageVersion, `https://dl.bintray.com/electron-userland/bin/${appImageVersion}.7z`, appImageSha256)

export default class AppImageTarget extends Target {
private readonly options = Object.assign({}, this.packager.platformSpecificBuildOptions, (<any>this.packager.config)[this.name])
private readonly options: AppImageOptions = Object.assign({}, this.packager.platformSpecificBuildOptions, (<any>this.packager.config)[this.name])
private readonly desktopEntry: Promise<string>

constructor(ignored: string, private packager: LinuxPackager, private helper: LinuxTargetHelper, private outDir: string) {
Expand Down Expand Up @@ -62,6 +63,11 @@ export default class AppImageTarget extends Target {
}
args.push("-map", this.helper.maxIconPath, "/.DirIcon")

if (this.options.includeRequiredLib === true && arch === Arch.x64) {
const libDir = await getBin("AppImage-packages", "16.01.17", "https://bintray.com/electron-userland/bin/download_file?file_path=AppImage-packages-16.01.17-x64.7z", "4a2da2d718bc1f5c6ca2f3a58e0655f39e23450b43e20424679dedf9b9b1ecae")
args.push("-map", libDir, "/usr/lib")
}

args.push("-chown_r", "0", "/", "--")
args.push("-zisofs", `level=${packager.config.compression === "store" ? "0" : "9"}:block_size=128k:by_magic=off`)
args.push("set_filter_r", "--zisofs", "/")
Expand Down

0 comments on commit df7d316

Please sign in to comment.