Support non-darwin

This commit is contained in:
Philip Peterson 2025-08-30 22:07:05 -07:00
parent a7073df7d8
commit 827003cdd4

21
bin/mk-snapshot.js vendored
View file

@ -41,13 +41,22 @@ async function main() {
const outputBlobPath = `${baseDirPath}/cache/${npmConfigArch}`; const outputBlobPath = `${baseDirPath}/cache/${npmConfigArch}`;
await mkdirp(outputBlobPath); await mkdirp(outputBlobPath);
const mksnapshotBinPath = let mksnapshotBinPath
require.resolve( if (process.platform === 'win32') {
path.join("electron-mksnapshot", "bin", "mksnapshot" + (process.platform === "win32" ? ".exe" : "")) mksnapshotBinPath =
); require.resolve(
path.join("electron-mksnapshot", "bin", "mksnapshot.exe")
);
} else {
mksnapshotBinPath =
require.resolve(
path.join("electron-mksnapshot", "bin", "mksnapshot")
);
}
mksnapshotBinPath = path.dirname(mksnapshotBinPath);
if (process.platform !== 'darwin') { if (process.platform !== 'darwin') {
// TODO non-darwin
const matchingDirs = crossArchDirs.map((dir) => `${mksnapshotBinPath}/${dir}`).filter((dir) => fs.existsSync(dir)); const matchingDirs = crossArchDirs.map((dir) => `${mksnapshotBinPath}/${dir}`).filter((dir) => fs.existsSync(dir));
for (const dir of matchingDirs) { for (const dir of matchingDirs) {
if (fs.existsSync(`${mksnapshotBinPath}/gen/v8/embedded.S`)) { if (fs.existsSync(`${mksnapshotBinPath}/gen/v8/embedded.S`)) {
@ -56,7 +65,7 @@ async function main() {
} }
} }
} }
const startupBlobPath = path.join(outputBlobPath, 'snapshot_blob.bin'); const startupBlobPath = path.join(outputBlobPath, 'snapshot_blob.bin');
console.log(`Generating startup blob in "${outputBlobPath}"`); console.log(`Generating startup blob in "${outputBlobPath}"`);