summary refs log tree commit diff
path: root/pkgs/development/libraries/egl-wayland/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/libraries/egl-wayland/default.nix')
-rw-r--r--pkgs/development/libraries/egl-wayland/default.nix57
1 files changed, 21 insertions, 36 deletions
diff --git a/pkgs/development/libraries/egl-wayland/default.nix b/pkgs/development/libraries/egl-wayland/default.nix
index e6468abf4ed..d3ff8a8af0f 100644
--- a/pkgs/development/libraries/egl-wayland/default.nix
+++ b/pkgs/development/libraries/egl-wayland/default.nix
@@ -1,6 +1,8 @@
 { lib
 , stdenv
 , fetchFromGitHub
+, fetchpatch
+, eglexternalplatform
 , pkg-config
 , meson
 , ninja
@@ -12,35 +14,7 @@
 , wayland-protocols
 }:
 
-let
-  eglexternalplatform = stdenv.mkDerivation {
-    pname = "eglexternalplatform";
-    version = "1.1";
-
-    src = fetchFromGitHub {
-      owner = "Nvidia";
-      repo = "eglexternalplatform";
-      rev = "7c8f8e2218e46b1a4aa9538520919747f1184d86";
-      sha256 = "0lr5s2xa1zn220ghmbsiwgmx77l156wk54c7hybia0xpr9yr2nhb";
-    };
-
-    installPhase = ''
-      mkdir -p "$out/include/"
-      cp interface/eglexternalplatform.h "$out/include/"
-      cp interface/eglexternalplatformversion.h "$out/include/"
-
-      substituteInPlace eglexternalplatform.pc \
-        --replace "/usr/include/EGL" "$out/include"
-      mkdir -p "$out/share/pkgconfig"
-      cp eglexternalplatform.pc "$out/share/pkgconfig/"
-    '';
-
-    meta = with lib; {
-      license = licenses.mit;
-    };
-  };
-
-in stdenv.mkDerivation rec {
+stdenv.mkDerivation rec {
   pname = "egl-wayland";
   version = "1.1.11";
 
@@ -53,6 +27,21 @@ in stdenv.mkDerivation rec {
     sha256 = "sha256-xb0d8spr4GoGZl/8C8BoPMPN7PAlzuQV11tEJbOQQ4U=";
   };
 
+  patches = [
+    # remove after next update
+    # https://github.com/NVIDIA/egl-wayland/pull/79
+    (fetchpatch {
+      url = "https://github.com/NVIDIA/egl-wayland/commit/13737c6af4c0a7cfef5ec9013a4382bbeb7b495c.patch";
+      hash = "sha256-EEqI6iJb+uv0HkhnauYNxSzny4YapTm73PLgK8A9Km8=";
+    })
+  ];
+
+  postPatch = ''
+    # Declares an includedir but doesn't install any headers
+    # CMake's `pkg_check_modules(NAME wayland-eglstream IMPORTED_TARGET)` considers this an error
+    sed -i -e '/includedir/d' wayland-eglstream.pc.in
+  '';
+
   depsBuildBuild = [
     pkg-config
   ];
@@ -65,7 +54,6 @@ in stdenv.mkDerivation rec {
   ];
 
   buildInputs = [
-    eglexternalplatform
     libGL
     libX11
     libdrm
@@ -73,12 +61,9 @@ in stdenv.mkDerivation rec {
     wayland-protocols
   ];
 
-  postFixup = ''
-    # Doubled prefix in pc file after postbuild hook replaces includedir prefix variable with dev output path
-    substituteInPlace $dev/lib/pkgconfig/wayland-eglstream.pc \
-      --replace "=$dev/$dev" "=$dev" \
-      --replace "Requires:" "Requires.private:"
-  '';
+  propagatedBuildInputs = [
+    eglexternalplatform
+  ];
 
   meta = with lib; {
     description = "The EGLStream-based Wayland external platform";