about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/phonon/backends/gstreamer.nix
blob: 73c27e9d8c1bc43fda54c251da7f3436e4c0b717 (plain) (blame)
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
63
64
65
66
67
68
69
70
71
72
73
74
75
{ stdenv, lib, fetchurl, fetchpatch, cmake, gst_all_1, phonon, pkg-config
, extra-cmake-modules, qttools, qtbase, qtx11extras
, debug ? false
}:

with lib;

stdenv.mkDerivation rec {
  pname = "phonon-backend-gstreamer";
  version = "4.10.0";

  meta = with lib; {
    homepage = "https://phonon.kde.org/";
    description = "GStreamer backend for Phonon";
    platforms = platforms.linux;
    maintainers = with maintainers; [ ttuegel ];
    license = licenses.lgpl21;
  };

  src = fetchurl {
    url = "mirror://kde/stable/phonon/${pname}/${version}/${pname}-${version}.tar.xz";
    sha256 = "1wk1ip2w7fkh65zk6rilj314dna0hgsv2xhjmpr5w08xa8sii1y5";
  };

  patches = [
    # Hardcode paths to useful plugins so the backend doesn't depend
    # on system paths being set.
    ./gst-plugin-paths.patch

    # Work around https://bugs.kde.org/show_bug.cgi?id=445196 until a new release.
    (fetchpatch {
      url = "https://invent.kde.org/libraries/phonon-gstreamer/-/commit/bbbb160f30a394655cff9398d17961142388b0f2.patch";
      sha256 = "sha256-tNBqVt67LNb9SQogS9ol8/xYIZvVSoVUgXQahMfkFh8=";
    })
  ];

  dontWrapQtApps = true;

  NIX_CFLAGS_COMPILE =
    let gstPluginPaths =
          lib.makeSearchPathOutput "lib" "/lib/gstreamer-1.0"
          (with gst_all_1; [
            gstreamer
            gst-plugins-base
            gst-plugins-good
            gst-plugins-ugly
            gst-plugins-bad
            gst-libav
          ]);
    in toString [
      # This flag should be picked up through pkg-config, but it isn't.
      "-I${gst_all_1.gstreamer.dev}/lib/gstreamer-1.0/include"

      ''-DGST_PLUGIN_PATH_1_0="${gstPluginPaths}"''
    ];

  buildInputs = with gst_all_1; [
    gstreamer
    gst-plugins-base
    phonon
    qtbase
    qtx11extras
  ];

  nativeBuildInputs = [
    cmake
    pkg-config
    extra-cmake-modules
    qttools
  ];

  cmakeFlags = [
    "-DCMAKE_BUILD_TYPE=${if debug then "Debug" else "Release"}"
  ];
}