diff --git a/scripts/build_utils.py b/scripts/build_utils.py index b5dcb362..f4403bf6 100755 --- a/scripts/build_utils.py +++ b/scripts/build_utils.py @@ -13,7 +13,6 @@ from typing import Dict, List, Optional - def second_file_is_older(file1: Path, file2: Path) -> bool: return os.stat(file1.as_posix()).st_mtime - os.stat(file2.as_posix()).st_mtime > 1 @@ -34,14 +33,17 @@ def is_on_macos() -> bool: def run_and_check(cmd_list: List[str], cwd: Path = None, env_additions: Optional[Dict[str, str]] = None) -> None: print(" ".join(cmd_list), cwd) env = os.environ.copy() - if env_additions: - for k, v in env_additions.items(): - env[k] = v # PT: Ensure the M1 Homebrew prefix is always in PATH # TODO(PT): Conditionally enable this on M1 hosts? + # And ensure we do this before we add in the environment additions from the caller, so those always have + # highest precedence. env["PATH"] = f"/opt/homebrew/bin:{env['PATH']}" + if env_additions: + for k, v in env_additions.items(): + env[k] = v + status = subprocess.run(cmd_list, cwd=cwd.as_posix() if cwd else None, env=env) if status.returncode != 0: raise RuntimeError(f'Running "{" ".join(cmd_list)}" failed with exit code {status.returncode}') diff --git a/scripts/newlib.patch b/scripts/newlib.patch index 531f88b6..caf4757a 100644 --- a/scripts/newlib.patch +++ b/scripts/newlib.patch @@ -107,7 +107,7 @@ new file mode 100644 index 0000000..c2926ca --- /dev/null +++ b/newlib/libc/sys/axle/syscalls.c -@@ -0,0 +1,187 @@ +@@ -0,0 +1,191 @@ +/* note these headers are all provided by newlib - you don't need to provide them */ +#include +#include