mesa: fix darwin and use meson auto features (PR #63912)
This fixes the darwin build, while also using Meson’s auto features as much as possible. As a result, we avoid using having to specify default drivers and instead delegate that to Mesa’s build system. Removed other flags that were specified to the default in Mesa. The -fno-common is needed to address undefined symbol _lp_dummy_tile in the build.
This commit is contained in:
parent
ed27ba064c
commit
5c8472a2a1
@ -5,9 +5,9 @@
|
|||||||
, libelf, libvdpau, python3Packages
|
, libelf, libvdpau, python3Packages
|
||||||
, libglvnd
|
, libglvnd
|
||||||
, enableRadv ? true
|
, enableRadv ? true
|
||||||
, galliumDrivers ? null
|
, galliumDrivers ? ["auto"]
|
||||||
, driDrivers ? null
|
, driDrivers ? ["auto"]
|
||||||
, vulkanDrivers ? null
|
, vulkanDrivers ? ["auto"]
|
||||||
, eglPlatforms ? [ "x11" ] ++ lib.optionals stdenv.isLinux [ "wayland" "drm" ]
|
, eglPlatforms ? [ "x11" ] ++ lib.optionals stdenv.isLinux [ "wayland" "drm" ]
|
||||||
, OpenGL, Xplugin
|
, OpenGL, Xplugin
|
||||||
, withValgrind ? stdenv.hostPlatform.isLinux && !stdenv.hostPlatform.isAarch32, valgrind-light
|
, withValgrind ? stdenv.hostPlatform.isLinux && !stdenv.hostPlatform.isAarch32, valgrind-light
|
||||||
@ -26,43 +26,6 @@
|
|||||||
|
|
||||||
with stdenv.lib;
|
with stdenv.lib;
|
||||||
|
|
||||||
let
|
|
||||||
# platforms that have PCIe slots and thus can use most non-integrated GPUs
|
|
||||||
pciePlatform = !stdenv.hostPlatform.isAarch32 && !stdenv.hostPlatform.isAarch64;
|
|
||||||
defaultGalliumDrivers = optionals (elem "drm" eglPlatforms) ([ "virgl" ]
|
|
||||||
++ lib.optionals pciePlatform [ "r300" "r600" "radeonsi" ]
|
|
||||||
++ lib.optionals (pciePlatform || stdenv.hostPlatform.isAarch32 || stdenv.hostPlatform.isAarch64) [ "nouveau" ]
|
|
||||||
++ lib.optionals stdenv.hostPlatform.isx86 [ "svga" ]
|
|
||||||
++ lib.optionals (stdenv.hostPlatform.isAarch32 || stdenv.hostPlatform.isAarch64) [ "vc4" ]
|
|
||||||
++ lib.optionals stdenv.hostPlatform.isAarch64 [ "freedreno" "etnaviv" ]
|
|
||||||
);
|
|
||||||
defaultDriDrivers = optionals (elem "drm" eglPlatforms) ([ ]
|
|
||||||
++ lib.optionals pciePlatform [ "r200" ]
|
|
||||||
++ 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 "amd");
|
|
||||||
in
|
|
||||||
|
|
||||||
let gallium_ = galliumDrivers; dri_ = driDrivers; vulkan_ = vulkanDrivers; in
|
|
||||||
|
|
||||||
let
|
|
||||||
galliumDrivers =
|
|
||||||
(if gallium_ == null
|
|
||||||
then defaultGalliumDrivers
|
|
||||||
else gallium_)
|
|
||||||
++ lib.optional stdenv.isLinux "swrast";
|
|
||||||
driDrivers =
|
|
||||||
(if dri_ == null
|
|
||||||
then optionals (elem "drm" eglPlatforms) defaultDriDrivers
|
|
||||||
else dri_);
|
|
||||||
vulkanDrivers =
|
|
||||||
if vulkan_ == null
|
|
||||||
then defaultVulkanDrivers
|
|
||||||
else vulkan_;
|
|
||||||
in
|
|
||||||
|
|
||||||
let
|
let
|
||||||
version = "19.1.1";
|
version = "19.1.1";
|
||||||
branch = head (splitString "." version);
|
branch = head (splitString "." version);
|
||||||
@ -110,8 +73,7 @@ stdenv.mkDerivation rec {
|
|||||||
})
|
})
|
||||||
];
|
];
|
||||||
|
|
||||||
outputs = [ "out" "dev" "drivers" ]
|
outputs = [ "out" "dev" "drivers" "osmesa" ];
|
||||||
++ lib.optional (elem "swrast" galliumDrivers) "osmesa";
|
|
||||||
|
|
||||||
# TODO: Figure out how to enable opencl without having a runtime dependency on clang
|
# TODO: Figure out how to enable opencl without having a runtime dependency on clang
|
||||||
mesonFlags = [
|
mesonFlags = [
|
||||||
@ -135,28 +97,11 @@ stdenv.mkDerivation rec {
|
|||||||
"-Domx-libs-path=${placeholder "drivers"}/lib/bellagio"
|
"-Domx-libs-path=${placeholder "drivers"}/lib/bellagio"
|
||||||
"-Dva-libs-path=${placeholder "drivers"}/lib/dri"
|
"-Dva-libs-path=${placeholder "drivers"}/lib/dri"
|
||||||
"-Dd3d-drivers-path=${placeholder "drivers"}/lib/d3d"
|
"-Dd3d-drivers-path=${placeholder "drivers"}/lib/d3d"
|
||||||
|
] ++ optionals stdenv.isLinux [
|
||||||
"-Dgallium-vdpau=true"
|
|
||||||
"-Dgallium-xvmc=true"
|
|
||||||
"-Dgallium-opencl=disabled"
|
|
||||||
"-Dshared-glapi=true"
|
|
||||||
"-Dgles1=true"
|
|
||||||
"-Dgles2=true"
|
|
||||||
"-Dglx=dri"
|
|
||||||
"-Dglvnd=true"
|
"-Dglvnd=true"
|
||||||
"-Dllvm=true"
|
"-Dosmesa=gallium" # used by wine
|
||||||
"-Dshared-llvm=true"
|
"-Dgallium-nine=true" # Direct3D in Wine
|
||||||
"-Dglx-direct=true"
|
];
|
||||||
] ++ optional (elem "swrast" galliumDrivers) "-Dosmesa=gallium" # used by wine
|
|
||||||
++ optionals (stdenv.isLinux) [
|
|
||||||
"-Ddri3=true"
|
|
||||||
"-Dgallium-omx=bellagio"
|
|
||||||
"-Dgallium-va=true"
|
|
||||||
"-Dgallium-xa=true" # used in vmware driver
|
|
||||||
"-Dgallium-nine=true" # Direct3D in Wine
|
|
||||||
"-Dgbm=true"
|
|
||||||
"-Degl=true"
|
|
||||||
];
|
|
||||||
|
|
||||||
buildInputs = with xorg; [
|
buildInputs = with xorg; [
|
||||||
expat llvmPackages.llvm libglvnd xorgproto
|
expat llvmPackages.llvm libglvnd xorgproto
|
||||||
@ -183,8 +128,8 @@ stdenv.mkDerivation rec {
|
|||||||
|
|
||||||
postInstall = ''
|
postInstall = ''
|
||||||
# Some installs don't have any drivers so this directory is never created.
|
# Some installs don't have any drivers so this directory is never created.
|
||||||
mkdir -p $drivers
|
mkdir -p $drivers $osmesa
|
||||||
'' + optionalString (galliumDrivers != []) ''
|
'' + optionalString stdenv.isLinux ''
|
||||||
mkdir -p $drivers/lib
|
mkdir -p $drivers/lib
|
||||||
|
|
||||||
# move gallium-related stuff to $drivers, so $out doesn't depend on LLVM
|
# move gallium-related stuff to $drivers, so $out doesn't depend on LLVM
|
||||||
@ -206,7 +151,7 @@ stdenv.mkDerivation rec {
|
|||||||
for js in $drivers/share/glvnd/egl_vendor.d/*.json; do
|
for js in $drivers/share/glvnd/egl_vendor.d/*.json; do
|
||||||
substituteInPlace "$js" --replace '"libEGL_' '"'"$drivers/lib/libEGL_"
|
substituteInPlace "$js" --replace '"libEGL_' '"'"$drivers/lib/libEGL_"
|
||||||
done
|
done
|
||||||
'' + optionalString (vulkanDrivers != []) ''
|
|
||||||
# Update search path used by Vulkan (it's pointing to $out but
|
# Update search path used by Vulkan (it's pointing to $out but
|
||||||
# drivers are in $drivers)
|
# drivers are in $drivers)
|
||||||
for js in $drivers/share/vulkan/icd.d/*.json; do
|
for js in $drivers/share/vulkan/icd.d/*.json; do
|
||||||
@ -217,7 +162,7 @@ stdenv.mkDerivation rec {
|
|||||||
# TODO:
|
# TODO:
|
||||||
# check $out doesn't depend on llvm: builder failures are ignored
|
# check $out doesn't depend on llvm: builder failures are ignored
|
||||||
# for some reason grep -qv '${llvmPackages.llvm}' -R "$out";
|
# for some reason grep -qv '${llvmPackages.llvm}' -R "$out";
|
||||||
postFixup = optionalString (galliumDrivers != []) ''
|
postFixup = optionalString stdenv.isLinux ''
|
||||||
# set the default search path for DRI drivers; used e.g. by X server
|
# set the default search path for DRI drivers; used e.g. by X server
|
||||||
substituteInPlace "$dev/lib/pkgconfig/dri.pc" --replace "$drivers" "${libglvnd.driverLink}"
|
substituteInPlace "$dev/lib/pkgconfig/dri.pc" --replace "$drivers" "${libglvnd.driverLink}"
|
||||||
|
|
||||||
@ -238,6 +183,8 @@ stdenv.mkDerivation rec {
|
|||||||
done
|
done
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.isDarwin "-fno-common";
|
||||||
|
|
||||||
passthru = {
|
passthru = {
|
||||||
inherit libdrm;
|
inherit libdrm;
|
||||||
inherit (libglvnd) driverLink;
|
inherit (libglvnd) driverLink;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user