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 May 23, 2023
1 parent a339507 commit 5f13c40
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions pkgs/development/libraries/mesa/generic.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{ version, hash }:

{ 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 @@ -68,7 +68,6 @@
, libclc
, jdupes
, rustc
, rust-bindgen
, spirv-llvm-translator
, zstd
, directx-headers
Expand Down Expand Up @@ -97,9 +96,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 @@ -215,27 +215,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
] ++ lib.optionals haveWayland [ wayland wayland-protocols ]
++ lib.optionals stdenv.isLinux [ libomxil-bellagio libva-minimal udev ]
++ lib.optionals stdenv.isDarwin [ libunwind ]
++ lib.optionals enableOpenCL [ libclc llvmPackages.clang llvmPackages.clang-unwrapped rustc rust-bindgen' spirv-llvm-translator' ]
++ lib.optionals enableOpenCL [ 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 5f13c40

Please sign in to comment.