Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,10 @@ To build the standalone application for your current OS:
make build
```
This will trigger the Python backend build via PyInstaller.

On macOS, you can choose the target architecture for the DMG build with `NEGPY_MACOS_ARCH`.
For an Intel build from a compatible macOS environment, run:

```bash
NEGPY_MACOS_ARCH=x86_64 make build
```
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ Since this is a free hobby project, I don't pay Apple or Microsoft ransom for th
2. Open Terminal and run: `xattr -cr /Applications/NegPy.app` (this gets rid of the warning).
3. Launch it.

If you build the DMG yourself on macOS, set `NEGPY_MACOS_ARCH=x86_64` for an Intel build or `NEGPY_MACOS_ARCH=arm64` for Apple Silicon.

**Scanner support** requires SANE via [Homebrew](https://brew.sh/):
```
brew install sane-backends
Expand Down
10 changes: 9 additions & 1 deletion build.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
is_macos = system == "Darwin"
is_linux = system == "Linux"


def get_macos_target_arch():
"""Return the macOS target architecture for packaging."""
return os.environ.get("NEGPY_MACOS_ARCH", platform.machine())

# Basic PyInstaller arguments
params = [
ENTRY_POINT,
Expand Down Expand Up @@ -119,6 +124,9 @@ def collect_gphoto2_plugins() -> None:
elif os.path.exists("media/icons/icon.png"):
params.append("--icon=media/icons/icon.png")

macos_target_arch = get_macos_target_arch()
params.append(f"--target-arch={macos_target_arch}")


def package_linux():
"""Package the built application into an AppImage."""
Expand Down Expand Up @@ -305,7 +313,7 @@ def package_macos():
"""Package the built application into a DMG with Applications symlink."""
print(f"Packaging for macOS (DMG) version {VERSION}...")
app_path = os.path.join("dist", f"{APP_NAME}.app")
dmg_name = f"{APP_NAME}-{VERSION}-macOS-{platform.machine()}.dmg"
dmg_name = f"{APP_NAME}-{VERSION}-macOS-{get_macos_target_arch()}.dmg"
dmg_path = os.path.join("dist", dmg_name)
temp_dmg_dir = os.path.join("dist", "dmg_temp")

Expand Down