1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-19 17:53:39 +00:00

Bundle the desktop_proxy file

This commit is contained in:
Daniel García
2024-07-08 16:31:40 +02:00
parent 004188fe60
commit b6c42f6aa6
3 changed files with 37 additions and 19 deletions

View File

@@ -25,32 +25,36 @@ if (!crossPlatform) {
let targets = [];
switch (process.platform) {
case "win32":
targets = ["i686-pc-windows-msvc", "x86_64-pc-windows-msvc", "aarch64-pc-windows-msvc"];
targets = [
["i686-pc-windows-msvc", 'ia32'],
["x86_64-pc-windows-msvc", 'x64'],
["aarch64-pc-windows-msvc", 'arm64']
];
break;
case "darwin":
targets = ["x86_64-apple-darwin", "aarch64-apple-darwin"];
targets = [
["x86_64-apple-darwin", 'x64'],
["aarch64-apple-darwin", 'arm64']
];
break;
default:
targets = ['x86_64-unknown-linux-musl'];
targets = [
['x86_64-unknown-linux-musl', 'x64']
];
process.env["PKG_CONFIG_ALLOW_CROSS"] = "1";
process.env["PKG_CONFIG_ALL_STATIC"] = "1";
break;
}
targets.forEach(target => {
fs.mkdirSync(path.join(__dirname, "dist"), { recursive: true });
targets.forEach(([target, nodeArch]) => {
buildNapiModule(target);
buildProxyBin(target);
const ext = process.platform === "win32" ? ".exe" : "";
fs.copyFileSync(path.join(__dirname, "target", target, "release", `desktop_proxy${ext}`), path.join(__dirname, "dist", `desktop_proxy.${process.platform}-${nodeArch}${ext}`));
});
if (process.platform === "darwin") {
fs.mkdirSync(path.join(__dirname, "target", "darwin-universal"), { recursive: true });
let command = `lipo -create -output ${path.join(__dirname, "target", "darwin-universal", "desktop_proxy")} `;
targets.forEach(target => {
command += `${path.join(__dirname, "target", target, "release", "desktop_proxy")} `;
});
child_process.execSync(command, { stdio: 'inherit', cwd: __dirname});
}