From 4b9f2af41ff6bfa39a80fc2df765d9cd4d085ec3 Mon Sep 17 00:00:00 2001 From: schm1dtmac Date: Mon, 14 Sep 2026 20:40:18 +0100 Subject: [PATCH] [Mac OS X] Switch all Mac OS X CI to use MacPorts because of Homebrew 7 dropping Intel far too early. This change really is the last straw I've had with Homebrew, I simply cannot trust that they won't do something similar to Apple Silicon in the future. Inevitably much of the Intel CI's downloaded deps will get built from source due to this which would cause build times to skyrocket, were we to keep using Homebrew. --- .ci/build-mac.sh | 35 ++++++++------------------ .ci/deploy-mac.sh | 25 +----------------- .github/parameters/setup-macports.yaml | 9 +++++++ .github/workflows/rpcs3.yml | 7 +++++- rpcs3/Emu/RSX/GL/OpenGL.h | 5 ---- rpcs3/rpcs3qt/gui_application.cpp | 3 +++ 6 files changed, 29 insertions(+), 55 deletions(-) create mode 100644 .github/parameters/setup-macports.yaml diff --git a/.ci/build-mac.sh b/.ci/build-mac.sh index ae0341cc0e..5b39b1ad2a 100755 --- a/.ci/build-mac.sh +++ b/.ci/build-mac.sh @@ -9,23 +9,12 @@ AVVER="${COMM_TAG}-${COMM_COUNT}" export LVER="${COMM_TAG}-${COMM_COUNT}-${COMM_HASH}" echo "AVVER=$AVVER" >> .ci/ci-vars.env -export HOMEBREW_NO_AUTO_UPDATE=1 -export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 -export HOMEBREW_NO_ENV_HINTS=1 -export HOMEBREW_NO_INSTALL_CLEANUP=1 -brew install -f --overwrite --quiet ccache "llvm@$LLVM_COMPILER_VER" -brew link -f --overwrite --quiet "llvm@$LLVM_COMPILER_VER" -brew install -f --overwrite --quiet googletest opencv@4 sdl3 vulkan-headers vulkan-loader molten-vk -brew unlink --quiet ffmpeg fmt qtbase qtsvg qtdeclarative protobuf || true +# Clang depends on LLVM_COMPILER_VER so it needs to be installed here. +sudo port install "clang-$LLVM_COMPILER_VER" export CXX=clang++ export CC=clang -export BREW_PATH; -BREW_PATH="$(brew --prefix)" -export BREW_BIN="$BREW_PATH/bin" -export BREW_SBIN="$BREW_PATH/sbin" - export WORKDIR; WORKDIR="$(pwd)" @@ -53,20 +42,16 @@ cd "$WORKDIR" ditto "/tmp/Qt/$QT_VER" "qt-downloader/$QT_VER" export Qt6_DIR="$WORKDIR/qt-downloader/$QT_VER/clang_64/lib/cmake/Qt$QT_VER_MAIN" -export SDL3_DIR="$BREW_PATH/opt/sdl3/lib/cmake/SDL3" +export SDL3_DIR="/opt/local/lib/cmake/SDL3" +export OpenCV_DIR="/opt/local/libexec/opencv4" +export PATH="/opt/local/libexec/llvm-$LLVM_COMPILER_VER/bin:/$WORKDIR/qt-downloader/$QT_VER/clang_64/bin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/Apple/usr/bin:$PATH" +export LDFLAGS="-L/opt/local/lib -Wl,-rpath,/opt/local/lib" +export VULKAN_SDK="/opt/local" +export LLVM_DIR="/opt/local/libexec/llvm-$LLVM_COMPILER_VER" -export PATH="$BREW_PATH/opt/llvm@$LLVM_COMPILER_VER/bin:$PATH" -export LDFLAGS="-L$BREW_PATH/opt/llvm@$LLVM_COMPILER_VER/lib/c++ -L$BREW_PATH/opt/llvm@$LLVM_COMPILER_VER/lib/unwind -lunwind" - -export VULKAN_SDK -VULKAN_SDK="$BREW_PATH/opt/molten-vk" -ln -s "$BREW_PATH/opt/vulkan-loader/lib/libvulkan.dylib" "$VULKAN_SDK/lib/libvulkan.dylib" - -export LLVM_DIR -LLVM_DIR="$BREW_PATH/opt/llvm@$LLVM_COMPILER_VER" # Pull all the submodules except some # shellcheck disable=SC2046 -git submodule -q update --init --depth=1 --jobs=8 $(awk '/path/ && !/llvm/ && !/opencv/ && !/SDL/ && !/feralinteractive/ { print $3 }' .gitmodules) +git submodule -q update --init --depth=1 --jobs=8 $(awk '/path/ && !/llvm/ && !/opencv/ && !/libsdl-org/ && !/feralinteractive/ && !/curl/ && !/zlib/ { print $3 }' .gitmodules) mkdir build && cd build || exit 1 # The below should be uncommented once bugs with Qt 6 QListWidgets when using the OS 26 visual style are resolved. @@ -91,7 +76,7 @@ cmake .. \ -DUSE_SYSTEM_OPENCV=ON \ -G Ninja -ninja -j4; build_status=$?; +ninja; build_status=$?; cd .. diff --git a/.ci/deploy-mac.sh b/.ci/deploy-mac.sh index 4125e2379b..a2b3cc810f 100755 --- a/.ci/deploy-mac.sh +++ b/.ci/deploy-mac.sh @@ -5,15 +5,12 @@ cd build || exit 1 cd bin mkdir -p "rpcs3.app/Contents/Resources/vulkan/icd.d" || true -wget https://github.com/KhronosGroup/MoltenVK/releases/download/v1.4.2-rc1/MoltenVK-macos-privateapi.tar +wget https://github.com/KhronosGroup/MoltenVK/releases/download/v1.4.2/MoltenVK-macos-privateapi.tar tar -xvf MoltenVK-macos-privateapi.tar cp "MoltenVK/MoltenVK/dynamic/dylib/macOS/libMoltenVK.dylib" "rpcs3.app/Contents/Frameworks/libMoltenVK.dylib" cp "MoltenVK/MoltenVK/dynamic/dylib/macOS/MoltenVK_icd.json" "rpcs3.app/Contents/Resources/vulkan/icd.d/MoltenVK_icd.json" sed -i '' "s/.\//..\/..\/..\/Frameworks\//g" "rpcs3.app/Contents/Resources/vulkan/icd.d/MoltenVK_icd.json" -cp "$(realpath $BREW_PATH/opt/llvm@$LLVM_COMPILER_VER/lib/c++/libc++abi.1.0.dylib)" "rpcs3.app/Contents/Frameworks/libc++abi.1.dylib" -cp "$(realpath $BREW_PATH/opt/gcc/lib/gcc/current/libgcc_s.1.1.dylib)" "rpcs3.app/Contents/Frameworks/libgcc_s.1.1.dylib" - rm -rf "rpcs3.app/Contents/Frameworks/QtPdf.framework" \ "rpcs3.app/Contents/Frameworks/QtQml.framework" \ "rpcs3.app/Contents/Frameworks/QtQmlModels.framework" \ @@ -52,26 +49,6 @@ rm -f rpcs3.app/Contents/translations/qt_help_*.qm || true mv rpcs3.app RPCS3_.app mv RPCS3_.app RPCS3.app -# Hack to fix rpath issues -BIN="RPCS3.app/Contents/MacOS/rpcs3" -install_name_tool -delete_rpath /opt/homebrew/lib $BIN || true -install_name_tool -delete_rpath /usr/local/lib $BIN || true - -# Fix dylib IDs -for lib in RPCS3.app/Contents/Frameworks/*.dylib; do - name=$(basename "$lib") - install_name_tool -id "@rpath/$name" "$lib" -done - -# Rewrite any hardcoded Homebrew paths to use @rpath -find "RPCS3.app/Contents/" -type f \( -perm +111 -o -name "*.dylib" \) | while read -r bin; do - otool -L "$bin" | grep -E "/opt/homebrew|/usr/local" | awk '{print $1}' | while read -r dep; do - base=$(basename "$dep") - echo "Fixing $dep -> @rpath/$base in $bin" - install_name_tool -change "$dep" "@rpath/$base" "$bin" - done -done - # NOTE: "--deep" is deprecated codesign --deep -fs - RPCS3.app diff --git a/.github/parameters/setup-macports.yaml b/.github/parameters/setup-macports.yaml new file mode 100644 index 0000000000..1da4c67d44 --- /dev/null +++ b/.github/parameters/setup-macports.yaml @@ -0,0 +1,9 @@ +ports: + - name: abseil + - name: ccache + - name: gtest + - name: opencv4 + - name: sdl3 + - name: vulkan-headers + - name: vulkan-loader + - name: MoltenVK diff --git a/.github/workflows/rpcs3.yml b/.github/workflows/rpcs3.yml index 68e1356bc8..ece64449a8 100644 --- a/.github/workflows/rpcs3.yml +++ b/.github/workflows/rpcs3.yml @@ -185,12 +185,17 @@ jobs: RELEASE_MESSAGE: ../GitHubReleaseMessage.txt UPLOAD_COMMIT_HASH: ${{ matrix.UPLOAD_COMMIT_HASH }} UPLOAD_REPO_FULL_NAME: ${{ matrix.UPLOAD_REPO_FULL_NAME }} - RUN_UNIT_TESTS: ${{ matrix.name == 'Apple Silicon' && (github.event_name == 'pull_request' && 'ON') || 'OFF' }} + RUN_UNIT_TESTS: github.event_name == 'pull_request' && 'ON' || 'OFF' steps: - name: Checkout repository uses: actions/checkout@main with: fetch-depth: 0 + + - name: Setup MacPorts + uses: melusina-org/setup-macports@v1 + with: + cache: 'disable' - name: Restore Build Ccache uses: actions/cache/restore@main diff --git a/rpcs3/Emu/RSX/GL/OpenGL.h b/rpcs3/Emu/RSX/GL/OpenGL.h index 2ecf773d79..9ee25840c5 100644 --- a/rpcs3/Emu/RSX/GL/OpenGL.h +++ b/rpcs3/Emu/RSX/GL/OpenGL.h @@ -16,11 +16,6 @@ typedef BOOL (WINAPI* PFNWGLSWAPINTERVALEXTPROC) (int interval); #undef OPENGL_PROC #undef WGL_PROC #undef OPENGL_PROC2 - -#elif defined(__APPLE__) -#include -#include - #else #include #ifdef HAVE_X11 diff --git a/rpcs3/rpcs3qt/gui_application.cpp b/rpcs3/rpcs3qt/gui_application.cpp index 5ab02365b6..9b5105e47d 100644 --- a/rpcs3/rpcs3qt/gui_application.cpp +++ b/rpcs3/rpcs3qt/gui_application.cpp @@ -56,7 +56,10 @@ #include #include "Emu/RSX/Null/NullGSRender.h" + +#ifndef __APPLE__ #include "Emu/RSX/GL/GLGSRender.h" +#endif #if defined(HAVE_VULKAN) #include "Emu/RSX/VK/VKGSRender.h"