Skip to content

Commit

Permalink
mesa: fix cross compilation to x86_64
Browse files Browse the repository at this point in the history
In particular, fix cross compilation of rusticl.
  • Loading branch information
alyssais committed Nov 9, 2023
1 parent 506dcaa commit 6247bd0
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions pkgs/development/libraries/mesa/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ stdenv, lib, fetchurl, fetchpatch
{ stdenv, lib, fetchurl, fetchpatch, buildPackages
, meson, pkg-config, ninja
, intltool, bison, flex, file, python3Packages, wayland-scanner
, expat, libdrm, xorg, wayland, wayland-protocols, openssl
Expand Down Expand Up @@ -66,7 +66,6 @@
, enablePatentEncumberedCodecs ? true
, jdupes
, rustc
, rust-bindgen
, spirv-llvm-translator
, zstd
, directx-headers
Expand Down Expand Up @@ -98,9 +97,9 @@ let
# Align all the Mesa versions used. Required to prevent explosions when
# two different LLVMs are loaded in the same process.
# FIXME: these should really go into some sort of versioned LLVM package set
rust-bindgen' = rust-bindgen.override {
rust-bindgen-unwrapped = rust-bindgen.unwrapped.override {
clang = llvmPackages.clang;
rust-bindgen' = buildPackages.rust-bindgen.override {
rust-bindgen-unwrapped = buildPackages.rust-bindgen.unwrapped.override {
clang = buildPackages.llvmPackages_15.clang;
};
};
spirv-llvm-translator' = spirv-llvm-translator.override {
Expand Down Expand Up @@ -201,7 +200,8 @@ self = stdenv.mkDerivation {
"-Dglvnd=true"

# Enable RT for Intel hardware
"-Dintel-clc=enabled"
# https://gitlab.freedesktop.org/mesa/mesa/-/issues/9080
(lib.mesonEnable "intel-clc" (stdenv.buildPlatform == stdenv.hostPlatform))
] ++ lib.optionals enableOpenCL [
# Clover, old OpenCL frontend
"-Dgallium-opencl=icd"
Expand All @@ -217,27 +217,29 @@ self = stdenv.mkDerivation {
++ lib.optional (vulkanLayers != []) "-D vulkan-layers=${builtins.concatStringsSep "," vulkanLayers}";

buildInputs = with xorg; [
expat llvmPackages.libllvm libglvnd xorgproto
expat glslang llvmPackages.libllvm libglvnd xorgproto
libX11 libXext libxcb libXt libXfixes libxshmfence libXrandr
libffi libvdpau libelf libXvMC
libpthreadstubs openssl /*or another sha1 provider*/
zstd libunwind
python3Packages.python # for shebang
] ++ lib.optionals haveWayland [ wayland wayland-protocols ]
++ lib.optionals stdenv.isLinux [ libomxil-bellagio libva-minimal udev lm_sensors ]
++ lib.optionals enableOpenCL [ llvmPackages.libclc llvmPackages.clang llvmPackages.clang-unwrapped rustc rust-bindgen' spirv-llvm-translator' ]
++ lib.optionals enableOpenCL [ llvmPackages.libclc llvmPackages.clang llvmPackages.clang-unwrapped spirv-llvm-translator' ]
++ lib.optional withValgrind valgrind-light
++ lib.optional haveZink vulkan-loader
++ lib.optional haveDozen directx-headers;

depsBuildBuild = [ pkg-config ];
depsBuildBuild = [ pkg-config ]
++ lib.optional enableOpenCL buildPackages.stdenv.cc;

nativeBuildInputs = [
meson pkg-config ninja
intltool bison flex file
python3Packages.python python3Packages.mako python3Packages.ply
jdupes glslang
] ++ lib.optional haveWayland wayland-scanner;
] ++ lib.optionals enableOpenCL [ rust-bindgen' rustc ]
++ lib.optional haveWayland wayland-scanner;

propagatedBuildInputs = with xorg; [
libXdamage libXxf86vm
Expand Down

0 comments on commit 6247bd0

Please sign in to comment.