Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow tests to work out of the box on macOS #6230

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

aronson
Copy link

@aronson aronson commented Feb 10, 2025

Description

I heard make check was broken out of the box on macOS. Looked into how it works on Linux now. Binaries in the repo? Why not...

I built mGBA from the commit mentioned in the README.md I've modified. I did two builds, x86_64 and ARM64. To invoke the same builds, you can run this (subbing out the arm64 for x86_64 for the Intel build). You must also have all the normal required dependencies installed, per usual.

EDIT: I forgot to enable LTO to save a little more space. Updated the notary info as well as force-pushed an amend.

mkdir build
cd build
cmake \
  -DCMAKE_C_FLAGS="-I/usr/local/include" -DCMAKE_CXX_FLAGS="-I/usr/local/include" \
  -DBUILD_HEADLESS=ON \
  -DBUILD_STATIC=ON \
  -DBUILD_SDL=OFF \
  -DBUILD_QT=OFF \
  -DBUILD_SHARED=OFF \
  -DUSE_EPOXY=OFF \
  -DUSE_JSON_C=OFF \
  -DBUILD_TEST=ON \
  -DUSE_FFMPEG=OFF \
  -DUSE_PNG=OFF \
  -DUSE_LUA=OFF \
  -DUSE_LIBZIP=OFF \
  -DBUILD_PGO=OFF \
  -DBUILD_LTO=ON \
  -DENABLE_VFS=ON \
  -DENABLE_DEBUGGERS=ON \
  -DENABLE_SCRIPTING=ON \
  -DUSE_ELF=ON \
  -DENABLE_EDIT_LINE=ON \
  -DENABLE_GDB_STUB=ON \
  -DENABLE_VFS_FD=ON \
  -DCMAKE_OSX_ARCHITECTURES="arm64" \
  -DCMAKE_OSX_DEPLOYMENT_TARGET="10.3.9" \
  ..

You can then make a universal (fat) binary with lipo per usual. I've signed this binary with my personal Apple Developer certificate under my public name. I've sent it to the apple notary service and it passed, so it should pass gatekeeper on all macOS systems.

{
  "logFormatVersion": 1,
  "jobId": "e82dd6ab-861d-4653-9fd6-a4e4d4082713",
  "status": "Accepted",
  "statusSummary": "Ready for distribution",
  "statusCode": 0,
  "archiveFilename": "mgba-headless-test.zip",
  "uploadDate": "2025-02-10T22:08:24.855Z",
  "sha256": "f491447d8346abf2eef425539f7be8cf1b4dec25784fd3fafe87e08c2c7d0e3b",
  "ticketContents": [
    {
      "path": "mgba-headless-test.zip/mgba-headless-universal",
      "digestAlgorithm": "SHA-256",
      "cdhash": "7ce1de599c8d2a4d0ffed07d3a14c9a843fdf209",
      "arch": "x86_64"
    },
    {
      "path": "mgba-headless-test.zip/mgba-headless-universal",
      "digestAlgorithm": "SHA-256",
      "cdhash": "0034ebd914592bd86cca57bc56cd50dada47423c",
      "arch": "arm64"
    }
  ],
  "issues": null
}

I also modified the hydra sources to not use the stdbuf hack, which allows for make check to work in a Rosetta shell on ARM Macs.

The final, checked-in binary for macOS is 2.9 MB. I've done all I can to make it as small as possible.

Images

image

Things to note in the release changelog:

  • The new test runner binary will not support macOS versions older than 10.7 or 11 (for Intel and Apple Silicon respectively).
  • macOS users running make check may need to confirm with an OS dialog they're willing to open mgba-rom-test-mac when run for the first time.

Discord contact info

@luigi___

@aronson
Copy link
Author

aronson commented Feb 10, 2025

Tested on x86_64 Linux, ARM64 macOS, and x86_64 macOS. Needs a test on Windows.

@aronson
Copy link
Author

aronson commented Feb 10, 2025

Force-pushed the binary with LTO enabled to save another ~0.3MB. Tested and working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant