From 0e061a859577bee26f602330eccfb08123c0bf33 Mon Sep 17 00:00:00 2001 From: Rob Ashton Date: Tue, 12 Nov 2019 09:08:03 +0000 Subject: [PATCH] intel-media-driver: Fix runtime issues due to the libX11 dependency X11 is an optional run-time and optional build-time dependency of iHD. A patchelf is required to join these two worlds together, and a lot of machines that'll run the intel-media-driver won't have X11 on them, so make it optional. Fix #73236. Co-Authored-By: Michael Weiss --- .../libraries/intel-media-driver/default.nix | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/intel-media-driver/default.nix b/pkgs/development/libraries/intel-media-driver/default.nix index 153e41a777cc..6f2f543af06d 100644 --- a/pkgs/development/libraries/intel-media-driver/default.nix +++ b/pkgs/development/libraries/intel-media-driver/default.nix @@ -1,6 +1,7 @@ { stdenv, fetchFromGitHub , cmake, pkg-config -, libva, libpciaccess, intel-gmmlib, libX11 +, libva, libpciaccess, intel-gmmlib +, enableX11 ? true, libX11 }: stdenv.mkDerivation rec { @@ -23,7 +24,8 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ cmake pkg-config ]; - buildInputs = [ libva libpciaccess intel-gmmlib libX11 ]; + buildInputs = [ libva libpciaccess intel-gmmlib ] + ++ stdenv.lib.optional enableX11 libX11; meta = with stdenv.lib; { description = "Intel Media Driver for VAAPI — Broadwell+ iGPUs"; @@ -38,4 +40,9 @@ stdenv.mkDerivation rec { platforms = platforms.linux; maintainers = with maintainers; [ primeos jfrankenau ]; }; + + postFixup = stdenv.lib.optionalString enableX11 '' + patchelf --set-rpath "$(patchelf --print-rpath $out/lib/dri/iHD_drv_video.so):${stdenv.lib.makeLibraryPath [ libX11 ]}" \ + $out/lib/dri/iHD_drv_video.so + ''; }