summaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/li/libvdpau/package.nix
blob: 5942fc8ddc465b0bd9ea06ba6ac2d9c6b2981b79 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
{
  lib,
  stdenv,
  fetchurl,
  pkg-config,
  libxext,
  libx11,
  xorgproto,
  mesa,
  meson,
  ninja,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "libvdpau";
  version = "1.5";

  src = fetchurl {
    url = "https://gitlab.freedesktop.org/vdpau/libvdpau/-/archive/${finalAttrs.version}/libvdpau-${finalAttrs.version}.tar.bz2";
    sha256 = "sha256-pdUKQrjCiP68BxUatkOsjeBqGERpZcckH4m06BCCGRM=";
  };
  patches = [ ./tracing.patch ];

  outputs = [
    "out"
    "dev"
  ];

  nativeBuildInputs = [
    meson
    ninja
    pkg-config
  ];
  buildInputs = [
    xorgproto
    libxext
  ];

  propagatedBuildInputs = [ libx11 ];

  mesonFlags = lib.optionals stdenv.hostPlatform.isLinux [
    "-Dmoduledir=${mesa.driverLink}/lib/vdpau"
  ];

  env = lib.optionalAttrs stdenv.hostPlatform.isDarwin {
    NIX_LDFLAGS = "-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 = {
    homepage = "https://www.freedesktop.org/wiki/Software/VDPAU/";
    description = "Library to use the Video Decode and Presentation API for Unix (VDPAU)";
    license = lib.licenses.mit; # expat version
    platforms = lib.platforms.unix;
    maintainers = [ lib.maintainers.vcunat ];
  };
})