From c2ebb395cadfd081c015f7da5034b12c145bf6bc Mon Sep 17 00:00:00 2001 From: Atemu Date: Thu, 23 Feb 2023 18:42:52 +0100 Subject: [PATCH] mesa: refactor for multi-version setup --- pkgs/development/libraries/mesa/22.nix | 4 ++++ .../libraries/mesa/{default.nix => generic.nix} | 10 ++++++---- pkgs/top-level/all-packages.nix | 5 ++--- 3 files changed, 12 insertions(+), 7 deletions(-) create mode 100644 pkgs/development/libraries/mesa/22.nix rename pkgs/development/libraries/mesa/{default.nix => generic.nix} (98%) diff --git a/pkgs/development/libraries/mesa/22.nix b/pkgs/development/libraries/mesa/22.nix new file mode 100644 index 000000000000..1a1127dae508 --- /dev/null +++ b/pkgs/development/libraries/mesa/22.nix @@ -0,0 +1,4 @@ +import ./generic.nix { + version = "22.3.7"; + hash = "sha256-iUzi9KHC52F3zdIoRiAZLQ2jBmskPuwvux18838TBCw="; +} diff --git a/pkgs/development/libraries/mesa/default.nix b/pkgs/development/libraries/mesa/generic.nix similarity index 98% rename from pkgs/development/libraries/mesa/default.nix rename to pkgs/development/libraries/mesa/generic.nix index 83643e423f74..ff2d445a2be8 100644 --- a/pkgs/development/libraries/mesa/default.nix +++ b/pkgs/development/libraries/mesa/generic.nix @@ -1,8 +1,10 @@ +{ version, hash }: + { stdenv, lib, fetchurl , meson, pkg-config, ninja , intltool, bison, flex, file, python3Packages, wayland-scanner , expat, libdrm, xorg, wayland, wayland-protocols, openssl -, llvmPackages, libffi, libomxil-bellagio, libva-minimal +, llvmPackages_15, libffi, libomxil-bellagio, libva-minimal , libelf, libvdpau , libglvnd, libunwind , vulkan-loader, glslang @@ -88,11 +90,11 @@ let # Release calendar: https://www.mesa3d.org/release-calendar.html # Release frequency: https://www.mesa3d.org/releasing.html#schedule - version = "22.3.7"; - branch = lib.versions.major version; + branch = lib.versions.major version; withLibdrm = lib.meta.availableOn stdenv.hostPlatform libdrm; + llvmPackages = llvmPackages_15; # 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 @@ -120,7 +122,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" ]; - hash = "sha256-iUzi9KHC52F3zdIoRiAZLQ2jBmskPuwvux18838TBCw="; + inherit hash; }; # TODO: diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 08f1a8ed479b..c497dd755caf 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -22505,12 +22505,11 @@ with pkgs; # Default libGLU libGLU = mesa_glu; - mesa = callPackage ../development/libraries/mesa { - llvmPackages = llvmPackages_15; - stdenv = if stdenv.isDarwin then darwin.apple_sdk_11_0.stdenv else stdenv; + mesa_22 = darwin.apple_sdk_11_0.callPackage ../development/libraries/mesa/22.nix { inherit (darwin.apple_sdk_11_0.frameworks) OpenGL; inherit (darwin.apple_sdk_11_0.libs) Xplugin; }; + mesa = mesa_22; mesa_glu = callPackage ../development/libraries/mesa-glu { inherit (darwin.apple_sdk.frameworks) ApplicationServices;