Skip to content

Apple Silicon Support #1361

@nikhiljha

Description

@nikhiljha

I briefly tried to build a universal .app for MacOS. It almost works, but you have to do some patching for PyQt5 to get it to build, and I'm not sure how to apply those patches with Tox. It has to build from source because wheels are unavailable for aarch64 macs.

I also needed to update the shim to run on intel and apple silicon, see below.

diff --git a/osx/make_app.sh b/osx/make_app.sh
index e39e8ea..68d3537 100644
--- a/osx/make_app.sh
+++ b/osx/make_app.sh
@@ -59,7 +59,10 @@ python='appdir_python'
 bootstrap_dist "$plover_wheel"
 
 # Create launcher.
-run gcc -Wall -O2 'osx/app_resources/plover_launcher.c' -o "$macos_dir/Plover"
+run clang -Wall -O2 'osx/app_resources/plover_launcher.c' -o "$macos_dir/Plover-intel" -target x86_64-apple-macos10.12
+run clang -Wall -O2 'osx/app_resources/plover_launcher.c' -o "$macos_dir/Plover-arm64" -target arm64-apple-macos10.12
+run lipo -create -output "$macos_dir/Plover" "$macos_dir/Plover-intel" "$macos_dir/Plover-arm64"
+run rm "$macos_dir/Plover-intel" "$macos_dir/Plover-arm64"
 
 # Copy icon.
 run cp 'osx/app_resources/plover.icns' "$resources_dir/plover.icns"
@@ -80,10 +83,6 @@ run "$python" -m plover_build_utils.trim "$py_home" "$builddir/dist_blacklist.tx
 # Make distribution source-less.
 run "$python" -m plover_build_utils.source_less "$py_home/lib" "*/pip/_vendor/distlib/*" '*/pip/_vendor/pep517/*'
 
-# Strip 32-bit support
-run mv "$appdir"{,.fat}
-run ditto -v --arch x86_64 "$appdir"{.fat,}
-
 # Check requirements.
 run "$python" -I -m plover_build_utils.check_requirements

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions