diff options
author | Alyssa Ross <hi@alyssa.is> | 2019-06-12 09:59:45 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2019-06-18 18:14:17 +0000 |
commit | c5571a126859eb658ffd7340cb580f7d91f12bb6 (patch) | |
tree | 577573c3bf14d9849246d52daece719a10eaf138 /nixpkgs/pkgs/development/libraries/mesa/default.nix | |
parent | 828bd4e8ddcbcd354ddfd99f55af69ee8ff5d9e7 (diff) | |
parent | 98e3b90b6c8f400ae5438ef868eb992a64b75ce5 (diff) | |
download | nixlib-c5571a126859eb658ffd7340cb580f7d91f12bb6.tar nixlib-c5571a126859eb658ffd7340cb580f7d91f12bb6.tar.gz nixlib-c5571a126859eb658ffd7340cb580f7d91f12bb6.tar.bz2 nixlib-c5571a126859eb658ffd7340cb580f7d91f12bb6.tar.lz nixlib-c5571a126859eb658ffd7340cb580f7d91f12bb6.tar.xz nixlib-c5571a126859eb658ffd7340cb580f7d91f12bb6.tar.zst nixlib-c5571a126859eb658ffd7340cb580f7d91f12bb6.zip |
Merge commit '98e3b90b6c8f400ae5438ef868eb992a64b75ce5'
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/mesa/default.nix')
-rw-r--r-- | nixpkgs/pkgs/development/libraries/mesa/default.nix | 87 |
1 files changed, 60 insertions, 27 deletions
diff --git a/nixpkgs/pkgs/development/libraries/mesa/default.nix b/nixpkgs/pkgs/development/libraries/mesa/default.nix index 77ea6783b775..0724da8375e3 100644 --- a/nixpkgs/pkgs/development/libraries/mesa/default.nix +++ b/nixpkgs/pkgs/development/libraries/mesa/default.nix @@ -42,32 +42,28 @@ assert enableRadv -> libdrmSupport && llvmSupport && libelfSupport; */ if ! elem stdenv.hostPlatform.system platforms.mesaPlatforms then - throw "unsupported platform for Mesa" + throw "${stdenv.system}: unsupported platform for Mesa" else let - defaultGalliumDrivers = - optionals (elem "drm" eglPlatforms) - ([ "virgl" "nouveau" ] - ++ (if stdenv.isAarch32 then ["freedreno" "vc4" "etnaviv" "imx"] - else if stdenv.isAarch64 then [ "vc4" ] - else - ([ "svga" "i915" ] - ++ optionals llvmSupport ([ "r300" ]) - ++ optionals libelfSupport [ "r600" "radeonsi" ]))); - - defaultDriDrivers = - optionals (elem "drm" eglPlatforms) - ([ "nouveau" ] ++ - optionals (stdenv.isAarch32 || stdenv.isAarch64) - [ "i915" "i965" "radeon" "r200" ]); - - defaultVulkanDrivers = - optional enableRadv "radeon" - ++ (optional (stdenv.isLinux - && libdrmSupport - && !stdenv.isAarch32 - && !stdenv.isAarch64) "intel"); + # 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" ] + ++ optionals (pciePlatform || stdenv.hostPlatform.isAarch32 || stdenv.hostPlatform.isAarch64) [ "nouveau" ] + ++ optionals (stdenv.hostPlatform.isAarch32 || stdenv.hostPlatform.isAarch64) [ "vc4" ] + ++ optionals stdenv.hostPlatform.isAarch64 [ "freedreno" "etnaviv" "imx" ] + ++ optionals stdenv.hostPlatform.isx86 [ "svga" "i915" ] + ++ optional (pciePlatform && llvmSupport) "r300" + ++ optionals (pciePlatform && llvmSupport && libelfSupport) [ "r600" "radeonsi" ]); + + defaultDriDrivers = optionals (elem "drm" eglPlatforms) ([ ] + ++ optionals pciePlatform [ "radeon" "r200" ] + ++ optionals (pciePlatform || stdenv.hostPlatform.isAarch32 || stdenv.hostPlatform.isAarch64) [ "nouveau" ] + ++ optionals stdenv.hostPlatform.isx86 [ "i915" "i965" ]); + + defaultVulkanDrivers = optionals stdenv.hostPlatform.isLinux ([ ] + ++ optional (libdrmSupport && stdenv.hostPlatform.isx86) "intel" + ++ optional enableRadv "radeon"); gallium_ = galliumDrivers; dri_ = driDrivers; vulkan_ = vulkanDrivers; in @@ -299,12 +295,51 @@ let inherit libdrm version; inherit (libglvnd) driverLink; + # Use stub libraries from libglvnd and headers from Mesa. stubs = stdenv.mkDerivation { name = "libGL-${libglvnd.version}"; outputs = [ "out" "dev" ]; - # Use stub libraries from libglvnd and headers from Mesa. - buildCommand = '' + # On macOS, libglvnd is not supported, so we just use what mesa + # build. We need to also include OpenGL.framework, and some + # extra tricks to go along with. We add mesa’s libGLX to support + # the X extensions to OpenGL. + buildCommand = if stdenv.hostPlatform.isDarwin then '' + mkdir -p $out/nix-support $dev + echo ${OpenGL} >> $out/nix-support/propagated-build-inputs + ln -s ${self.out}/lib $out/lib + + mkdir -p $dev/lib/pkgconfig $dev/nix-support + echo "$out" > $dev/nix-support/propagated-build-inputs + ln -s ${self.dev}/include $dev/include + + cat <<EOF >$dev/lib/pkgconfig/gl.pc + Name: gl + Description: gl library + Version: ${self.version} + Libs: -L${self.out}/lib -lGL + Cflags: -I${self.dev}/include + EOF + + cat <<EOF >$dev/lib/pkgconfig/glesv1_cm.pc + Name: glesv1_cm + Description: glesv1_cm library + Version: ${self.version} + Libs: -L${self.out}/lib -lGLESv1_CM + Cflags: -I${self.dev}/include + EOF + + cat <<EOF >$dev/lib/pkgconfig/glesv2.pc + Name: glesv2 + Description: glesv2 library + Version: ${self.version} + Libs: -L${self.out}/lib -lGLESv2 + Cflags: -I${self.dev}/include + EOF + '' + + # Otherwise, setup gl stubs to use libglvnd. + else '' mkdir -p $out/nix-support ln -s ${libglvnd.out}/lib $out/lib @@ -329,8 +364,6 @@ let genPkgConfig egl EGL genPkgConfig glesv1_cm GLESv1_CM genPkgConfig glesv2 GLESv2 - '' + lib.optionalString stdenv.isDarwin '' - echo ${OpenGL} > $out/nix-support/propagated-build-inputs ''; }; }; |