diff --git a/pkgs/by-name/li/libvdpau/installdir.patch b/pkgs/by-name/li/libvdpau/installdir.patch deleted file mode 100644 index 859715f70d39..000000000000 --- a/pkgs/by-name/li/libvdpau/installdir.patch +++ /dev/null @@ -1,9 +0,0 @@ ---- a/trace/meson.build 2020-02-15 16:34:58.698832000 +0100 -+++ b/trace/meson.build 2020-02-15 16:39:05.359952802 +0100 -@@ -4,5 +4,5 @@ - dependencies : libdl, - version : '1.0.0', - install : true, -- install_dir : moduledir, -+ install_dir : get_option('prefix') + '/lib/libvdpau', - ) diff --git a/pkgs/by-name/li/libvdpau/package.nix b/pkgs/by-name/li/libvdpau/package.nix index 75c61995071e..37ced1abc20f 100644 --- a/pkgs/by-name/li/libvdpau/package.nix +++ b/pkgs/by-name/li/libvdpau/package.nix @@ -8,7 +8,7 @@ stdenv.mkDerivation rec { url = "https://gitlab.freedesktop.org/vdpau/libvdpau/-/archive/${version}/${pname}-${version}.tar.bz2"; sha256 = "sha256-pdUKQrjCiP68BxUatkOsjeBqGERpZcckH4m06BCCGRM="; }; - patches = [ ./installdir.patch ]; + patches = [ ./tracing.patch ]; outputs = [ "out" "dev" ]; @@ -21,6 +21,12 @@ stdenv.mkDerivation rec { NIX_LDFLAGS = lib.optionalString stdenv.hostPlatform.isDarwin "-lX11"; + # The tracing library in this package must be conditionally loaded with dlopen(). + # Therefore, we must restore the RPATH entry for the library itself that was removed by the patchelf hook. + postFixup = lib.optionalString stdenv.hostPlatform.isElf '' + patchelf $out/lib/libvdpau.so --add-rpath $out/lib + ''; + meta = with lib; { homepage = "https://www.freedesktop.org/wiki/Software/VDPAU/"; description = "Library to use the Video Decode and Presentation API for Unix (VDPAU)"; diff --git a/pkgs/by-name/li/libvdpau/tracing.patch b/pkgs/by-name/li/libvdpau/tracing.patch new file mode 100644 index 000000000000..cc4fdf88e48f --- /dev/null +++ b/pkgs/by-name/li/libvdpau/tracing.patch @@ -0,0 +1,24 @@ +diff --git a/src/vdpau_wrapper.c b/src/vdpau_wrapper.c +index 79dcb94..6249af4 100644 +--- a/src/vdpau_wrapper.c ++++ b/src/vdpau_wrapper.c +@@ -185,8 +185,7 @@ static VdpStatus _vdp_open_driver( + if (vdpau_trace && atoi(vdpau_trace)) { + SetDllHandle * set_dll_handle; + +- _vdp_trace_dll = dlopen(VDPAU_MODULEDIR "/libvdpau_trace.so.1", +- RTLD_NOW | RTLD_GLOBAL); ++ _vdp_trace_dll = dlopen("libvdpau_trace.so.1", RTLD_NOW | RTLD_GLOBAL); + if (!_vdp_trace_dll) { + fprintf(stderr, "Failed to open VDPAU trace library %s\n", dlerror()); + _VDP_ERROR_BREAKPOINT(); +diff --git a/trace/meson.build b/trace/meson.build +index 5381b8b..4af408f 100644 +--- a/trace/meson.build ++++ b/trace/meson.build +@@ -4,5 +4,4 @@ trace = shared_library('vdpau_trace', + dependencies : libdl, + version : '1.0.0', + install : true, +- install_dir : moduledir, + )