From 2d6bed83991594d4ac6ca8c24d0b9025c563d349 Mon Sep 17 00:00:00 2001 From: JrMasterModelBuilder Date: Wed, 25 Oct 2023 03:11:27 -0400 Subject: [PATCH] Apple Silicon --- .github/workflows/mac.yaml | 8 ++++---- make.mjs | 9 +++++++-- util/mac.mjs | 22 ++++++++++++++++++++++ 3 files changed, 33 insertions(+), 6 deletions(-) create mode 100644 util/mac.mjs diff --git a/.github/workflows/mac.yaml b/.github/workflows/mac.yaml index 9b61ae3..b547701 100644 --- a/.github/workflows/mac.yaml +++ b/.github/workflows/mac.yaml @@ -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 @@ -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 diff --git a/make.mjs b/make.mjs index dd62360..eb7aff6 100644 --- a/make.mjs +++ b/make.mjs @@ -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'; @@ -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 () => { @@ -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 () => { diff --git a/util/mac.mjs b/util/mac.mjs new file mode 100644 index 0000000..bc619aa --- /dev/null +++ b/util/mac.mjs @@ -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(); + }); + }); +}