Update mesa-macos.yml #14
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build Mesa (macOS) | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: macos-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Install Homebrew dependencies | |
| run: | | |
| brew update | |
| brew install meson ninja python3 bison flex llvm glslang spirv-tools molten-vk \ | |
| libclc python-packaging spirv-llvm-translator | |
| - name: Install Python packages (packaging, mako, pyyaml) via pip | |
| run: | | |
| python3 -m pip install --user --break-system-packages packaging mako pyyaml | |
| echo "PYTHONPATH=$(python3 -c 'import site; print(site.getusersitepackages())')" >> $GITHUB_ENV | |
| - name: Clone Mesa fork | |
| run: | | |
| git clone https://github.com/lucamignatti/mesa.git | |
| cd mesa | |
| - name: Apply fixes to clc_helpers.cpp | |
| working-directory: mesa | |
| run: | | |
| # Add #undef UNUSED after the include line (macOS sed syntax) | |
| sed -i.bak '/#include "clc_helpers.h"/s/$/\ | |
| #undef UNUSED/' src/compiler/clc/clc_helpers.cpp | |
| # Fix namespace for GetResourcesPath | |
| sed -i.bak 's/Driver::GetResourcesPath/clang::GetResourcesPath/g' src/compiler/clc/clc_helpers.cpp | |
| - name: Set up environment | |
| run: | | |
| echo "/opt/homebrew/opt/llvm/bin" >> $GITHUB_PATH | |
| echo "/opt/homebrew/opt/bison/bin" >> $GITHUB_PATH | |
| echo "PKG_CONFIG_PATH=/opt/homebrew/lib/pkgconfig" >> $GITHUB_ENV | |
| echo "LDFLAGS=-L/opt/homebrew/opt/llvm/lib" >> $GITHUB_ENV | |
| echo "CPPFLAGS=-I/opt/homebrew/opt/llvm/include" >> $GITHUB_ENV | |
| - name: Create native.ini with Homebrew bison | |
| working-directory: mesa | |
| run: | | |
| cat > native.ini << 'EOF' | |
| [binaries] | |
| bison = '/opt/homebrew/opt/bison/bin/bison' | |
| EOF | |
| - name: Configure with Meson | |
| working-directory: mesa | |
| run: | | |
| meson setup build --native-file native.ini \ | |
| -Dprefix=$HOME/mesa-native \ | |
| -Dbuildtype=release \ | |
| -Dplatforms=macos \ | |
| -Degl-native-platform=surfaceless \ | |
| -Degl=enabled \ | |
| -Dgallium-drivers=zink \ | |
| -Dvulkan-drivers=kosmickrisp \ | |
| -Dgles1=enabled \ | |
| -Dgles2=enabled \ | |
| -Dglx=disabled \ | |
| -Dgbm=disabled \ | |
| -Dmoltenvk-dir=/opt/homebrew/opt/molten-vk | |
| - name: Build and install | |
| working-directory: mesa | |
| run: | | |
| ninja -C build | |
| ninja -C build install | |
| - name: Create DRI symlinks and copy Vulkan loader | |
| run: | | |
| mkdir -p $HOME/mesa-native/lib/dri | |
| cd $HOME/mesa-native/lib/dri | |
| GALLIUM_LIB=$(ls $HOME/mesa-native/lib/libgallium-*.dylib | head -1) | |
| ln -sf "$GALLIUM_LIB" zink_dri.so | |
| ln -sf "$GALLIUM_LIB" swrast_dri.so | |
| cp /opt/homebrew/lib/libvulkan.1.dylib $HOME/mesa-native/lib/ | |
| - name: Upload built Mesa as artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: mesa-native-macos | |
| path: ~/mesa-native |