- scripts/build-wx-macos.sh: static, monolithic, universal (arm64 + x86_64) wxOSX/Cocoa 3.3.3 from the vendored tree, with wx's bundled image/zlib/regex/expat so the app links only system frameworks. Minimum macOS 11.0: current SDKs' libc++ supports nothing older. - scripts/build-gui-macos.sh: builds both Rust targets against that prefix and merges them with lipo. - ci/package-macos.py: "Alkane Toolkit.app" (Info.plist, icon, local network usage string), ad-hoc signed, zipped with ditto as alkane-toolkit-vX.Y.Z-macos-universal.zip with LICENSE and README. - crates/alkane-gui/macos: app icon (.icns) from the same glyph as the Windows icon, plus the script that makes it. - wx-rs patch 0009: macOS goes through wx-config (drops the universal -arch flags, maps -framework), reports logical sizes like GTK/MSW instead of narrowing floats to ints, and links clang's compiler runtime for wxOSX's @available checks. - docs/macos.md, README and the manual's install chapter. Verified on an M1 running macOS 27.0.1: both slices build, all workspace unit tests pass, and the headless UI self-test passes 52/52 on arm64. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
110 lines
4.3 KiB
Python
Executable File
110 lines
4.3 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
# SPDX-License-Identifier: MIT
|
|
"""Package the universal macOS build as an app bundle, for release.
|
|
|
|
package-macos.py VERSION BINARY OUT_DIR
|
|
|
|
BINARY is the universal (arm64 + x86_64) alkane-toolkit executable made by
|
|
scripts/build-gui-macos.sh. Writes
|
|
dist/alkane-toolkit-vVERSION-macos-universal.zip holding "Alkane Toolkit.app",
|
|
LICENSE and README.txt, and prints its path. Runs on macOS (lipo, codesign,
|
|
ditto).
|
|
|
|
The bundle is ad-hoc signed only (Apple Silicon refuses to run unsigned
|
|
code); it is not signed with a Developer ID or notarized, so Gatekeeper asks
|
|
the user to confirm the first launch. README.txt says how.
|
|
"""
|
|
|
|
import pathlib
|
|
import plistlib
|
|
import shutil
|
|
import subprocess
|
|
import sys
|
|
import tempfile
|
|
|
|
ROOT = pathlib.Path(__file__).resolve().parents[1]
|
|
APP = "Alkane Toolkit.app"
|
|
BUNDLE_ID = "re.bluefla.alkane-toolkit"
|
|
MIN_MACOS = "11.0"
|
|
|
|
|
|
def run(*args: str) -> str:
|
|
return subprocess.run(args, check=True, capture_output=True, text=True).stdout
|
|
|
|
|
|
def build_app(version: str, binary: pathlib.Path, dest: pathlib.Path) -> pathlib.Path:
|
|
archs = run("lipo", "-archs", str(binary)).split()
|
|
if sorted(archs) != ["arm64", "x86_64"]:
|
|
sys.exit(f"{binary} is not a universal arm64 + x86_64 binary: {archs}")
|
|
app = dest / APP
|
|
macos = app / "Contents" / "MacOS"
|
|
resources = app / "Contents" / "Resources"
|
|
macos.mkdir(parents=True)
|
|
resources.mkdir()
|
|
shutil.copy2(binary, macos / "alkane-toolkit")
|
|
shutil.copy2(ROOT / "crates/alkane-gui/macos/alkane-toolkit.icns", resources)
|
|
info = {
|
|
"CFBundleName": "Alkane Toolkit",
|
|
"CFBundleDisplayName": "Alkane Toolkit",
|
|
"CFBundleIdentifier": BUNDLE_ID,
|
|
"CFBundleExecutable": "alkane-toolkit",
|
|
"CFBundleIconFile": "alkane-toolkit",
|
|
"CFBundlePackageType": "APPL",
|
|
"CFBundleShortVersionString": version,
|
|
"CFBundleVersion": version,
|
|
"CFBundleInfoDictionaryVersion": "6.0",
|
|
"LSMinimumSystemVersion": MIN_MACOS,
|
|
"NSHighResolutionCapable": True,
|
|
"NSPrincipalClass": "NSApplication",
|
|
# The scanner talks to miners on the local network.
|
|
"NSLocalNetworkUsageDescription":
|
|
"Alkane Toolkit scans your local network to find and manage miners.",
|
|
"NSHumanReadableCopyright":
|
|
"Copyright (c) 2026 BlueFlare Energy Solutions Inc. (MIT License)",
|
|
}
|
|
with open(app / "Contents" / "Info.plist", "wb") as fh:
|
|
plistlib.dump(info, fh)
|
|
(app / "Contents" / "PkgInfo").write_text("APPL????")
|
|
# Ad-hoc signature over the whole bundle (the linker's per-slice
|
|
# signatures do not cover Info.plist or the resources).
|
|
run("codesign", "--force", "--sign", "-", "--timestamp=none", str(app))
|
|
run("codesign", "--verify", "--strict", str(app))
|
|
return app
|
|
|
|
|
|
def release(version: str, binary: str, out_dir: str) -> None:
|
|
name = f"alkane-toolkit-v{version}-macos-universal"
|
|
out = pathlib.Path(out_dir).resolve() / f"{name}.zip"
|
|
out.parent.mkdir(parents=True, exist_ok=True)
|
|
readme = (
|
|
f"alkane-toolkit v{version} (macOS, Apple Silicon and Intel)\n"
|
|
"\n"
|
|
f"Runs on macOS {MIN_MACOS} (Big Sur) or later. Drag \"Alkane Toolkit\"\n"
|
|
"to Applications, then open it.\n"
|
|
"\n"
|
|
"The app is not notarized by Apple, so the first launch is blocked\n"
|
|
"with a warning. To allow it once:\n"
|
|
" - macOS 15 or later: try to open it, then System Settings >\n"
|
|
" Privacy & Security > \"Open Anyway\" for Alkane Toolkit.\n"
|
|
" - macOS 11 to 14: Control-click the app, choose Open, then Open.\n"
|
|
"Or, in Terminal: xattr -dr com.apple.quarantine \"/Applications/Alkane Toolkit.app\"\n"
|
|
"\n"
|
|
"Settings are stored in ~/.config/alkane-toolkit/.\n"
|
|
"Manual: https://blueflare.gitea.bluefla.re/alkane-toolkit/manual/\n"
|
|
)
|
|
with tempfile.TemporaryDirectory(prefix="alkane-macos-") as tmp:
|
|
folder = pathlib.Path(tmp) / name
|
|
folder.mkdir()
|
|
build_app(version, pathlib.Path(binary), folder)
|
|
shutil.copy2(ROOT / "LICENSE", folder / "LICENSE")
|
|
(folder / "README.txt").write_text(readme)
|
|
out.unlink(missing_ok=True)
|
|
run("ditto", "-c", "-k", "--keepParent", str(folder), str(out))
|
|
print(out)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
if len(sys.argv) != 4:
|
|
sys.exit(__doc__)
|
|
release(*sys.argv[1:])
|