1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchurl,
6 fetchpatch,
7 meson,
8 ninja,
9
10 pkg-config,
11 python,
12 pygobject3,
13 gobject-introspection,
14 gst_all_1,
15 isPy3k,
16 directoryListingUpdater,
17}:
18
19buildPythonPackage rec {
20 pname = "gst-python";
21 version = "1.26.0";
22
23 format = "other";
24
25 outputs = [
26 "out"
27 "dev"
28 ];
29
30 src = fetchurl {
31 url = "https://gstreamer.freedesktop.org/src/gst-python/gst-python-${version}.tar.xz";
32 hash = "sha256-5QRqBdd6uxVnGtAc0ZCNF9YuWgb114Qb5DQq3io/uNs=";
33 };
34
35 patches = [
36 # Fix segfault with PyGObject>=3.52.0
37 # https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8653
38 (fetchpatch {
39 url = "https://gitlab.freedesktop.org/gstreamer/gstreamer/-/commit/69bba61e548c7a63bc18137e63e41489a7de9d36.patch";
40 stripLen = 2;
41 hash = "sha256-BfWPc8dsB09KiEm9bNT8e+jH76jiDefQlEhhLJoq7tI=";
42 })
43 ];
44
45 # Python 2.x is not supported.
46 disabled = !isPy3k;
47
48 depsBuildBuild = [ pkg-config ];
49
50 nativeBuildInputs = [
51 meson
52 ninja
53 pkg-config
54 gobject-introspection
55 gst_all_1.gst-plugins-base
56 ];
57
58 buildInputs = [
59 # for gstreamer-analytics-1.0
60 gst_all_1.gst-plugins-bad
61 ];
62
63 propagatedBuildInputs = [
64 gst_all_1.gst-plugins-base
65 pygobject3
66 ];
67
68 checkInputs = [
69 gst_all_1.gst-rtsp-server
70 ];
71
72 mesonFlags = [
73 "-Dpygi-overrides-dir=${placeholder "out"}/${python.sitePackages}/gi/overrides"
74 # Exec format error during configure
75 "-Dpython-exe=${python.pythonOnBuildForHost.interpreter}"
76 ];
77
78 # TODO: Meson setup hook does not like buildPythonPackage
79 # https://github.com/NixOS/nixpkgs/issues/47390
80 installCheckPhase = "meson test --print-errorlogs";
81
82 preCheck = lib.optionalString stdenv.hostPlatform.isDarwin ''
83 export DYLD_LIBRARY_PATH="${gst_all_1.gst-plugins-base}/lib"
84 '';
85
86 passthru = {
87 updateScript = directoryListingUpdater { };
88 };
89
90 meta = with lib; {
91 homepage = "https://gstreamer.freedesktop.org";
92 description = "Python bindings for GStreamer";
93 license = licenses.lgpl2Plus;
94 maintainers = [ ];
95 };
96}