1{
2 stdenv,
3 fetchurl,
4 lib,
5 pkg-config,
6 meson,
7 ninja,
8 gettext,
9 python3,
10 gstreamer,
11 graphene,
12 orc,
13 pango,
14 libtheora,
15 libintl,
16 libopus,
17 isocodes,
18 libjpeg,
19 libpng,
20 tremor, # provides 'virbisidec'
21 libGL,
22 withIntrospection ?
23 lib.meta.availableOn stdenv.hostPlatform gobject-introspection
24 && stdenv.hostPlatform.emulatorAvailable buildPackages,
25 buildPackages,
26 gobject-introspection,
27 enableX11 ? stdenv.hostPlatform.isLinux,
28 libXext,
29 libXi,
30 libXv,
31 libdrm,
32 enableWayland ? stdenv.hostPlatform.isLinux,
33 wayland-scanner,
34 wayland,
35 wayland-protocols,
36 enableAlsa ? stdenv.hostPlatform.isLinux,
37 alsa-lib,
38 enableCocoa ? stdenv.hostPlatform.isDarwin,
39 enableGl ? (enableX11 || enableWayland || enableCocoa),
40 enableCdparanoia ? (!stdenv.hostPlatform.isDarwin),
41 cdparanoia,
42 glib,
43 testers,
44 # Checks meson.is_cross_build(), so even canExecute isn't enough.
45 enableDocumentation ? stdenv.hostPlatform == stdenv.buildPlatform,
46 hotdoc,
47 directoryListingUpdater,
48 apple-sdk_gstreamer,
49}:
50
51stdenv.mkDerivation (finalAttrs: {
52 pname = "gst-plugins-base";
53 version = "1.26.0";
54
55 outputs = [
56 "out"
57 "dev"
58 ];
59
60 separateDebugInfo = true;
61
62 src = fetchurl {
63 url = "https://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-${finalAttrs.version}.tar.xz";
64 hash = "sha256-4jGJ++0uxIZpA4LRBVwZ7q9arj6V4ldvxMiE2WqQ5p4=";
65 };
66
67 strictDeps = true;
68 depsBuildBuild = [
69 pkg-config
70 ];
71 nativeBuildInputs =
72 [
73 meson
74 ninja
75 pkg-config
76 python3
77 gettext
78 orc
79 glib
80 gstreamer
81 ]
82 ++ lib.optionals withIntrospection [
83 gobject-introspection
84 ]
85 ++ lib.optionals enableDocumentation [
86 hotdoc
87 ]
88 ++ lib.optionals enableWayland [
89 wayland-scanner
90 ];
91
92 buildInputs =
93 [
94 graphene
95 orc
96 libtheora
97 libintl
98 libopus
99 isocodes
100 libpng
101 libjpeg
102 tremor
103 pango
104 ]
105 ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [
106 libdrm
107 libGL
108 ]
109 ++ lib.optionals stdenv.hostPlatform.isDarwin [
110 apple-sdk_gstreamer
111 ]
112 ++ lib.optionals enableAlsa [
113 alsa-lib
114 ]
115 ++ lib.optionals enableX11 [
116 libXext
117 libXi
118 libXv
119 ]
120 ++ lib.optionals enableWayland [
121 wayland
122 wayland-protocols
123 ]
124 ++ lib.optional enableCdparanoia cdparanoia;
125
126 propagatedBuildInputs =
127 [
128 gstreamer
129 ]
130 ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [
131 libdrm
132 ];
133
134 mesonFlags =
135 [
136 "-Dglib_debug=disabled" # cast checks should be disabled on stable releases
137 "-Dexamples=disabled" # requires many dependencies and probably not useful for our users
138 # See https://github.com/GStreamer/gst-plugins-base/blob/d64a4b7a69c3462851ff4dcfa97cc6f94cd64aef/meson_options.txt#L15 for a list of choices
139 "-Dgl_winsys=${
140 lib.concatStringsSep "," (
141 lib.optional enableX11 "x11"
142 ++ lib.optional enableWayland "wayland"
143 ++ lib.optional enableCocoa "cocoa"
144 )
145 }"
146 (lib.mesonEnable "introspection" withIntrospection)
147 (lib.mesonEnable "doc" enableDocumentation)
148 (lib.mesonEnable "libvisual" false)
149 ]
150 ++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [
151 "-Dtests=disabled"
152 ]
153 ++ lib.optionals (!enableX11) [
154 "-Dx11=disabled"
155 "-Dxi=disabled"
156 "-Dxvideo=disabled"
157 ]
158 # TODO How to disable Wayland?
159 ++ lib.optional (!enableGl) "-Dgl=disabled"
160 ++ lib.optional (!enableAlsa) "-Dalsa=disabled"
161 ++ lib.optional (!enableCdparanoia) "-Dcdparanoia=disabled"
162 ++ lib.optional stdenv.hostPlatform.isDarwin "-Ddrm=disabled";
163
164 postPatch = ''
165 patchShebangs \
166 scripts/meson-pkg-config-file-fixup.py \
167 scripts/extract-release-date-from-doap-file.py
168 '';
169
170 # This package has some `_("string literal")` string formats
171 # that trip up clang with format security enabled.
172 hardeningDisable = [ "format" ];
173
174 doCheck = false; # fails, wants DRI access for OpenGL
175
176 passthru = {
177 # Downstream `gst-*` packages depending on `gst-plugins-base`
178 # have meson build options like 'gl' etc. that depend
179 # on these features being built in `-base`.
180 # If they are not built here, then the downstream builds
181 # will fail, as they, too, use `-Dauto_features=enabled`
182 # which would enable these options unconditionally.
183 # That means we must communicate to these downstream packages
184 # if the `-base` enabled these options or not, so that
185 # the can enable/disable those features accordingly.
186 # The naming `*Enabled` vs `enable*` is intentional to
187 # distinguish inputs from outputs (what is to be built
188 # vs what was built) and to make them easier to search for.
189 glEnabled = enableGl;
190 waylandEnabled = enableWayland;
191
192 updateScript = directoryListingUpdater { };
193 };
194
195 passthru.tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
196
197 meta = with lib; {
198 description = "Base GStreamer plug-ins and helper libraries";
199 homepage = "https://gstreamer.freedesktop.org";
200 license = licenses.lgpl2Plus;
201 pkgConfigModules = [
202 "gstreamer-audio-1.0"
203 "gstreamer-base-1.0"
204 "gstreamer-net-1.0"
205 "gstreamer-video-1.0"
206 ];
207 platforms = platforms.unix;
208 maintainers = with maintainers; [ matthewbauer ];
209 };
210})