nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 stdenv,
3 lib,
4 fetchurl,
5 fetchpatch,
6 glib,
7 meson,
8 ninja,
9 pkg-config,
10 gnome,
11 libsysprof-capture,
12 sqlite,
13 buildPackages,
14 gobject-introspection,
15 withIntrospection ?
16 lib.meta.availableOn stdenv.hostPlatform gobject-introspection
17 && stdenv.hostPlatform.emulatorAvailable buildPackages,
18 vala,
19 libpsl,
20 python3,
21 gi-docgen,
22 brotli,
23 libnghttp2,
24}:
25
26stdenv.mkDerivation rec {
27 pname = "libsoup";
28 version = "3.6.5";
29
30 outputs = [
31 "out"
32 "dev"
33 ]
34 ++ lib.optional withIntrospection "devdoc";
35
36 src = fetchurl {
37 url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
38 hash = "sha256-aJF2Wqw+lJAXlFw+rr2MyCFt93JFbcn0YJdvvbetojQ=";
39 };
40
41 patches = [
42 (fetchpatch {
43 name = "soup-init-use-libdl-instead-of-gmodule-in-soup2_is_loaded.patch";
44 url = "https://gitlab.gnome.org/GNOME/libsoup/-/commit/2316e56a5502ac4c41ef4ff56a3266e680aca129.patch";
45 hash = "sha256-6TOM6sygVPpBWjTNgFG37JFbJDl0t2f9Iwidvh/isa4=";
46 })
47 ];
48
49 depsBuildBuild = [
50 pkg-config
51 ];
52
53 nativeBuildInputs = [
54 meson
55 ninja
56 pkg-config
57 glib
58 python3
59 ]
60 ++ lib.optionals withIntrospection [
61 gi-docgen
62 gobject-introspection
63 vala
64 ];
65
66 buildInputs = [
67 sqlite
68 libpsl
69 glib.out
70 brotli
71 libnghttp2
72 ]
73 ++ lib.optionals stdenv.hostPlatform.isLinux [
74 libsysprof-capture
75 ];
76
77 propagatedBuildInputs = [
78 glib
79 ];
80
81 mesonFlags = [
82 "-Dtls_check=false" # glib-networking is a runtime dependency, not a compile-time dependency
83 "-Dgssapi=disabled"
84 "-Dntlm=disabled"
85 # Requires wstest from autobahn-testsuite.
86 "-Dautobahn=disabled"
87 # Requires gnutls, not added for closure size.
88 "-Dpkcs11_tests=disabled"
89
90 (lib.mesonEnable "docs" withIntrospection)
91 (lib.mesonEnable "introspection" withIntrospection)
92 (lib.mesonEnable "sysprof" stdenv.hostPlatform.isLinux)
93 (lib.mesonEnable "vapi" withIntrospection)
94 ];
95
96 # TODO: For some reason the pkg-config setup hook does not pick this up.
97 PKG_CONFIG_PATH = "${libnghttp2.dev}/lib/pkgconfig";
98
99 # HSTS tests fail.
100 doCheck = false;
101 separateDebugInfo = true;
102
103 postPatch = ''
104 patchShebangs libsoup/
105 '';
106
107 postFixup = ''
108 # Cannot be in postInstall, otherwise _multioutDocs hook in preFixup will move right back.
109 moveToOutput "share/doc" "$devdoc"
110 '';
111
112 passthru = {
113 updateScript = gnome.updateScript {
114 attrPath = "libsoup_3";
115 packageName = "libsoup";
116 versionPolicy = "odd-unstable";
117 };
118 };
119
120 meta = {
121 description = "HTTP client/server library for GNOME";
122 homepage = "https://gitlab.gnome.org/GNOME/libsoup";
123 license = lib.licenses.lgpl2Plus;
124 inherit (glib.meta) maintainers platforms teams;
125 };
126}