diff options
author | Alyssa Ross <hi@alyssa.is> | 2021-10-19 14:40:23 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2022-01-07 10:22:32 +0000 |
commit | cc62bcb55359ba8c5e0fe3a48e778444c89060d8 (patch) | |
tree | ca0e21d44eaf8837b687395e614445f7761d7bbd /nixpkgs/pkgs/development/libraries/mesa/default.nix | |
parent | d6625e8d25efd829c3cfa227d025ca4e606ae4b7 (diff) | |
parent | a323570a264da96a0b0bcc1c9aa017794acdc752 (diff) | |
download | nixlib-cc62bcb55359ba8c5e0fe3a48e778444c89060d8.tar nixlib-cc62bcb55359ba8c5e0fe3a48e778444c89060d8.tar.gz nixlib-cc62bcb55359ba8c5e0fe3a48e778444c89060d8.tar.bz2 nixlib-cc62bcb55359ba8c5e0fe3a48e778444c89060d8.tar.lz nixlib-cc62bcb55359ba8c5e0fe3a48e778444c89060d8.tar.xz nixlib-cc62bcb55359ba8c5e0fe3a48e778444c89060d8.tar.zst nixlib-cc62bcb55359ba8c5e0fe3a48e778444c89060d8.zip |
Merge commit 'a323570a264da96a0b0bcc1c9aa017794acdc752'
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/mesa/default.nix')
-rw-r--r-- | nixpkgs/pkgs/development/libraries/mesa/default.nix | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/nixpkgs/pkgs/development/libraries/mesa/default.nix b/nixpkgs/pkgs/development/libraries/mesa/default.nix index 81d553547c3f..1d7b73a54196 100644 --- a/nixpkgs/pkgs/development/libraries/mesa/default.nix +++ b/nixpkgs/pkgs/development/libraries/mesa/default.nix @@ -13,6 +13,8 @@ , withValgrind ? !stdenv.isDarwin && lib.meta.availableOn stdenv.hostPlatform valgrind-light, valgrind-light , enableGalliumNine ? stdenv.isLinux , enableOSMesa ? stdenv.isLinux +, enableOpenCL ? stdenv.isLinux && stdenv.isx86_64 +, libclc }: /** Packaging design: @@ -31,7 +33,7 @@ with lib; let # Release calendar: https://www.mesa3d.org/release-calendar.html # Release frequency: https://www.mesa3d.org/releasing.html#schedule - version = "21.2.2"; + version = "21.2.3"; branch = versions.major version; self = stdenv.mkDerivation { @@ -45,7 +47,7 @@ self = stdenv.mkDerivation { "ftp://ftp.freedesktop.org/pub/mesa/${version}/mesa-${version}.tar.xz" "ftp://ftp.freedesktop.org/pub/mesa/older-versions/${branch}.x/${version}/mesa-${version}.tar.xz" ]; - sha256 = "1i75k6gh76f49vy6kksbsikf593jmgk6slqwbs1fs5s2jyzz3an4"; + sha256 = "0x3ivd34j938js2iffzlvnlj4hwywxrscd8q1rvq894x2m52hibj"; }; # TODO: @@ -53,7 +55,7 @@ self = stdenv.mkDerivation { # ~35 MB in $drivers; watch https://launchpad.net/ubuntu/+source/mesa/+changelog patches = [ ./missing-includes.patch # dev_t needs sys/stat.h, time_t needs time.h, etc.-- fixes build w/musl - ./opencl-install-dir.patch + ./opencl.patch ./disk_cache-include-dri-driver-path-in-cache-key.patch # Fix `-Werror=int-conversion` pthread warnings on musl. # TODO: Remove when https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6121 is merged and available @@ -88,7 +90,8 @@ self = stdenv.mkDerivation { outputs = [ "out" "dev" "drivers" ] ++ lib.optional enableOSMesa "osmesa" - ++ lib.optional stdenv.isLinux "driversdev"; + ++ lib.optional stdenv.isLinux "driversdev" + ++ lib.optional enableOpenCL "opencl"; # TODO: Figure out how to enable opencl without having a runtime dependency on clang mesonFlags = [ @@ -118,6 +121,9 @@ self = stdenv.mkDerivation { "-Dmicrosoft-clc=disabled" # Only relevant on Windows (OpenCL 1.2 API on top of D3D12) ] ++ optionals stdenv.isLinux [ "-Dglvnd=true" + ] ++ optionals enableOpenCL [ + "-Dgallium-opencl=icd" # Enable the gallium OpenCL frontend + "-Dclang-libdir=${llvmPackages.clang-unwrapped.lib}/lib" ]; buildInputs = with xorg; [ @@ -128,6 +134,7 @@ self = stdenv.mkDerivation { ] ++ lib.optionals (elem "wayland" eglPlatforms) [ wayland wayland-protocols ] ++ lib.optionals stdenv.isLinux [ libomxil-bellagio libva-minimal ] ++ lib.optionals stdenv.isDarwin [ libunwind ] + ++ lib.optionals enableOpenCL [ libclc llvmPackages.clang llvmPackages.clang-unwrapped ] ++ lib.optional withValgrind valgrind-light; depsBuildBuild = [ pkg-config ]; @@ -162,7 +169,7 @@ self = stdenv.mkDerivation { if [ -n "$(shopt -s nullglob; echo "$out"/lib/lib*_mesa*)" ]; then # Move other drivers to a separate output - mv $out/lib/lib*_mesa* $drivers/lib + mv -t $drivers/lib $out/lib/lib*_mesa* fi # Update search path used by glvnd @@ -175,6 +182,17 @@ self = stdenv.mkDerivation { for js in $drivers/share/vulkan/icd.d/*.json; do substituteInPlace "$js" --replace "$out" "$drivers" done + '' + optionalString enableOpenCL '' + # Move OpenCL stuff + mkdir -p $opencl/lib + mv -t "$opencl/lib/" \ + $out/lib/gallium-pipe \ + $out/lib/libMesaOpenCL* + + # We construct our own .icd file that contains an absolute path. + rm -r $out/etc/OpenCL + mkdir -p $opencl/etc/OpenCL/vendors/ + echo $opencl/lib/libMesaOpenCL.so > $opencl/etc/OpenCL/vendors/mesa.icd '' + lib.optionalString enableOSMesa '' # move libOSMesa to $osmesa, as it's relatively big mkdir -p $osmesa/lib @@ -209,7 +227,10 @@ self = stdenv.mkDerivation { done ''; - NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isDarwin "-fno-common"; + NIX_CFLAGS_COMPILE = optionals stdenv.isDarwin [ "-fno-common" ] ++ lib.optionals enableOpenCL [ + "-UPIPE_SEARCH_DIR" + "-DPIPE_SEARCH_DIR=\"${placeholder "opencl"}/lib/gallium-pipe\"" + ]; passthru = { inherit libdrm; |