nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
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.5";
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-8MDibL7apXcyy2pXjozBOhFkvxjXN9VcMzBhxS8MSNc=";
65 };
66
67 strictDeps = true;
68 depsBuildBuild = [
69 pkg-config
70 ];
71 nativeBuildInputs = [
72 meson
73 ninja
74 pkg-config
75 python3
76 gettext
77 orc
78 glib
79 gstreamer
80 ]
81 ++ lib.optionals withIntrospection [
82 gobject-introspection
83 ]
84 ++ lib.optionals enableDocumentation [
85 hotdoc
86 ]
87 ++ lib.optionals enableWayland [
88 wayland-scanner
89 ];
90
91 buildInputs = [
92 graphene
93 orc
94 libtheora
95 libintl
96 libopus
97 isocodes
98 libpng
99 libjpeg
100 tremor
101 pango
102 ]
103 ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [
104 libdrm
105 libGL
106 ]
107 ++ lib.optionals stdenv.hostPlatform.isDarwin [
108 apple-sdk_gstreamer
109 ]
110 ++ lib.optionals enableAlsa [
111 alsa-lib
112 ]
113 ++ lib.optionals enableX11 [
114 libXext
115 libXi
116 libXv
117 ]
118 ++ lib.optionals enableWayland [
119 wayland
120 wayland-protocols
121 ]
122 ++ lib.optional enableCdparanoia cdparanoia;
123
124 propagatedBuildInputs = [
125 gstreamer
126 ]
127 ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [
128 libdrm
129 ];
130
131 mesonFlags = [
132 "-Dglib_debug=disabled" # cast checks should be disabled on stable releases
133 "-Dexamples=disabled" # requires many dependencies and probably not useful for our users
134 # See https://github.com/GStreamer/gst-plugins-base/blob/d64a4b7a69c3462851ff4dcfa97cc6f94cd64aef/meson_options.txt#L15 for a list of choices
135 "-Dgl_winsys=${
136 lib.concatStringsSep "," (
137 lib.optional enableX11 "x11"
138 ++ lib.optional enableWayland "wayland"
139 ++ lib.optional enableCocoa "cocoa"
140 )
141 }"
142 (lib.mesonEnable "introspection" withIntrospection)
143 (lib.mesonEnable "doc" enableDocumentation)
144 (lib.mesonEnable "libvisual" false)
145 ]
146 ++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [
147 "-Dtests=disabled"
148 ]
149 ++ lib.optionals (!enableX11) [
150 "-Dx11=disabled"
151 "-Dxi=disabled"
152 "-Dxshm=disabled"
153 "-Dxvideo=disabled"
154 ]
155 # TODO How to disable Wayland?
156 ++ lib.optional (!enableGl) "-Dgl=disabled"
157 ++ lib.optional (!enableAlsa) "-Dalsa=disabled"
158 ++ lib.optional (!enableCdparanoia) "-Dcdparanoia=disabled"
159 ++ lib.optional stdenv.hostPlatform.isDarwin "-Ddrm=disabled";
160
161 postPatch = ''
162 patchShebangs \
163 scripts/meson-pkg-config-file-fixup.py \
164 scripts/extract-release-date-from-doap-file.py
165 '';
166
167 # This package has some `_("string literal")` string formats
168 # that trip up clang with format security enabled.
169 hardeningDisable = [ "format" ];
170
171 doCheck = false; # fails, wants DRI access for OpenGL
172
173 preFixup = ''
174 moveToOutput "lib/gstreamer-1.0/pkgconfig" "$dev"
175 '';
176
177 passthru = {
178 # Downstream `gst-*` packages depending on `gst-plugins-base`
179 # have meson build options like 'gl' etc. that depend
180 # on these features being built in `-base`.
181 # If they are not built here, then the downstream builds
182 # will fail, as they, too, use `-Dauto_features=enabled`
183 # which would enable these options unconditionally.
184 # That means we must communicate to these downstream packages
185 # if the `-base` enabled these options or not, so that
186 # the can enable/disable those features accordingly.
187 # The naming `*Enabled` vs `enable*` is intentional to
188 # distinguish inputs from outputs (what is to be built
189 # vs what was built) and to make them easier to search for.
190 glEnabled = enableGl;
191 waylandEnabled = enableWayland;
192
193 updateScript = directoryListingUpdater { };
194 };
195
196 passthru.tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
197
198 meta = {
199 description = "Base GStreamer plug-ins and helper libraries";
200 homepage = "https://gstreamer.freedesktop.org";
201 license = lib.licenses.lgpl2Plus;
202 pkgConfigModules = [
203 "gstreamer-audio-1.0"
204 "gstreamer-base-1.0"
205 "gstreamer-net-1.0"
206 "gstreamer-video-1.0"
207 ];
208 platforms = lib.platforms.unix;
209 maintainers = [ ];
210 };
211})