Skip to content

Commit df7d316

Browse files
committed
fix(AppImage): include libappindicator1 in AppImage
Close #1082
1 parent ecfdc65 commit df7d316

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

docs/Options.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ Don't customize paths to background and icon, — just follow conventions.
3939
* [win Windows Specific Options](#WinBuildOptions)
4040
* [dmg.window DMG Windows Position and Size](#DmgWindow)
4141
* [snap [Snap](http://snapcraft.io) Specific Options](#SnapOptions)
42+
* [appImage [AppImage](http://appimage.org) Specific Options](#AppImageOptions)
4243
* [Fields in the package.json](#Metadata)
4344

4445
<a name="Config"></a>
@@ -235,6 +236,12 @@ To use Squirrel.Windows please install `electron-builder-squirrel-windows` depen
235236
| 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>
236237
| 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>
237238

239+
<a name="AppImageOptions"></a>
240+
### `appImage` [AppImage](http://appimage.org) Specific Options
241+
| Name | Description
242+
| --- | ---
243+
| includeRequiredLib | <a name="AppImageOptions-includeRequiredLib"></a>Whether to include required system libraries (`gconf2`, `libappindicator1`). Defaults to `false`.
244+
238245
<a name="Metadata"></a>
239246
## Fields in the package.json
240247

packages/electron-builder/src/options/linuxOptions.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,4 +106,14 @@ export interface SnapOptions extends LinuxBuildOptions {
106106
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".
107107
*/
108108
ubuntuAppPlatformContent?: string | null
109+
}
110+
111+
/*
112+
### `appImage` [AppImage](http://appimage.org) Specific Options
113+
*/
114+
export interface AppImageOptions extends LinuxBuildOptions {
115+
/*
116+
Whether to include required system libraries (`gconf2`, `libappindicator1`). Defaults to `false`.
117+
*/
118+
includeRequiredLib?: boolean | null
109119
}

packages/electron-builder/src/targets/appImage.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { LinuxPackager } from "../linuxPackager"
99
import { log } from "electron-builder-util/out/log"
1010
import { Target, Arch } from "electron-builder-core"
1111
import { unlinkIfExists } from "electron-builder-util/out/fs"
12+
import { AppImageOptions } from "../options/linuxOptions"
1213

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

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

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

66+
if (this.options.includeRequiredLib === true && arch === Arch.x64) {
67+
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")
68+
args.push("-map", libDir, "/usr/lib")
69+
}
70+
6571
args.push("-chown_r", "0", "/", "--")
6672
args.push("-zisofs", `level=${packager.config.compression === "store" ? "0" : "9"}:block_size=128k:by_magic=off`)
6773
args.push("set_filter_r", "--zisofs", "/")

0 commit comments

Comments
 (0)