12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- exports.toAppImageOrSnapArch = exports.LinuxPackager = void 0;
- const builder_util_1 = require("builder-util");
- const core_1 = require("./core");
- const platformPackager_1 = require("./platformPackager");
- const LinuxTargetHelper_1 = require("./targets/LinuxTargetHelper");
- const targetFactory_1 = require("./targets/targetFactory");
- const filename_1 = require("./util/filename");
- class LinuxPackager extends platformPackager_1.PlatformPackager {
- constructor(info) {
- super(info, core_1.Platform.LINUX);
- const executableName = this.platformSpecificBuildOptions.executableName;
- this.executableName = executableName == null ? this.appInfo.sanitizedName.toLowerCase() : (0, filename_1.sanitizeFileName)(executableName);
- }
- get defaultTarget() {
- return ["snap", "appimage"];
- }
- createTargets(targets, mapper) {
- let helper;
- const getHelper = () => {
- if (helper == null) {
- helper = new LinuxTargetHelper_1.LinuxTargetHelper(this);
- }
- return helper;
- };
- for (const name of targets) {
- if (name === core_1.DIR_TARGET) {
- continue;
- }
- const targetClass = (() => {
- switch (name) {
- case "appimage":
- return require("./targets/AppImageTarget").default;
- case "snap":
- return require("./targets/snap").default;
- case "flatpak":
- return require("./targets/FlatpakTarget").default;
- case "deb":
- case "rpm":
- case "sh":
- case "freebsd":
- case "pacman":
- case "apk":
- case "p5p":
- return require("./targets/FpmTarget").default;
- default:
- return null;
- }
- })();
- mapper(name, outDir => {
- if (targetClass === null) {
- return (0, targetFactory_1.createCommonTarget)(name, outDir, this);
- }
- return new targetClass(name, this, getHelper(), outDir);
- });
- }
- }
- }
- exports.LinuxPackager = LinuxPackager;
- function toAppImageOrSnapArch(arch) {
- switch (arch) {
- case builder_util_1.Arch.x64:
- return "x86_64";
- case builder_util_1.Arch.ia32:
- return "i386";
- case builder_util_1.Arch.armv7l:
- return "arm";
- case builder_util_1.Arch.arm64:
- return "arm_aarch64";
- default:
- throw new Error(`Unsupported arch ${arch}`);
- }
- }
- exports.toAppImageOrSnapArch = toAppImageOrSnapArch;
- //# sourceMappingURL=linuxPackager.js.map
|