Update mesa-macos.yml #10
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 # latest Apple Silicon runner | |
| 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 | |
| - name: Install Python packages (packaging, mako, pyyaml) via pip | |
| run: | | |
| python3 -m pip install --user --break-system-packages packaging mako pyyaml | |
| # Ensure user site-packages are in PYTHONPATH | |
| 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: Set up environment (PATH, PKG_CONFIG_PATH, and compiler flags) | |
| 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 |