Merge branch 'staging' into mesa_3

This commit is contained in:
Matthew Bauer
2019-05-02 17:37:20 -04:00
committed by GitHub
11257 changed files with 487606 additions and 251763 deletions
+60 -54
View File
@@ -2,12 +2,14 @@
, pkgconfig, intltool, autoreconfHook
, file, expat, libdrm, xorg, wayland, wayland-protocols, openssl
, llvmPackages, libffi, libomxil-bellagio, libva-minimal
, libelf, libvdpau, valgrind-light, python2
, libelf, libvdpau, valgrind-light, python2, python2Packages
, libglvnd
, enableRadv ? true
, galliumDrivers ? null
, driDrivers ? null
, vulkanDrivers ? null
, eglPlatforms ? [ "x11" ] ++ lib.optionals stdenv.isLinux [ "wayland" "drm" ]
, OpenGL, Xplugin
}:
/** Packaging design:
@@ -23,28 +25,27 @@
with stdenv.lib;
if ! lists.elem stdenv.system platforms.mesaPlatforms then
if ! elem stdenv.hostPlatform.system platforms.mesaPlatforms then
throw "${stdenv.system}: unsupported platform for Mesa"
else
let
inherit (stdenv) hostPlatform;
# platforms that have PCIe slots and thus can use most non-integrated GPUs
pciePlatform = !hostPlatform.isAarch32 && !hostPlatform.isAarch64;
defaultGalliumDrivers = [ "virgl" ]
pciePlatform = !stdenv.hostPlatform.isAarch32 && !stdenv.hostPlatform.isAarch64;
defaultGalliumDrivers = optionals (elem "drm" eglPlatforms) ([ "virgl" ]
++ lib.optionals pciePlatform [ "r300" "r600" "radeonsi" ]
++ lib.optionals (pciePlatform || hostPlatform.isAarch32 || hostPlatform.isAarch64) [ "nouveau" ]
++ lib.optionals hostPlatform.isx86 [ "i915" "svga" ]
++ lib.optionals (hostPlatform.isAarch32 || hostPlatform.isAarch64) [ "vc4" ]
++ lib.optionals hostPlatform.isAarch64 [ "freedreno" "etnaviv" "imx" ]
;
defaultDriDrivers = [ ]
++ lib.optionals (pciePlatform || stdenv.hostPlatform.isAarch32 || stdenv.hostPlatform.isAarch64) [ "nouveau" ]
++ lib.optionals stdenv.hostPlatform.isx86 [ "i915" "svga" ]
++ lib.optionals (stdenv.hostPlatform.isAarch32 || stdenv.hostPlatform.isAarch64) [ "vc4" ]
++ lib.optionals stdenv.hostPlatform.isAarch64 [ "freedreno" "etnaviv" "imx" ]
);
defaultDriDrivers = optionals (elem "drm" eglPlatforms) ([ ]
++ lib.optionals pciePlatform [ "radeon" "r200" ]
++ lib.optionals (pciePlatform || hostPlatform.isAarch32 || hostPlatform.isAarch64) [ "nouveau" ]
++ lib.optionals hostPlatform.isx86 [ "i915" "i965" ];
defaultVulkanDrivers =
lib.optional hostPlatform.isx86 "intel"
++ lib.optional enableRadv "radeon";
++ lib.optionals (pciePlatform || stdenv.hostPlatform.isAarch32 || stdenv.hostPlatform.isAarch64) [ "nouveau" ]
++ lib.optionals stdenv.hostPlatform.isx86 [ "i915" "i965" ]);
defaultVulkanDrivers = optionals stdenv.hostPlatform.isLinux ([ ]
++ lib.optional stdenv.hostPlatform.isx86 "intel"
++ lib.optional enableRadv "radeon");
in
let gallium_ = galliumDrivers; dri_ = driDrivers; vulkan_ = vulkanDrivers; in
@@ -54,11 +55,11 @@ let
(if gallium_ == null
then defaultGalliumDrivers
else gallium_)
++ ["swrast" "virgl"];
++ lib.optional stdenv.isLinux "swrast";
driDrivers =
(if dri_ == null
then defaultDriDrivers
else dri_) ++ ["swrast"];
then optionals (elem "drm" eglPlatforms) defaultDriDrivers
else dri_) ++ lib.optional stdenv.isLinux "swrast";
vulkanDrivers =
if vulkan_ == null
then defaultVulkanDrivers
@@ -66,7 +67,7 @@ let
in
let
version = "18.1.5";
version = "18.3.4";
branch = head (splitString "." version);
in
@@ -80,7 +81,7 @@ let self = stdenv.mkDerivation {
"ftp://ftp.freedesktop.org/pub/mesa/older-versions/${branch}.x/${version}/mesa-${version}.tar.xz"
"https://mesa.freedesktop.org/archive/mesa-${version}.tar.xz"
];
sha256 = "69dbe6f1a6660386f5beb85d4fcf003ee23023ed7b9a603de84e9a37e8d98dea";
sha256 = "01xv03ah4l5lcfx015n3fg1620dh4nbbv6gmhh6zhdsx6sj4sc9j";
};
prePatch = "patchShebangs .";
@@ -94,7 +95,8 @@ let self = stdenv.mkDerivation {
./disk_cache-include-dri-driver-path-in-cache-key.patch
];
outputs = [ "out" "dev" "drivers" "osmesa" ];
outputs = [ "out" "dev" "drivers" ]
++ lib.optional (elem "swrast" galliumDrivers) "osmesa";
# TODO: Figure out how to enable opencl without having a runtime dependency on clang
configureFlags = [
@@ -102,18 +104,11 @@ let self = stdenv.mkDerivation {
"--localstatedir=/var"
"--with-dri-driverdir=$(drivers)/lib/dri"
"--with-dri-searchpath=${libglvnd.driverLink}/lib/dri"
"--with-platforms=x11,wayland,drm"
]
++ (optional (galliumDrivers != [])
("--with-gallium-drivers=" +
builtins.concatStringsSep "," galliumDrivers))
++ (optional (driDrivers != [])
("--with-dri-drivers=" +
builtins.concatStringsSep "," driDrivers))
++ (optional (vulkanDrivers != [])
("--with-vulkan-drivers=" +
builtins.concatStringsSep "," vulkanDrivers))
++ [
"--with-platforms=${concatStringsSep "," eglPlatforms}"
"--with-gallium-drivers=${concatStringsSep "," galliumDrivers}"
"--with-dri-drivers=${concatStringsSep "," driDrivers}"
"--with-vulkan-drivers=${concatStringsSep "," vulkanDrivers}"
"--enable-texture-float"
(enableFeature stdenv.isLinux "dri3")
(enableFeature stdenv.isLinux "nine") # Direct3D in Wine
"--enable-libglvnd"
@@ -124,34 +119,38 @@ let self = stdenv.mkDerivation {
"--enable-glx"
# https://bugs.freedesktop.org/show_bug.cgi?id=35268
(enableFeature (!stdenv.hostPlatform.isMusl) "glx-tls")
"--enable-gallium-osmesa" # used by wine
# used by wine
(enableFeature (elem "swrast" galliumDrivers) "gallium-osmesa")
"--enable-llvm"
"--enable-egl"
"--enable-xa" # used in vmware driver
"--enable-gbm"
(enableFeature stdenv.isLinux "egl")
(enableFeature stdenv.isLinux "xa") # used in vmware driver
(enableFeature stdenv.isLinux "gbm")
"--enable-xvmc"
"--enable-vdpau"
"--enable-shared-glapi"
"--enable-llvm-shared-libs"
"--enable-omx-bellagio"
"--enable-va"
(enableFeature stdenv.isLinux "omx-bellagio")
(enableFeature stdenv.isLinux "va")
"--disable-opencl"
];
nativeBuildInputs = [ autoreconfHook intltool pkgconfig file ];
nativeBuildInputs = [
autoreconfHook intltool pkgconfig file
python2 python2Packages.Mako
];
propagatedBuildInputs = with xorg;
[ libXdamage libXxf86vm ]
++ optional stdenv.isLinux libdrm;
propagatedBuildInputs = with xorg; [
libXdamage libXxf86vm
] ++ optional stdenv.isLinux libdrm
++ optionals stdenv.isDarwin [ OpenGL Xplugin ];
buildInputs = with xorg; [
expat llvmPackages.llvm libglvnd
glproto dri2proto dri3proto presentproto
libX11 libXext libxcb libXt libXfixes libxshmfence
libffi wayland wayland-protocols libvdpau libelf libXvMC
libomxil-bellagio libva-minimal libpthreadstubs openssl/*or another sha1 provider*/
valgrind-light python2 python2.pkgs.Mako
];
expat llvmPackages.llvm libglvnd xorgproto
libX11 libXext libxcb libXt libXfixes libxshmfence libXrandr
libffi libvdpau libelf libXvMC
libpthreadstubs openssl /*or another sha1 provider*/
] ++ lib.optionals (elem "wayland" eglPlatforms) [ wayland wayland-protocols ]
++ lib.optionals stdenv.isLinux [ valgrind-light libomxil-bellagio libva-minimal ];
enableParallelBuilding = true;
doCheck = false;
@@ -164,6 +163,9 @@ let self = stdenv.mkDerivation {
# TODO: probably not all .la files are completely fixed, but it shouldn't matter;
postInstall = ''
# Some installs don't have any drivers so this directory is never created.
mkdir -p $drivers
'' + optionalString (galliumDrivers != []) ''
# move gallium-related stuff to $drivers, so $out doesn't depend on LLVM
mv -t "$drivers/lib/" \
$out/lib/libXvMC* \
@@ -217,7 +219,7 @@ let self = stdenv.mkDerivation {
# TODO:
# check $out doesn't depend on llvm: builder failures are ignored
# for some reason grep -qv '${llvmPackages.llvm}' -R "$out";
postFixup = ''
postFixup = optionalString (galliumDrivers != []) ''
# add RPATH so the drivers can find the moved libgallium and libdricore9
# moved here to avoid problems with stripping patchelfed files
for lib in $drivers/lib/*.so* $drivers/lib/*/*.so*; do
@@ -237,7 +239,9 @@ let self = stdenv.mkDerivation {
# Use stub libraries from libglvnd and headers from Mesa.
buildCommand = ''
ln -s ${libglvnd.out} $out
mkdir -p $out/nix-support
ln -s ${libglvnd.out}/lib $out/lib
mkdir -p $dev/{,lib/pkgconfig,nix-support}
echo "$out" > $dev/nix-support/propagated-build-inputs
ln -s ${self.dev}/include $dev/include
@@ -259,6 +263,8 @@ let self = stdenv.mkDerivation {
genPkgConfig egl EGL
genPkgConfig glesv1_cm GLESv1_CM
genPkgConfig glesv2 GLESv2
'' + lib.optionalString stdenv.isDarwin ''
echo ${OpenGL} > $out/nix-support/propagated-build-inputs
'';
};
};
@@ -267,7 +273,7 @@ let self = stdenv.mkDerivation {
description = "An open source implementation of OpenGL";
homepage = https://www.mesa3d.org/;
license = licenses.mit; # X11 variant, in most files
platforms = platforms.linux;
platforms = platforms.linux ++ platforms.darwin;
maintainers = with maintainers; [ vcunat ];
};
};