summary refs log tree commit diff
path: root/pkgs/development/libraries/gstreamer/core/default.nix
blob: f0f01a977fd11cd6263698604768e446539e7bf7 (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
76
77
78
79
80
81
82
83
84
{ stdenv, fetchurl, fetchpatch, meson, ninja
, pkgconfig, gettext, gobject-introspection
, bison, flex, python3, glib, makeWrapper
, libcap,libunwind, darwin
, elfutils # for libdw
, bash-completion
, docbook_xsl, docbook_xml_dtd_412
, gtk-doc
, lib
, CoreServices
}:

stdenv.mkDerivation rec {
  pname = "gstreamer";
  version = "1.16.0";

  meta = with lib ;{
    description = "Open source multimedia framework";
    homepage = https://gstreamer.freedesktop.org;
    license = licenses.lgpl2Plus;
    platforms = platforms.unix;
    maintainers = with maintainers; [ ttuegel matthewbauer ];
  };

  src = fetchurl {
    url = "${meta.homepage}/src/gstreamer/${pname}-${version}.tar.xz";
    sha256 = "003wy1p1in85p9sr5jsyhbnwqaiwz069flwkhyx7qhxy31qjz3hf";
  };

  patches = [
    ./fix_pkgconfig_includedir.patch
  ];

  outputs = [ "out" "dev" ];
  outputBin = "dev";

  nativeBuildInputs = [
    meson ninja pkgconfig gettext bison flex python3 makeWrapper gobject-introspection
    bash-completion
    gtk-doc
    # Without these, enabling the 'gtk_doc' gives us `FAILED: meson-install`
    docbook_xsl docbook_xml_dtd_412
  ];

  buildInputs =
       lib.optionals stdenv.isLinux [ libcap libunwind elfutils ]
    ++ lib.optional stdenv.isDarwin CoreServices;

  propagatedBuildInputs = [ glib ];

  mesonFlags = [
    # Enables all features, so that we know when new dependencies are necessary.
    "-Dauto_features=enabled"
    "-Ddbghelp=disabled" # not needed as we already provide libunwind and libdw, and dbghelp is a fallback to those
    "-Dexamples=disabled" # requires many dependencies and probably not useful for our users
  ]
    # darwin.libunwind doesn't have pkgconfig definitions so meson doesn't detect it.
    ++ stdenv.lib.optionals stdenv.isDarwin [ "-Dlibunwind=disabled" "-Dlibdw=disabled" ];

  postInstall = ''
    for prog in "$dev/bin/"*; do
        # We can't use --suffix here due to quoting so we craft the export command by hand
        wrapProgram "$prog" --run "export GST_PLUGIN_SYSTEM_PATH=\$GST_PLUGIN_SYSTEM_PATH"$\{GST_PLUGIN_SYSTEM_PATH:+:\}"\$(unset _tmp; for profile in \$NIX_PROFILES; do _tmp="\$profile/lib/gstreamer-1.0''$\{_tmp:+:\}\$_tmp"; done; printf "\$_tmp")"
    done
  '';

  preConfigure=
    # These files are not executable upstream, so we need to
    # make them executable for `patchShebangs` to pick them up.
    # Can be removed when this is merged and available:
    #     https://gitlab.freedesktop.org/gstreamer/gstreamer/merge_requests/141
    ''
      chmod +x gst/parse/get_flex_version.py
    '' +
    ''
      patchShebangs .
    '';

  preFixup = ''
    moveToOutput "share/bash-completion" "$dev"
  '';

  setupHook = ./setup-hook.sh;
}