1{
2 stdenv,
3 lib,
4 fetchpatch2,
5 fetchurl,
6 meson,
7 ninja,
8 pkg-config,
9 gobject-introspection,
10 vala,
11 gi-docgen,
12 python3,
13 libsoup_2_4,
14 glib,
15 gnome,
16 gssdp-tools,
17 buildPackages,
18 withIntrospection ?
19 lib.meta.availableOn stdenv.hostPlatform gobject-introspection
20 && stdenv.hostPlatform.emulatorAvailable buildPackages,
21}:
22
23stdenv.mkDerivation rec {
24 pname = "gssdp";
25 version = "1.4.1";
26
27 outputs = [
28 "out"
29 "dev"
30 ]
31 ++ lib.optionals withIntrospection [ "devdoc" ];
32
33 src = fetchurl {
34 url = "mirror://gnome/sources/gssdp/${lib.versions.majorMinor version}/gssdp-${version}.tar.xz";
35 sha256 = "VySWVDV9PVGxQDFRaaJMBnHeeqUsb3XIxcmr1Ao1JSk=";
36 };
37
38 patches = [
39 (fetchpatch2 {
40 # https://gitlab.gnome.org/GNOME/gssdp/-/merge_requests/11
41 url = "https://gitlab.gnome.org/GNOME/gssdp/-/commit/db9d02c22005be7e5e81b43a3ab777250bd7b27b.diff";
42 hash = "sha256-DJQrg6MhzpX8R0QaNnqdwA1+v8xncDU8jcX+I3scW1M=";
43 })
44 ];
45
46 strictDeps = true;
47
48 depsBuildBuild = [
49 pkg-config
50 ];
51
52 nativeBuildInputs = [
53 meson
54 ninja
55 pkg-config
56 glib
57 python3
58 ]
59 ++ lib.optionals withIntrospection [
60 gobject-introspection
61 vala
62 gi-docgen
63 ];
64
65 buildInputs = [
66 libsoup_2_4
67 ];
68
69 propagatedBuildInputs = [
70 glib
71 ];
72
73 mesonFlags = [
74 "-Dsniffer=false"
75 (lib.mesonBool "gtk_doc" withIntrospection)
76 (lib.mesonBool "introspection" withIntrospection)
77 (lib.mesonBool "vapi" withIntrospection)
78 ];
79
80 # Bail out! GLib-GIO-FATAL-CRITICAL: g_inet_address_to_string: assertion 'G_IS_INET_ADDRESS (address)' failed
81 doCheck = !stdenv.hostPlatform.isDarwin;
82
83 postFixup = lib.optionalString withIntrospection ''
84 # Move developer documentation to devdoc output.
85 # Cannot be in postInstall, otherwise _multioutDocs hook in preFixup will move right back.
86 find -L "$out/share/doc" -type f -regex '.*\.devhelp2?' -print0 \
87 | while IFS= read -r -d ''' file; do
88 moveToOutput "$(dirname "''${file/"$out/"/}")" "$devdoc"
89 done
90 '';
91
92 passthru = {
93 updateScript = gnome.updateScript {
94 packageName = "gssdp";
95 freeze = true;
96 };
97
98 tests = {
99 inherit gssdp-tools;
100 };
101 };
102
103 meta = with lib; {
104 description = "GObject-based API for handling resource discovery and announcement over SSDP";
105 homepage = "http://www.gupnp.org/";
106 license = licenses.lgpl2Plus;
107 teams = [ teams.gnome ];
108 platforms = platforms.all;
109 };
110}