nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchurl,
5 fetchpatch,
6 replaceVars,
7 meson,
8 nasm,
9 ninja,
10 pkg-config,
11 python3,
12 gst-plugins-base,
13 orc,
14 bzip2,
15 gettext,
16 libGL,
17 libv4l,
18 libdv,
19 libavc1394,
20 libiec61883,
21 libvpx,
22 libdrm,
23 speex,
24 opencore-amr,
25 flac,
26 taglib,
27 libshout,
28 cairo,
29 gdk-pixbuf,
30 aalib,
31 libcaca,
32 libsoup_3,
33 libpulseaudio,
34 libintl,
35 libxml2,
36 lame,
37 mpg123,
38 twolame,
39 gtkSupport ? false,
40 gtk3,
41 qt5Support ? false,
42 qt5,
43 qt6Support ? false,
44 qt6,
45 raspiCameraSupport ? false,
46 libraspberrypi,
47 enableJack ? true,
48 libjack2,
49 enableX11 ? stdenv.hostPlatform.isLinux,
50 libxtst,
51 libxi,
52 libxfixes,
53 libxext,
54 libxdamage,
55 ncurses,
56 enableWayland ? stdenv.hostPlatform.isLinux,
57 wayland,
58 wayland-protocols,
59 libgudev,
60 wavpack,
61 glib,
62 openssl,
63 # Checks meson.is_cross_build(), so even canExecute isn't enough.
64 enableDocumentation ? stdenv.hostPlatform == stdenv.buildPlatform,
65 hotdoc,
66 gst-plugins-good,
67 directoryListingUpdater,
68 apple-sdk_gstreamer,
69}:
70
71let
72 # MMAL is not supported on aarch64, see:
73 # https://github.com/raspberrypi/userland/issues/688
74 hostSupportsRaspiCamera = stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch32;
75in
76
77assert raspiCameraSupport -> hostSupportsRaspiCamera;
78
79stdenv.mkDerivation (finalAttrs: {
80 pname = "gst-plugins-good";
81 version = "1.26.5";
82
83 outputs = [
84 "out"
85 "dev"
86 ];
87
88 src = fetchurl {
89 url = "https://gstreamer.freedesktop.org/src/gst-plugins-good/gst-plugins-good-${finalAttrs.version}.tar.xz";
90 hash = "sha256-6whi6TQEsHPpjsUDUOzn5mheopNsq4EYwrjpOOLL6os=";
91 };
92
93 patches = [
94 # dlopen libsoup_3 with an absolute path
95 (replaceVars ./souploader.diff {
96 nixLibSoup3Path = "${lib.getLib libsoup_3}/lib";
97 })
98 ];
99
100 strictDeps = true;
101
102 depsBuildBuild = [ pkg-config ];
103
104 nativeBuildInputs = [
105 pkg-config
106 python3
107 meson
108 ninja
109 gettext
110 orc
111 libshout
112 glib
113 ]
114 # https://gitlab.freedesktop.org/gstreamer/gstreamer/-/blob/bb7069bd6fff80e8599d6e79f3f000b83dbce4d6/subprojects/gst-plugins-good/meson.build#L435-443
115 ++ lib.optionals stdenv.hostPlatform.isx86_64 [
116 nasm
117 ]
118 ++ lib.optionals enableDocumentation [
119 hotdoc
120 ]
121 ++ lib.optionals qt5Support (
122 with qt5;
123 [
124 qtbase
125 qttools
126 ]
127 )
128 ++ lib.optionals qt6Support (
129 with qt6;
130 [
131 qtbase
132 qttools
133 ]
134 )
135 ++ lib.optionals enableWayland [
136 wayland-protocols
137 ];
138
139 buildInputs = [
140 gst-plugins-base
141 orc
142 bzip2
143 libdv
144 libvpx
145 speex
146 opencore-amr
147 flac
148 taglib
149 cairo
150 gdk-pixbuf
151 aalib
152 libcaca
153 libsoup_3
154 libshout
155 libxml2
156 lame
157 mpg123
158 twolame
159 libintl
160 ncurses
161 wavpack
162 openssl
163 ]
164 ++ lib.optionals raspiCameraSupport [
165 libraspberrypi
166 ]
167 ++ lib.optionals enableX11 [
168 libxext
169 libxfixes
170 libxdamage
171 libxtst
172 libxi
173 ]
174 ++ lib.optionals gtkSupport [
175 # for gtksink
176 gtk3
177 ]
178 ++ lib.optionals qt5Support (
179 with qt5;
180 [
181 qtbase
182 qtdeclarative
183 qtwayland
184 qtx11extras
185 ]
186 )
187 ++ lib.optionals qt6Support (
188 with qt6;
189 [
190 qtbase
191 qtdeclarative
192 qtwayland
193 ]
194 )
195 ++ lib.optionals stdenv.hostPlatform.isLinux [
196 libdrm
197 libGL
198 libv4l
199 libpulseaudio
200 libavc1394
201 libiec61883
202 libgudev
203 ]
204 ++ lib.optionals stdenv.hostPlatform.isDarwin [
205 apple-sdk_gstreamer
206 ]
207 ++ lib.optionals enableWayland [
208 wayland
209 ]
210 ++ lib.optionals enableJack [
211 libjack2
212 ];
213
214 mesonFlags = [
215 "-Dexamples=disabled" # requires many dependencies and probably not useful for our users
216 "-Dglib_debug=disabled" # cast checks should be disabled on stable releases
217 (lib.mesonEnable "doc" enableDocumentation)
218 (lib.mesonEnable "asm" true)
219 ]
220 ++ lib.optionals (!qt5Support) [
221 "-Dqt5=disabled"
222 ]
223 ++ lib.optionals (!qt6Support) [
224 "-Dqt6=disabled"
225 ]
226 ++ lib.optionals (!gtkSupport) [
227 "-Dgtk3=disabled"
228 ]
229 ++ lib.optionals (!enableX11) [
230 "-Dximagesrc=disabled" # Linux-only
231 ]
232 ++ lib.optionals (!enableJack) [
233 "-Djack=disabled"
234 ]
235 ++ lib.optionals (!stdenv.hostPlatform.isLinux) [
236 "-Ddv1394=disabled" # Linux only
237 "-Doss4=disabled" # Linux only
238 "-Doss=disabled" # Linux only
239 "-Dpulse=disabled" # TODO check if we can keep this enabled
240 "-Dv4l2-gudev=disabled" # Linux-only
241 "-Dv4l2=disabled" # Linux-only
242 ]
243 ++ (
244 if raspiCameraSupport then
245 [
246 "-Drpi-lib-dir=${libraspberrypi}/lib"
247 ]
248 else
249 [
250 "-Drpicamsrc=disabled"
251 ]
252 );
253
254 postPatch = ''
255 patchShebangs \
256 scripts/extract-release-date-from-doap-file.py \
257 ext/qt6/qsb-wrapper.py
258 '';
259
260 env = {
261 NIX_LDFLAGS =
262 # linking error on Darwin
263 # https://github.com/NixOS/nixpkgs/pull/70690#issuecomment-553694896
264 "-lncurses";
265 };
266
267 # fails 1 tests with "Unexpected critical/warning: g_object_set_is_valid_property: object class 'GstRtpStorage' has no property named ''"
268 doCheck = false;
269
270 # must be explicitly set since 5590e365
271 dontWrapQtApps = true;
272
273 preFixup = ''
274 moveToOutput "lib/gstreamer-1.0/pkgconfig" "$dev"
275 '';
276
277 passthru = {
278 tests = {
279 gtk = gst-plugins-good.override {
280 gtkSupport = true;
281 };
282 qt5 = gst-plugins-good.override {
283 qt5Support = true;
284 };
285 qt6 = gst-plugins-good.override {
286 qt6Support = true;
287 };
288 }
289 // lib.optionalAttrs hostSupportsRaspiCamera {
290 raspiCamera = gst-plugins-good.override {
291 raspiCameraSupport = true;
292 };
293 };
294
295 updateScript = directoryListingUpdater { };
296 };
297
298 meta = {
299 description = "GStreamer Good Plugins";
300 homepage = "https://gstreamer.freedesktop.org";
301 longDescription = ''
302 a set of plug-ins that we consider to have good quality code,
303 correct functionality, our preferred license (LGPL for the plug-in
304 code, LGPL or LGPL-compatible for the supporting library).
305 '';
306 license = lib.licenses.lgpl2Plus;
307 platforms = lib.platforms.linux ++ lib.platforms.darwin;
308 maintainers = [ ];
309 };
310})