mirror of
https://github.com/hensm/fx_cast.git
synced 2026-06-08 08:39:59 +00:00
Add nodeVersion app build argument
This commit is contained in:
@@ -72,8 +72,6 @@ Whitelisted sites should then display a cast button as in Chrome, provided they'
|
|||||||
* Native build tools (see [here](https://github.com/nodejs/node-gyp#installation))
|
* Native build tools (see [here](https://github.com/nodejs/node-gyp#installation))
|
||||||
* Bonjour/Avahi (on Windows/Linux respectively)
|
* Bonjour/Avahi (on Windows/Linux respectively)
|
||||||
|
|
||||||
Cross-compiling native dependencies may be possible, but isn't tested or supported. Build script options are provided for building/packaging on other platforms, but assume they won't work. Packaging on Linux for other Linux package formats should work fine.
|
|
||||||
|
|
||||||
### Installing dependencies
|
### Installing dependencies
|
||||||
|
|
||||||
#### Windows:
|
#### Windows:
|
||||||
|
|||||||
@@ -20,39 +20,28 @@ const EXTENSION_ID = "fx_cast@matt.tf";
|
|||||||
// Command line args
|
// Command line args
|
||||||
const argv = minimist(process.argv.slice(2), {
|
const argv = minimist(process.argv.slice(2), {
|
||||||
boolean: ["usePkg", "package"],
|
boolean: ["usePkg", "package"],
|
||||||
string: ["arch", "packageType"],
|
string: ["arch", "packageType", "nodeVersion"],
|
||||||
default: {
|
default: {
|
||||||
arch: os.arch(),
|
arch: os.arch(),
|
||||||
package: false,
|
package: false,
|
||||||
// Linux package type (deb/rpm)
|
// Linux package type (deb/rpm)
|
||||||
packageType: "deb"
|
packageType: "deb",
|
||||||
|
nodeVersion: "16"
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const supportedTargets = [
|
const supportedTargets = {
|
||||||
"win-x64",
|
win32: ["x86", "x64"],
|
||||||
"win-x86",
|
darwin: ["x64", "arm64"],
|
||||||
"macos-x64",
|
linux: ["x64"]
|
||||||
"macos-arm64",
|
};
|
||||||
"linux-x64"
|
if (!supportedTargets[process.platform]?.includes(argv.arch)) {
|
||||||
];
|
console.error(
|
||||||
|
`Error: Unsupported target! (${
|
||||||
|
paths.pkgPlatformMap[process.platform]
|
||||||
|
}-${argv.arch})`
|
||||||
|
);
|
||||||
|
|
||||||
const supportedPlatforms = [];
|
|
||||||
const supportedArchs = [];
|
|
||||||
|
|
||||||
for (const target of supportedTargets) {
|
|
||||||
const [platform, arch] = target.split("-");
|
|
||||||
|
|
||||||
supportedPlatforms.push(platform);
|
|
||||||
supportedArchs.push(arch);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!supportedPlatforms.includes(paths.pkgPlatformMap[process.platform])) {
|
|
||||||
console.error("Unsupported target platform");
|
|
||||||
process.exit(1);
|
|
||||||
}
|
|
||||||
if (!supportedArchs.includes(argv.arch)) {
|
|
||||||
console.error("Unsupported target arch");
|
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -131,7 +120,9 @@ async function build() {
|
|||||||
await pkg.exec([
|
await pkg.exec([
|
||||||
path.join(BUILD_PATH, "src"),
|
path.join(BUILD_PATH, "src"),
|
||||||
"--target",
|
"--target",
|
||||||
`node16-${paths.pkgPlatformMap[process.platform]}-${argv.arch}`,
|
`node${argv.nodeVersion}-${
|
||||||
|
paths.pkgPlatformMap[process.platform]
|
||||||
|
}-${argv.arch}`,
|
||||||
"--output",
|
"--output",
|
||||||
path.join(BUILD_PATH, executableName)
|
path.join(BUILD_PATH, executableName)
|
||||||
]);
|
]);
|
||||||
@@ -252,11 +243,6 @@ async function packageApp(platform, arch) {
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
default: {
|
|
||||||
console.error("Unsupported target platform");
|
|
||||||
process.exit(1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -519,6 +505,6 @@ function packageWin32(arch, platformExecutableName, platformExecutablePath) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
build().catch(e => {
|
build().catch(e => {
|
||||||
console.error("Build failed", e);
|
console.error("Error: Build failed!", e);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user