Commit 6bf3337f authored by Colin's avatar Colin
Browse files

mesa: fix cross compilation

starting with 25.0.0, mesa no longer builds CLC executables when cross compiling:
it finds the `mesa-clc` & others we explicitly provide it, decides
there's no reason to build new versions of those components, and
so cross-compiled mesa no longer produces any `cross_tools` output.

excerpted from upstream src/compiler/clc/meson.build:

```meson
if get_option('mesa-clc') != 'system' and (with_gallium_asahi or \
                                           with_asahi_vk or \
                                           with_intel_vk or \
                                           with_gallium_iris or \
                                           get_option('install-mesa-clc'))
  prog_mesa_clc = executable(
    'mesa_clc',
    ['mesa_clc.c'],
    include_directories : [inc_include, inc_src],
    c_args : [pre_args, no_override_init_args],
    link_args : [ld_args_build_id],
    dependencies : [idep_mesaclc, dep_llvm, dep_spirv_tools, idep_getopt],
    # If we can run host binaries directly, just build mesa_clc for the host.
    # Most commonly this happens when doing a cross compile from an x86_64 build
    # machine to an x86 host
    native : not meson.can_run_host_binaries(),
    install : get_option('install-mesa-clc'),
  )
endif
```
parent 2d9e4457
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -172,7 +172,13 @@ in stdenv.mkDerivation {
    # libspirv2dxil itself is pretty chonky, so relocate it to its own output in
    # case anything wants to use it at some point
    "spirv2dxil"
    # tools for the host platform to be used when cross-compiling
  ] ++ lib.optionals (!needNativeCLC) [
    # tools for the host platform to be used when cross-compiling.
    # mesa builds these only when not already built. hence:
    # - for a non-cross build (needNativeCLC = false), we do not provide mesa
    #   with any `*-clc` binaries, so it builds them and installs them.
    # - for a cross build (needNativeCLC = true), we provide mesa with `*-clc`
    #   binaries, so it skips building & installing any new CLC files.
    "cross_tools"
  ];