openstenoproject / plover

Open source stenotype engine
http://opensteno.org/plover
GNU General Public License v2.0
2.35k stars 280 forks source link

Apple Silicon Support #1361

Open nikhiljha opened 3 years ago

nikhiljha commented 3 years ago

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
dnaq commented 2 years ago

Giving this a bump since a universal binary for both x86_64 and for aarch64 would be really nice to have and would increase performance a lot on apple silicon.

dolie commented 1 year ago

up

dannykorpan commented 8 months ago

up