From 336a86e955f69c5d96232fd55646e61670242d57 Mon Sep 17 00:00:00 2001 From: Benjamen Meyer Date: Wed, 11 Dec 2024 01:27:19 -0500 Subject: [PATCH] Refactor MacOS CI Builds - move the bootstrapping of MacOS into a script so it's easier to see what is going on and customize it for the various MacOS releases --- .github/workflows/macos-ci.yml | 53 +++++++++++--------------- script/bootstrap-mac.sh | 69 ++++++++++++++++++++++++++++++++++ 2 files changed, 90 insertions(+), 32 deletions(-) create mode 100755 script/bootstrap-mac.sh diff --git a/.github/workflows/macos-ci.yml b/.github/workflows/macos-ci.yml index 6582ad708..4438e0e20 100644 --- a/.github/workflows/macos-ci.yml +++ b/.github/workflows/macos-ci.yml @@ -27,44 +27,31 @@ jobs: compiler: - clang - gcc - homebrew-gl: - - true - # - false - homebrew-al: - - true - - false steps: # The following dependencies are already present within macos-* images: - # - clang (llvm) - # - cmake - # - expat - # - gcc - # - git - # - jpeg - # - libpng - # - libvorbis - # - python - - name: Install dependencies using homebrew - run: brew install boost-python3 gtk+3 gtkglext sdl + # MacOS has a Developers Tools package from Apple that gets installed which + # provides some minimal functionality: + # XCode (which uses CLang/LLVM) + # git + - name: Install Base tooling via homebrew + run: brew install bash shtool - # The following Apple-provided libraries are deprecated: - # * OpenGL as of macOS 10.14 - # * GLUT as of macOS 10.9 - - name: Optionally install homebrewed OpenGL and GLUT - if: ${{ matrix.homebrew-gl }} - run: | - brew install mesa mesa-glu freeglut - ln -s /usr/local/include/GL /usr/local/include/OpenGL - ln -s /usr/local/include/GL /usr/local/include/GLUT - # ln -s /usr/local/lib/libGL.dylib /usr/local/lib/libOpenGL.dylib - # find /usr/local/lib/ -iname '*gl*.dylib' + - name: Bootstrap MacOS + run: script/bootstrap-mac.sh - # The Apple-provided OpenAL is deprecated as of macOS 10.15 - - name: Optionally install homebrewed OpenAL - if: ${{ matrix.homebrew-al }} - run: brew install openal-soft + - name: Install dependencies using homebrew + run: brew install \ + gcc \ + cmake \ + python3 \ + boost-python3 \ + jpeg \ + libpng \ + gtk+3 \ + gtkglext \ + sdl2 \ - name: Check out repository uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 @@ -77,6 +64,8 @@ jobs: if: github.event.pull_request run: git checkout HEAD^2 + # Note: it might be good to use a step to detect where OpenAL-Soft is + # installed and set it to a GHA variable that can be consumed below - name: Build it env: MY_OS_NAME: macos diff --git a/script/bootstrap-mac.sh b/script/bootstrap-mac.sh new file mode 100755 index 000000000..3f209cb44 --- /dev/null +++ b/script/bootstrap-mac.sh @@ -0,0 +1,69 @@ +#!/opt/homebrew/bin/bash +set -e + +DETECT_MAC_OS_VERSION=$(sw_vers -productVersion | cut -f 1,2 -d '.') +echo "Detected Mac OS X Version: ${DETECT_MAC_OS_VERSION}" + +MAC_OS_NAME="UNKOWN" +case "${DETECT_MAC_OS_VERSION}" in + "10.13") + MAC_OS_NAME="High_Sierra" + ;; + "10.14") + MAC_OS_NAME="Mojave" + ;; + "10.15") + MAC_OS_NAME="Catalina" + ;; + "11.*") + MAC_OS_NAME="Big_Sur" + ;; + "12.*") + MAC_OS_NAME="Monterey" + ;; + "13.*") + MAC_OS_NAME="Ventura" + ;; + "14.*") + MAC_OS_NAME="Sonoma" + ;; + "15.*") + MAC_OS_NAME="Sequoia" + ;; + *) + echo "Unknown Mac Release: ${DETECT_MAC_OS_VERSION}" + exit 1 + ;; +esac + +echo "Detected Mac OS X ${DETECT_MAC_OS_VERSION} - ${MAC_OS_NAME}" +# While we may be able to assume some other dependencies there does seem to be +# some changes between versions of MacOS on which are provided by default; so +# aside from the two above we should just go ahead an install everything ourselves. + +# Install the stuff we know needs to get installed all the time +brew install \ + gcc \ + cmake \ + python3 \ + boost-python3 \ + jpeg \ + libpng \ + gtk+3 \ + gtkglext \ + sdl2 + +# The following Apple-provided libraries are deprecated: +# * OpenGL as of macOS 10.14 +# * GLUT as of macOS 10.9 +brew install mesa mesa-glu freeglut +ln -s /usr/local/include/GL /usr/local/include/OpenGL +ln -s /usr/local/include/GL /usr/local/include/GLUT +# ln -s /usr/local/lib/libGL.dylib /usr/local/lib/libOpenGL.dylib +# find /usr/local/lib/ -iname '*gl*.dylib' + +# MacOS 13+ needs Vorbis support +brew install vorbis-tools + +# The Apple-provided OpenAL is deprecated as of macOS 10.15 +brew install openal-soft freealut