Update mesa-macos.yml #24
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: | | |
| # 1. Proteger los encabezados de Clang eliminando UNUSED | |
| perl -i.bak -pe 's/^(#include "clc_helpers\.h")/#undef UNUSED\n$1/' src/compiler/clc/clc_helpers.cpp | |
| # 2. Corregir el espacio de nombres de Clang | |
| perl -i.bak -pe 's/Driver::GetResourcesPath/clang::GetResourcesPath/g' src/compiler/clc/clc_helpers.cpp | |
| # 3. Eliminar la dependencia de la macro reemplazándola por sintaxis nativa de C++17 | |
| perl -i.bak -pe 's/ASSERTED/[[maybe_unused]]/g' src/compiler/clc/clc_helpers.cpp | |
| - name: Create native.ini with Homebrew dependencies | |
| working-directory: mesa | |
| run: | | |
| cat > native.ini << 'EOF' | |
| [binaries] | |
| bison = '/opt/homebrew/opt/bison/bin/bison' | |
| llvm-config = '/opt/homebrew/opt/llvm/bin/llvm-config' | |
| 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 |