Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Test on Apple Silicon ARM64 (#4496)

Christian Clauss0d2533231b0f
diff --git a/.github/scripts/ci_build_cairo.py b/.github/scripts/ci_build_cairo.py
index be50793a9..a504b57ab 100644
--- a/.github/scripts/ci_build_cairo.py
+++ b/.github/scripts/ci_build_cairo.py
@@ -144,10 +144,38 @@ def main():
]
)
- env_vars = {
- # add the venv bin directory to PATH so that meson can find ninja
- "PATH": f"{os.path.join(tmpdir, VENV_NAME, 'bin')}{os.pathsep}{os.environ['PATH']}",
- }
+ # Inherit the current environment so PKG_CONFIG_PATH, CFLAGS, LDFLAGS, etc. are preserved.
+ env_vars = os.environ.copy()
+ # Prepend the venv bin directory so meson/ninja from the venv are used.
+ env_vars["PATH"] = f"{os.path.join(tmpdir, VENV_NAME, 'bin')}{os.pathsep}{env_vars.get('PATH','')}"
+
+ # Ensure Homebrew-provided pkgconfig and include/lib paths are present on macOS ARM.
+ if sys.platform == "darwin":
+ try:
+ # Try to get specific prefix for lzo (safer for opt path), fall back to generic brew prefix.
+ brew_prefix = subprocess.check_output(["brew", "--prefix", "lzo"], text=True).strip()
+ except subprocess.CalledProcessError:
+ try:
+ brew_prefix = subprocess.check_output(["brew", "--prefix"], text=True).strip()
+ except Exception:
+ brew_prefix = None
+
+ if brew_prefix:
+ # pkg-config files can live in lib/pkgconfig or opt/<pkg>/lib/pkgconfig
+ pkgconfig_paths = [f"{brew_prefix}/lib/pkgconfig", f"{brew_prefix}/opt/lzo/lib/pkgconfig"]
+ # merge with any existing PKG_CONFIG_PATH
+ existing_pc = env_vars.get("PKG_CONFIG_PATH", "")
+ merged_pc = ":".join([p for p in pkgconfig_paths if p]) + (f":{existing_pc}" if existing_pc else "")
+ env_vars["PKG_CONFIG_PATH"] = merged_pc
+
+ # Ensure compiler & linker flags include brew include/lib
+ existing_cflags = env_vars.get("CFLAGS", "")
+ existing_ldflags = env_vars.get("LDFLAGS", "")
+ env_vars["CFLAGS"] = f"-I{brew_prefix}/include {existing_cflags}".strip()
+ env_vars["LDFLAGS"] = f"-L{brew_prefix}/lib {existing_ldflags}".strip()
+
+ # Debugging: log environment keys relevant to detection
+ # logger.info(f"env vars for meson: {env_vars}")
with gha_group("Building and Installing Cairo"):
logger.info("Running meson setup")
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 75723da75..79272f858 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -22,8 +22,11 @@ jobs:
strategy:
fail-fast: false
matrix:
- os: [ubuntu-22.04, macos-15-intel, windows-latest]
+ os: [ubuntu-22.04, macos-latest, windows-latest]
python: ["3.10", "3.11", "3.12", "3.13"]
+ include:
+ - os: macos-15-intel
+ python: "3.13"
steps:
- name: Checkout the repository
@@ -74,7 +77,7 @@ jobs:
if: runner.os == 'Linux' || runner.os == 'macOS'
with:
path: ${{ github.workspace }}/third_party
- key: ${{ runner.os }}-dependencies-cairo-${{ hashFiles('.github/scripts/ci_build_cairo.py') }}
+ key: ${{ runner.os }}-${{ runner.arch }}-dependencies-cairo-${{ hashFiles('.github/scripts/ci_build_cairo.py') }}
- name: Build and install Cairo (Linux and macOS)
if: (runner.os == 'Linux' || runner.os == 'macOS') && steps.cache-cairo.outputs.cache-hit != 'true'