From 9aedb2933e5f6409ac7f9c2a0d3ef655345402a7 Mon Sep 17 00:00:00 2001 From: Miguel Jacq Date: Wed, 26 Feb 2025 06:04:17 +1100 Subject: [PATCH 1/5] Fix macos intel build to actually build on an Intel mac (macos-latest switched to arm in 2024) --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cf897c84..2070bf84 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -116,7 +116,7 @@ jobs: path: ~\onionshare-win64.zip build-mac-intel: - runs-on: macos-latest + runs-on: macos-13 steps: - uses: actions/checkout@v4 From 96b838ec3ec42b3c95f3b308a436745e45593067 Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Tue, 25 Feb 2025 12:01:30 -0800 Subject: [PATCH 2/5] Try creating empty libmimerapi.dylib so build-mac-intel will finish --- .github/workflows/build.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2070bf84..f1042869 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -212,6 +212,10 @@ jobs: cp -r /Volumes/Postgres-2.6.5-14/Postgres.app /Applications/ hdiutil detach /Volumes/Postgres-2.6.5-14 + - name: Touch dylib file for build to finish + run: | + touch /usr/local/lib/libmimerapi.dylib + - name: Build OnionShare run: | cd desktop From e76511aaa96d5fedf1f2419ef3ed914afeaf5524 Mon Sep 17 00:00:00 2001 From: Miguel Jacq Date: Wed, 26 Feb 2025 14:36:55 +1100 Subject: [PATCH 3/5] Various fixes for MacOS build --- .github/workflows/build.yml | 2 +- desktop/scripts/build-macos.py | 16 ++++++++++++++-- desktop/scripts/get-tor.py | 5 ++++- desktop/setup-freeze.py | 2 ++ 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f1042869..bfd898b7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -116,7 +116,7 @@ jobs: path: ~\onionshare-win64.zip build-mac-intel: - runs-on: macos-13 + runs-on: macos-15-large steps: - uses: actions/checkout@v4 diff --git a/desktop/scripts/build-macos.py b/desktop/scripts/build-macos.py index 0d09ac72..7c709e08 100644 --- a/desktop/scripts/build-macos.py +++ b/desktop/scripts/build-macos.py @@ -2,6 +2,7 @@ import os import inspect import click +import platform import subprocess import shutil import glob @@ -16,7 +17,7 @@ root = os.path.dirname( ) desktop_dir = os.path.join(root, "desktop") -identity_name_application = "Developer ID Application: Micah Lee (N9B95FDWH4)" +identity_name_application = "Developer ID Application: Science & Design, Inc. (7WLJ4UBL5L)" entitlements_plist_path = f"{desktop_dir}/package/Entitlements.plist" @@ -122,7 +123,6 @@ def cleanup_build(): "QtQuickShapes", "QtQuickTest", "QtNetwork", - "QtSvg", "QtDesignerComponents", "QtMultimediaWidgets", "QtQmlModels", @@ -228,6 +228,18 @@ def cleanup_build(): else: print(f"Cannot delete, filename not found: {filename}") + # Set a symlink for Qt's platforms and imageformats plugins, which seems to be necessary only on arm + if platform.system() == "Darwin" and platform.processor() == "arm": + platforms_target_path = os.path.join("..", "Resources", "lib", "PySide6", "Qt", "plugins", "platforms") + platforms_symlink_path = os.path.join(app_path, "Contents", "MacOS", "platforms") + + os.symlink(platforms_target_path, platforms_symlink_path) + + imageformats_target_path = os.path.join("..", "Resources", "lib", "PySide6", "Qt", "plugins", "imageformats") + imageformats_symlink_path = os.path.join(app_path, "Contents", "MacOS", "imageformats") + os.symlink(imageformats_target_path, imageformats_symlink_path) + + after_size = get_size(f"{app_path}") freed_bytes = before_size - after_size freed_mb = int(freed_bytes / 1024 / 1024) diff --git a/desktop/scripts/get-tor.py b/desktop/scripts/get-tor.py index 48236124..af567aad 100644 --- a/desktop/scripts/get-tor.py +++ b/desktop/scripts/get-tor.py @@ -120,6 +120,9 @@ def get_tor_macos(gpg, torkey, macos_url, macos_filename, expected_macos_sig): dist_path = os.path.join(root_path, "onionshare", "resources", "tor") if not os.path.exists(dist_path): os.makedirs(dist_path, exist_ok=True) + tor_lib_dir = os.path.join(root_path, "onionshare", "resources", "tor", "lib") + if not os.path.exists(tor_lib_dir): + os.makedirs(tor_lib_dir, exist_ok=True) # Make sure the working folder exists if not os.path.exists(working_path): @@ -165,7 +168,7 @@ def get_tor_macos(gpg, torkey, macos_url, macos_filename, expected_macos_sig): os.chmod(os.path.join(dist_path, "tor"), 0o755) shutil.copyfile( os.path.join(dmg_tor_path, "MacOS", "Tor", "libevent-2.1.7.dylib"), - os.path.join(dist_path, "libevent-2.1.7.dylib"), + os.path.join(tor_lib_dir, "libevent-2.1.7.dylib"), ) # Eject dmg diff --git a/desktop/setup-freeze.py b/desktop/setup-freeze.py index d6e81e81..3f9059b5 100644 --- a/desktop/setup-freeze.py +++ b/desktop/setup-freeze.py @@ -77,6 +77,7 @@ build_exe_options = { "shiboken6", "PySide6.QtCore", "PySide6.QtGui", + "PySide6.QtSvg", "PySide6.QtWidgets", ], "excludes": [ @@ -139,6 +140,7 @@ if platform.system() == "Darwin" and platform.processor() == "arm": "shiboken6", "PySide6.QtCore", "PySide6.QtGui", + "PySide6.QtSvg", "PySide6.QtWidgets", ] From ef43fc6762eb6e6a8b1c7d86caaed39d94a1b556 Mon Sep 17 00:00:00 2001 From: Miguel Jacq Date: Wed, 26 Feb 2025 14:40:45 +1100 Subject: [PATCH 4/5] Back to macos-13 --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bfd898b7..f1042869 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -116,7 +116,7 @@ jobs: path: ~\onionshare-win64.zip build-mac-intel: - runs-on: macos-15-large + runs-on: macos-13 steps: - uses: actions/checkout@v4 From c7a474052955034db054bc2677e8185af8e224ef Mon Sep 17 00:00:00 2001 From: Miguel Jacq Date: Wed, 26 Feb 2025 14:53:01 +1100 Subject: [PATCH 5/5] Tweaks for libevent --- desktop/scripts/get-tor.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/desktop/scripts/get-tor.py b/desktop/scripts/get-tor.py index af567aad..08a8669d 100644 --- a/desktop/scripts/get-tor.py +++ b/desktop/scripts/get-tor.py @@ -166,6 +166,13 @@ def get_tor_macos(gpg, torkey, macos_url, macos_filename, expected_macos_sig): os.path.join(dist_path, "tor"), ) os.chmod(os.path.join(dist_path, "tor"), 0o755) + # This is necessary for cx_freeze itself to work... + shutil.copyfile( + os.path.join(dmg_tor_path, "MacOS", "Tor", "libevent-2.1.7.dylib"), + os.path.join(dist_path, "libevent-2.1.7.dylib"), + ) + # ...but the libevent-2.1.7.dylib now seems to also need to be in a 'lib' + # subfolder of the tor/ folder to work on MacOS, so copy it there too. shutil.copyfile( os.path.join(dmg_tor_path, "MacOS", "Tor", "libevent-2.1.7.dylib"), os.path.join(tor_lib_dir, "libevent-2.1.7.dylib"),