Skip to content

Commit

Permalink
Apple Silicon
Browse files Browse the repository at this point in the history
  • Loading branch information
JrMasterModelBuilder committed Oct 25, 2023
1 parent c47ac3f commit 2d6bed8
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 6 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/mac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: macos-latest
env:
SHOCKPKG_PACKAGES: >-
flash-player-35.0.0.204-mac-x86_64-sa-2022-07-04
flash-player-35.0.0.60-mac-x86_64-arm64-sa-2023-09-23
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -38,13 +38,13 @@ jobs:
run: npm exec shockpkg -- install ${{ env.SHOCKPKG_PACKAGES }}

- name: Build
run: node make.mjs build:mac-x86_64
run: node make.mjs build:mac-x86_64-arm64

- name: Dist tgz
run: node make.mjs dist:mac-x86_64:tgz
run: node make.mjs dist:mac-x86_64-arm64:tgz

- name: Dist dmg
run: node make.mjs dist:mac-x86_64:dmg
run: node make.mjs dist:mac-x86_64-arm64:dmg

- name: Artifact build
uses: actions/upload-artifact@v3
Expand Down
9 changes: 7 additions & 2 deletions make.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
distName
} from './util/meta.mjs';
import {docs} from './util/doc.mjs';
import {isMac, codesign} from './util/mac.mjs';
import {makeZip, makeTgz, makeExe, makeDmg} from './util/dist.mjs';
import {copyFile, outputFile, remove} from './util/fs.mjs';
import {templateStrings} from './util/string.mjs';
Expand Down Expand Up @@ -173,8 +174,8 @@ for (const [type, pkg] of Object.entries({
}

for (const [type, pkg] of Object.entries({
'x86_64': 'flash-player-35.0.0.204-mac-x86_64-sa-2022-07-04',
'x86_64-debug': 'flash-player-35.0.0.204-mac-x86_64-sa-debug-2022-07-04'
'x86_64-arm64': 'flash-player-35.0.0.60-mac-x86_64-arm64-sa-2023-09-23',
'x86_64-arm64-debug': 'flash-player-35.0.0.60-mac-x86_64-arm64-sa-debug-2023-09-23'
})) {
const build = `build/mac-${type}`;
task[`build:mac-${type}`] = async () => {
Expand Down Expand Up @@ -215,6 +216,10 @@ for (const [type, pkg] of Object.entries({
b.projector.removeInfoPlistStrings = true;
b.projector.removeCodeSignature = true;
await b.write(bundler);
if (isMac) {
await codesign(b.projector.path);
await codesign(b.path);
}
await docs('docs', build);
};
task[`dist:mac-${type}:tgz`] = async () => {
Expand Down
22 changes: 22 additions & 0 deletions util/mac.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import {spawn} from 'node:child_process';

export const isMac = process.platform === 'darwin';

export async function codesign(app, identity = '-') {
const argv = ['codesign', '-f', '-s', identity, app];
await new Promise((resolve, reject) => {
const p = spawn(argv[0], argv.slice(1));
const stderr = [];
p.stderr.on('data', data => {
stderr.push(data);
});
p.on('exit', code => {
if (code) {
const err = Buffer.concat(stderr).toString('utf8').trim();
reject(new Error(`${argv[0]}: ${code}: ${err}`));
return;
}
resolve();
});
});
}

0 comments on commit 2d6bed8

Please sign in to comment.