mirror of
https://github.com/rowboatlabs/rowboat.git
synced 2026-07-21 21:31:12 +02:00
fix forge build
This commit is contained in:
parent
16327a4a71
commit
7387d3c1c9
1 changed files with 10 additions and 42 deletions
|
|
@ -218,52 +218,20 @@ module.exports = {
|
||||||
fs.rmSync(codeSignatureDir, { recursive: true });
|
fs.rmSync(codeSignatureDir, { recursive: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
// 8. Remove adhoc signatures from app bundle, executable, and helpers
|
// 8. Re-sign the app bundle with adhoc signature after file modifications
|
||||||
// The app bundle has an adhoc signature (linker-signed) that references resources
|
// The original bundle signature references resources that we've moved/modified
|
||||||
// When we modify the bundle structure, this signature becomes invalid
|
// Re-signing with adhoc signature creates a new signature that matches the current bundle structure
|
||||||
// Removing it ensures the app is completely unsigned
|
// This prevents "code has no resources but signature indicates they must be present" error
|
||||||
try {
|
try {
|
||||||
const { execSync } = require('child_process');
|
const { execSync } = require('child_process');
|
||||||
|
|
||||||
// Remove signature from the app bundle itself (this is the key step)
|
// Re-sign the entire app bundle with an adhoc signature
|
||||||
// This removes the bundle-level signature that causes the "code has no resources" error
|
// This creates a fresh signature that matches the modified bundle structure
|
||||||
execSync(`codesign --remove-signature "${appBundleRoot}"`, { stdio: 'ignore' });
|
execSync(`codesign --force --deep --sign - "${appBundleRoot}"`, { stdio: 'ignore' });
|
||||||
|
console.log('Re-signed app bundle with adhoc signature (matches modified structure)');
|
||||||
// Also remove signature from main executable
|
|
||||||
const executablePath = path.join(appBundleRoot, 'Contents', 'MacOS', 'rowboat');
|
|
||||||
if (fs.existsSync(executablePath)) {
|
|
||||||
execSync(`codesign --remove-signature "${executablePath}"`, { stdio: 'ignore' });
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove signatures from helper apps in Frameworks
|
|
||||||
const frameworksDir = path.join(appBundleRoot, 'Contents', 'Frameworks');
|
|
||||||
if (fs.existsSync(frameworksDir)) {
|
|
||||||
const helpers = fs.readdirSync(frameworksDir, { withFileTypes: true })
|
|
||||||
.filter(dirent => dirent.isDirectory())
|
|
||||||
.map(dirent => {
|
|
||||||
const helperApp = path.join(frameworksDir, dirent.name, 'Contents', 'MacOS');
|
|
||||||
if (fs.existsSync(helperApp)) {
|
|
||||||
const helpers = fs.readdirSync(helperApp, { withFileTypes: true })
|
|
||||||
.filter(f => f.isFile())
|
|
||||||
.map(f => path.join(helperApp, f.name));
|
|
||||||
return helpers;
|
|
||||||
}
|
|
||||||
return [];
|
|
||||||
})
|
|
||||||
.flat();
|
|
||||||
|
|
||||||
for (const helperExec of helpers) {
|
|
||||||
try {
|
|
||||||
execSync(`codesign --remove-signature "${helperExec}"`, { stdio: 'ignore' });
|
|
||||||
} catch (e) {
|
|
||||||
// Ignore errors for helpers
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log('Removed adhoc signatures from app bundle, executable, and helpers');
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// Ignore errors - codesign might fail if signatures don't exist
|
// Ignore errors - codesign might fail, but app should still work
|
||||||
|
console.log('Warning: Failed to re-sign app bundle:', e.message);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 9. Clear any signature-related extended attributes
|
// 9. Clear any signature-related extended attributes
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue