diff --git a/docs/Options.md b/docs/Options.md index 6578f0318cb..d1c4c2ae73d 100644 --- a/docs/Options.md +++ b/docs/Options.md @@ -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) @@ -235,6 +236,12 @@ To use Squirrel.Windows please install `electron-builder-squirrel-windows` depen | stagePackages |

The list of Ubuntu packages to use that are needed to support the app part creation. Like depends for deb. Defaults to ["libnotify4", "libappindicator1", "libxtst6", "libnss3", "libxss1", "fontconfig-config", "gconf2", "libasound2"].

| ubuntuAppPlatformContent |

Specify ubuntu-app-platform1 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”.

+ +### `appImage` [AppImage](http://appimage.org) Specific Options +| Name | Description +| --- | --- +| includeRequiredLib | Whether to include required system libraries (`gconf2`, `libappindicator1`). Defaults to `false`. + ## Fields in the package.json diff --git a/packages/electron-builder/src/options/linuxOptions.ts b/packages/electron-builder/src/options/linuxOptions.ts index b08bdec2762..dbbad07c7b4 100644 --- a/packages/electron-builder/src/options/linuxOptions.ts +++ b/packages/electron-builder/src/options/linuxOptions.ts @@ -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 } \ No newline at end of file diff --git a/packages/electron-builder/src/targets/appImage.ts b/packages/electron-builder/src/targets/appImage.ts index 52beafa223c..9de6197a3de 100644 --- a/packages/electron-builder/src/targets/appImage.ts +++ b/packages/electron-builder/src/targets/appImage.ts @@ -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 @@ -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, (this.packager.config)[this.name]) + private readonly options: AppImageOptions = Object.assign({}, this.packager.platformSpecificBuildOptions, (this.packager.config)[this.name]) private readonly desktopEntry: Promise constructor(ignored: string, private packager: LinuxPackager, private helper: LinuxTargetHelper, private outDir: string) { @@ -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", "/")