lol
1{ stdenv
2, fetchurl
3, lib
4, pkg-config
5, meson
6, ninja
7, gettext
8, gobject-introspection
9, python3
10, gstreamer
11, orc
12, pango
13, libtheora
14, libintl
15, libopus
16, isocodes
17, libjpeg
18, libpng
19, libvisual
20, tremor # provides 'virbisidec'
21, libGL
22, enableX11 ? stdenv.isLinux
23, libXv
24, libXext
25, enableWayland ? stdenv.isLinux
26, wayland
27, wayland-protocols
28, enableAlsa ? stdenv.isLinux
29, alsa-lib
30# Enabling Cocoa seems to currently not work, giving compile
31# errors. Suspected is that a newer version than clang
32# is needed than 5.0 but it is not clear.
33, enableCocoa ? false
34, Cocoa
35, OpenGL
36, enableGl ? (enableX11 || enableWayland || enableCocoa)
37, enableCdparanoia ? (!stdenv.isDarwin)
38, cdparanoia
39, glib
40}:
41
42stdenv.mkDerivation rec {
43 pname = "gst-plugins-base";
44 version = "1.18.4";
45
46 outputs = [ "out" "dev" ];
47
48 src = fetchurl {
49 url = "https://gstreamer.freedesktop.org/src/${pname}/${pname}-${version}.tar.xz";
50 sha256 = "08w3ivbc6n4vdds2ap6q7l8zdk9if8417nznyqidf0adm0lk5r99";
51 };
52
53 patches = [
54 ./fix_pkgconfig_includedir.patch
55 ];
56
57 nativeBuildInputs = [
58 meson
59 ninja
60 pkg-config
61 python3
62 gettext
63 orc
64 glib
65 gobject-introspection
66
67 # docs
68 # TODO add hotdoc here
69 ] ++ lib.optional enableWayland wayland;
70
71 buildInputs = [
72 orc
73 libtheora
74 libintl
75 libopus
76 isocodes
77 libpng
78 libjpeg
79 tremor
80 libGL
81 ] ++ lib.optional (!stdenv.isDarwin) [
82 libvisual
83 ] ++ lib.optionals stdenv.isDarwin [
84 pango
85 OpenGL
86 ] ++ lib.optionals enableAlsa [
87 alsa-lib
88 ] ++ lib.optionals enableX11 [
89 libXext
90 libXv
91 pango
92 ] ++ lib.optionals enableWayland [
93 wayland
94 wayland-protocols
95 ] ++ lib.optional enableCocoa Cocoa
96 ++ lib.optional enableCdparanoia cdparanoia;
97
98 propagatedBuildInputs = [
99 gstreamer
100 ];
101
102 mesonFlags = [
103 "-Dexamples=disabled" # requires many dependencies and probably not useful for our users
104 "-Ddoc=disabled" # `hotdoc` not packaged in nixpkgs as of writing
105 "-Dgl-graphene=disabled" # not packaged in nixpkgs as of writing
106 # See https://github.com/GStreamer/gst-plugins-base/blob/d64a4b7a69c3462851ff4dcfa97cc6f94cd64aef/meson_options.txt#L15 for a list of choices
107 "-Dgl_winsys=${lib.concatStringsSep "," (lib.optional enableX11 "x11" ++ lib.optional enableWayland "wayland" ++ lib.optional enableCocoa "cocoa")}"
108 ] ++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [
109 "-Dintrospection=disabled"
110 "-Dtests=disabled"
111 ]
112 ++ lib.optional (!enableX11) "-Dx11=disabled"
113 # TODO How to disable Wayland?
114 ++ lib.optional (!enableGl) "-Dgl=disabled"
115 ++ lib.optional (!enableAlsa) "-Dalsa=disabled"
116 ++ lib.optional (!enableCdparanoia) "-Dcdparanoia=disabled"
117 ++ lib.optionals stdenv.isDarwin [
118 "-Dlibvisual=disabled"
119 ];
120
121 postPatch = ''
122 patchShebangs \
123 common/scangobj-merge.py \
124 scripts/extract-release-date-from-doap-file.py
125 '';
126
127 # This package has some `_("string literal")` string formats
128 # that trip up clang with format security enabled.
129 hardeningDisable = [ "format" ];
130
131 doCheck = false; # fails, wants DRI access for OpenGL
132
133 passthru = {
134 # Downstream `gst-*` packages depending on `gst-plugins-base`
135 # have meson build options like 'gl' etc. that depend
136 # on these features being built in `-base`.
137 # If they are not built here, then the downstream builds
138 # will fail, as they, too, use `-Dauto_features=enabled`
139 # which would enable these options unconditionally.
140 # That means we must communicate to these downstream packages
141 # if the `-base` enabled these options or not, so that
142 # the can enable/disable those features accordingly.
143 # The naming `*Enabled` vs `enable*` is intentional to
144 # distinguish inputs from outputs (what is to be built
145 # vs what was built) and to make them easier to search for.
146 glEnabled = enableGl;
147 waylandEnabled = enableWayland;
148 };
149
150 meta = with lib; {
151 description = "Base GStreamer plug-ins and helper libraries";
152 homepage = "https://gstreamer.freedesktop.org";
153 license = licenses.lgpl2Plus;
154 platforms = platforms.unix;
155 maintainers = with maintainers; [ matthewbauer ];
156 };
157}