Undo part of !4759

https://gitlab.com/OpenMW/openmw/-/merge_requests/4759#note_2606465930 was marked as resolved without really being resolved, so bypassed normal review and was merged prematurely.

We tell developers to run these scripts on their machines, so it's rude to install things we don't have to over the top of an existing installation.
If the existing installation was via brew via the default sources, then it's clever enough not to break things, but if it's using custom sources or the install is outside of brew, it'll either break or overwrite what's there.

The three tools we've historically checked before overwriting all have an upstream MacOS distribution that isn't through brew, so it's decently likely that they exist, and we've never agreed to drop support for them.

I went a little further than the original code:
* I added a check before overwriting brew itself.
  I don't know whether the install script would notice this anyway.
* I added a check to ensure it's specifically Qt 6.x that's already installed as we dropped support for Qt 5.
* I added the checks back to both scripts even though !4759 only removed them from one.
  There only used to be one script, and when it was split, the checks only made it to one copy.

I could have gone further by adding checks for other tools before we install them, but we didn't have these in the past and I couldn't be bothered.

Try ARCHPREFERENCE environment variable

Go back to using subshell

ARCHPREFERENCE won't retroactively relaunch the current shell.

Also use /usr/local/bin/brew as the x86_64 version we just installed isn't added to the path by default.

Fresh shell for brew installer?

escape things better

This commit message was very nearly just emoji or a rant about sh-compatible shells.

what is going on?

Nested quotes?
This commit is contained in:
AnyOldName3 2025-09-01 00:15:30 +01:00
parent 1dbd5fd571
commit f155b0199e
2 changed files with 9 additions and 3 deletions

View File

@ -1,8 +1,12 @@
#!/bin/sh -ex
arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
command -v /usr/local/bin/brew || arch -x86_64 bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
arch -x86_64 /usr/local/bin/brew install curl xquartz gd fontconfig freetype harfbuzz brotli ccache cmake qt@6 openal-soft icu4c yaml-cpp sqlite
arch -x86_64 bash -c "command -v ccache || /usr/local/bin/brew install ccache"
arch -x86_64 bash -c "command -v cmake >/dev/null 2>&1 || /usr/local/bin/brew install cmake"
arch -x86_64 bash -c "command -v qmake >/dev/null 2>&1 && qmake -v | grep -F 'Using Qt version 6.' >/dev/null || /usr/local/bin/brew install qt@6"
arch -x86_64 /usr/local/bin/brew install curl xquartz gd fontconfig freetype harfbuzz brotli openal-soft icu4c yaml-cpp sqlite
curl -fSL -R -J https://gitlab.com/OpenMW/openmw-deps/-/raw/main/macos/openmw-deps-20240802.zip -o ~/openmw-deps.zip
unzip -o ~/openmw-deps.zip -d /tmp > /dev/null

View File

@ -3,9 +3,11 @@
brew tap --repair
brew update --quiet
command -v ccache >/dev/null 2>&1 || brew install ccache
command -v cmake >/dev/null 2>&1 || brew install cmake
command -v qmake >/dev/null 2>&1 && qmake -v | grep -F "Using Qt version 6." >/dev/null || brew install qt@6
brew install curl xquartz gd fontconfig freetype harfbuzz brotli qt@6 ccache openal-soft icu4c yaml-cpp sqlite
brew install curl xquartz gd fontconfig freetype harfbuzz brotli openal-soft icu4c yaml-cpp sqlite
curl -fSL -R -J https://gitlab.com/OpenMW/openmw-deps/-/raw/main/macos/openmw-deps-20240818-arm64.tar.xz -o ~/openmw-deps.tar.xz
tar xf ~/openmw-deps.tar.xz -C /tmp > /dev/null