From aadf48bd4d8afa86fa702c8709c9bc3753dd20d8 Mon Sep 17 00:00:00 2001 From: Martin Robinson Date: Thu, 5 Oct 2023 03:12:29 +0200 Subject: [PATCH] Bootstrap pkg-config and cmake on MacOS (#30497) These need to be installed in order to build so we can install them via Homebrew. Do this by simply restoring the Homebrew bootstrapping logic we had in place previously. Fixes #27171. --- .gitignore | 3 +++ README.md | 2 +- python/servo/platform/macos.py | 14 +++++++++++++- support/macos/Brewfile | 2 ++ 4 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 support/macos/Brewfile diff --git a/.gitignore b/.gitignore index 33f08eb5aed..46ed53e46cb 100644 --- a/.gitignore +++ b/.gitignore @@ -58,5 +58,8 @@ Sessionx.vim # Layout debugger trace files layout_trace* +# Package managers +support/macos/Brewfile.lock.json + # direnv .envrc diff --git a/README.md b/README.md index ad0dd738395..4484b76e55e 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ manually, try the [manual build setup][manual-build]. - Install [Xcode](https://developer.apple.com/xcode/) - Install [Homebrew](https://brew.sh/) - Run `curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh` -- Run `pip install virtualenv` +- Run `pip3 install virtualenv` - Run `./mach bootstrap`
*Note: This will install the recommended version of GStreamer globally on your system.* diff --git a/python/servo/platform/macos.py b/python/servo/platform/macos.py index 1bcb88cab54..34f936a3f21 100644 --- a/python/servo/platform/macos.py +++ b/python/servo/platform/macos.py @@ -55,7 +55,19 @@ class MacOS(Base): return True def _platform_bootstrap(self, _force: bool) -> bool: - return self._platform_bootstrap_gstreamer(False) + installed_something = False + try: + brewfile = os.path.join(util.SERVO_ROOT, "support", "macos", "Brewfile") + output = subprocess.check_output( + ['brew', 'bundle', 'install', "--file", brewfile] + ).decode("utf-8") + print(output) + installed_something = "Installing" in output + except subprocess.CalledProcessError as e: + print("Could not run homebrew. Is it installed?") + raise e + installed_something |= self._platform_bootstrap_gstreamer(False) + return installed_something def _platform_bootstrap_gstreamer(self, force: bool) -> bool: if not force and self.is_gstreamer_installed(cross_compilation_target=None): diff --git a/support/macos/Brewfile b/support/macos/Brewfile new file mode 100644 index 00000000000..1b321f0a8a9 --- /dev/null +++ b/support/macos/Brewfile @@ -0,0 +1,2 @@ +brew "cmake" +brew "pkg-config"