146 lines
No EOL
7.4 KiB
JavaScript
146 lines
No EOL
7.4 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.appimageChecksums = void 0;
|
|
exports.getLinuxToolsPath = getLinuxToolsPath;
|
|
exports.getLinuxToolsMacToolset = getLinuxToolsMacToolset;
|
|
exports.getFpmPath = getFpmPath;
|
|
exports.getAppImageTools = getAppImageTools;
|
|
const builder_util_1 = require("builder-util");
|
|
const path = require("path");
|
|
const binDownload_1 = require("../binDownload");
|
|
const electronGet_1 = require("../util/electronGet");
|
|
const fpmChecksums = {
|
|
"fpm-1.17.0-ruby-3.4.3-darwin-arm64.7z": "6cc6d4785875bc7d79bdf52ca146080a4c300e1d663376ae79615fb548030ede",
|
|
"fpm-1.17.0-ruby-3.4.3-darwin-x86_64.7z": "f7cb468c5e64177124c9d3a5f400ac20ffcb411aa5aa0ea224a808ff5a2d3bbf",
|
|
"fpm-1.17.0-ruby-3.4.3-linux-amd64.7z": "44b0ec6025c14ec137f56180e62675c0eae36233cdce53d0953d9c73ced8989f",
|
|
"fpm-1.17.0-ruby-3.4.3-linux-arm64v8.7z": "338b50cfa7f12d745a997d1a3d000bcd0410008050fa7d8c4476a78a61c0564e",
|
|
"fpm-1.17.0-ruby-3.4.3-linux-i386.7z": "181124e2e9856855c21229ea9096bb7006a9e3e712d133ce332597ba878cd7b6",
|
|
};
|
|
exports.appimageChecksums = {
|
|
"0.0.0": {
|
|
"appimage-12.0.1.7z": "d12ff7eb8f1d1ec4652ca5237a7fbdca33acc0c758045636feca62dc6ecb8ec4",
|
|
},
|
|
"1.0.2": {
|
|
"appimage-tools-runtime-20251108.tar.gz": "a784a8c26331ec2e945c23d6bdb14af5c9df27f5939825d84b8709c61dc81eb0",
|
|
},
|
|
"1.0.3": {
|
|
"appimage-tools-runtime-20251108.tar.gz": "84021a78ee214ae6fd33a2d62a92ba25542dd10bc86bf117a9b2d0bba44e7665",
|
|
},
|
|
};
|
|
// no legacy toolset as macos arm64 BSD gtar/ar/lzip are not compatible with linux targets, so we always use newer toolset on macos for linux archives
|
|
const linuxToolsMacChecksums = {
|
|
"linux-tools-mac-darwin-arm64.tar.gz": "204e76f08364352edb28a6a4be87e8f9bd9340213865d9a0d1c664aa46fcf053",
|
|
"linux-tools-mac-darwin-x86_64.tar.gz": "7ee26dfbd0d2a4c2c83b55a9416a30cc84876eef01c6497ca49bb016a190c726",
|
|
};
|
|
async function getLinuxToolsPath() {
|
|
const envPath = await (0, builder_util_1.resolveEnvToolsetPath)("LINUX_TOOLS_MAC_PATH", "directory");
|
|
if (envPath != null) {
|
|
return envPath;
|
|
}
|
|
const arch = process.arch === "arm64" ? "arm64" : "x86_64";
|
|
const toolsetVersion = "1.0.0";
|
|
const filename = `linux-tools-mac-darwin-${arch}.tar.gz`;
|
|
return await (0, electronGet_1.downloadBuilderToolset)({
|
|
releaseName: `linux-tools-mac@${toolsetVersion}`,
|
|
filenameWithExt: filename,
|
|
checksums: {
|
|
[filename]: linuxToolsMacChecksums[filename],
|
|
},
|
|
githubOrgRepo: "electron-userland/electron-builder-binaries",
|
|
});
|
|
}
|
|
async function getLinuxToolsMacToolset() {
|
|
const linuxToolsPath = await getLinuxToolsPath();
|
|
const bin = (pkg) => path.join(linuxToolsPath, "bin", pkg);
|
|
return {
|
|
ar: bin("ar"),
|
|
lzip: bin("lzip"),
|
|
gtar: bin("gtar"),
|
|
};
|
|
}
|
|
async function getFpmPath() {
|
|
const customFpmPath = await (0, builder_util_1.resolveEnvToolsetPath)("CUSTOM_FPM_PATH", "file");
|
|
if (customFpmPath != null) {
|
|
return customFpmPath;
|
|
}
|
|
const exec = "fpm";
|
|
if (process.platform === "win32" || process.env.USE_SYSTEM_FPM === "true") {
|
|
return exec;
|
|
}
|
|
const getKey = () => {
|
|
if (process.platform === "linux") {
|
|
if (process.arch == "x64") {
|
|
return "fpm-1.17.0-ruby-3.4.3-linux-amd64.7z";
|
|
}
|
|
else if (process.arch === "arm64") {
|
|
return "fpm-1.17.0-ruby-3.4.3-linux-arm64v8.7z";
|
|
}
|
|
return "fpm-1.17.0-ruby-3.4.3-linux-i386.7z";
|
|
}
|
|
// darwin arm64
|
|
if (process.arch === "arm64") {
|
|
return "fpm-1.17.0-ruby-3.4.3-darwin-arm64.7z";
|
|
}
|
|
return "fpm-1.17.0-ruby-3.4.3-darwin-x86_64.7z";
|
|
};
|
|
const filename = getKey();
|
|
const fpmPath = await (0, binDownload_1.getBinFromUrl)("fpm@2.1.4", filename, fpmChecksums[filename]);
|
|
return path.join(fpmPath, exec);
|
|
}
|
|
async function getAppImageTools(appimageToolVersion, targetArch) {
|
|
var _a;
|
|
const runtimeArch = targetArch === builder_util_1.Arch.armv7l ? "arm32" : targetArch === builder_util_1.Arch.arm64 ? "arm64" : targetArch === builder_util_1.Arch.ia32 ? "ia32" : "x64";
|
|
// Static-runtime layout: tools at root, runtimes/ subdir, lib/{arch}/ subdir
|
|
const getPaths = (artifactPath) => ({
|
|
mksquashfs: path.resolve(artifactPath, "mksquashfs"),
|
|
desktopFileValidate: path.resolve(artifactPath, "desktop-file-validate"),
|
|
runtime: path.resolve(artifactPath, "runtimes", `runtime-${runtimeArch}`),
|
|
runtimeLibraries: path.resolve(artifactPath, "lib", runtimeArch),
|
|
});
|
|
// FUSE2 layout: tools under a host-platform subdir; runtime files at root with target-arch suffix
|
|
const getFuse2Paths = (artifactPath) => {
|
|
// mksquashfs/desktop-file-validate are HOST binaries — use process.arch, not targetArch
|
|
const hostArch = process.arch === "arm" ? "arm32" : process.arch === "arm64" ? "arm64" : process.arch === "ia32" ? "ia32" : "x64";
|
|
const toolRoot = process.platform === "linux" ? `linux-${hostArch}` : "darwin";
|
|
// Runtime files live at root; armv7l target uses "armv7l" filename, not the internal "arm32" alias
|
|
const runtimeSuffix = targetArch === builder_util_1.Arch.armv7l ? "armv7l" : runtimeArch;
|
|
// FUSE2 tree only ships lib/ia32 and lib/x64; arm targets fall back to x64 here
|
|
// but buildLegacyFuse2AppImage only copies runtimeLibraries for x64/ia32.
|
|
const libArch = targetArch === builder_util_1.Arch.ia32 ? "ia32" : "x64";
|
|
return {
|
|
mksquashfs: path.resolve(artifactPath, toolRoot, "mksquashfs"),
|
|
desktopFileValidate: path.resolve(artifactPath, toolRoot, "desktop-file-validate"),
|
|
runtime: path.resolve(artifactPath, `runtime-${runtimeSuffix}`),
|
|
runtimeLibraries: path.resolve(artifactPath, "lib", libArch),
|
|
};
|
|
};
|
|
const isFuse2 = appimageToolVersion === "0.0.0" || appimageToolVersion == null;
|
|
const download = async () => {
|
|
if (isFuse2) {
|
|
const filenameWithExt = "appimage-12.0.1.7z";
|
|
const artifactPath = await (0, electronGet_1.downloadBuilderToolset)({
|
|
releaseName: "appimage-12.0.1",
|
|
filenameWithExt,
|
|
checksums: { [filenameWithExt]: exports.appimageChecksums["0.0.0"][filenameWithExt] },
|
|
githubOrgRepo: "electron-userland/electron-builder-binaries",
|
|
});
|
|
return getFuse2Paths(artifactPath);
|
|
}
|
|
const filenameWithExt = "appimage-tools-runtime-20251108.tar.gz";
|
|
const artifactPath = await (0, electronGet_1.downloadBuilderToolset)({
|
|
releaseName: `appimage@${appimageToolVersion}`,
|
|
filenameWithExt,
|
|
checksums: { [filenameWithExt]: exports.appimageChecksums[appimageToolVersion][filenameWithExt] },
|
|
githubOrgRepo: "electron-userland/electron-builder-binaries",
|
|
});
|
|
return getPaths(artifactPath);
|
|
};
|
|
const artifact = (_a = (0, builder_util_1.use)(await (0, builder_util_1.resolveEnvToolsetPath)("APPIMAGE_TOOLS_PATH", "directory"), it => (isFuse2 ? getFuse2Paths(it) : getPaths(it)))) !== null && _a !== void 0 ? _a : (await download());
|
|
for (const entry of Object.entries(artifact)) {
|
|
if (!(await (0, builder_util_1.exists)(entry[1]))) {
|
|
throw new Error(`AppImage tool ${entry[0]} not found at path: ${entry[1]}`);
|
|
}
|
|
}
|
|
return artifact;
|
|
}
|
|
//# sourceMappingURL=linux.js.map
|