1{
2 lib,
3 stdenv,
4 fetchpatch,
5 fetchurl,
6 meson,
7 ninja,
8 pkg-config,
9 gi-docgen,
10 glib,
11 json-glib,
12 libsoup_3,
13 libxml2,
14 gobject-introspection,
15 gnome,
16}:
17
18stdenv.mkDerivation rec {
19 pname = "rest";
20 version = "0.9.1";
21
22 outputs = [
23 "out"
24 "dev"
25 "devdoc"
26 ];
27
28 src = fetchurl {
29 url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
30 sha256 = "kmalwQ7OOD4ZPft/+we1CcwfUVIauNrXavlu0UISwuM=";
31 };
32
33 patches = [
34 # Pick up MR 30 (https://gitlab.gnome.org/GNOME/librest/-/merge_requests/30) to fix GOA crashes with libsoup 3
35 (fetchpatch {
36 url = "https://gitlab.gnome.org/GNOME/librest/-/commit/fbad64abe28a96f591a30e3a5d3189c10172a414.patch";
37 hash = "sha256-r8+h84Y/AdM1IOMRcBVwDvfqapqOY8ZtRXdOIQvFR9w=";
38 })
39 (fetchpatch {
40 url = "https://gitlab.gnome.org/GNOME/librest/-/commit/8049048a0f7d52b3f4101c7123797fed099d4cc8.patch";
41 hash = "sha256-AMhHKzzOoTIlkRwN4KfUwdhxlqvtRgiVjKRfnG7KZwc=";
42 })
43 ];
44
45 strictDeps = true;
46 depsBuildBuild = [ pkg-config ];
47 nativeBuildInputs = [
48 meson
49 ninja
50 pkg-config
51 gi-docgen
52 gobject-introspection
53 ];
54
55 propagatedBuildInputs = [
56 glib
57 json-glib
58 libsoup_3
59 libxml2
60 ];
61
62 mesonFlags = [
63 "-Dexamples=false"
64
65 # Remove when https://gitlab.gnome.org/GNOME/librest/merge_requests/2 is merged.
66 "-Dca_certificates=true"
67 "-Dca_certificates_path=/etc/ssl/certs/ca-certificates.crt"
68 ];
69
70 postPatch = ''
71 # https://gitlab.gnome.org/GNOME/librest/-/merge_requests/19
72 substituteInPlace meson.build \
73 --replace "con." "conf."
74
75 # Run-time dependency gi-docgen found: NO (tried pkgconfig and cmake)
76 # it should be a build-time dep for build
77 # TODO: send upstream
78 substituteInPlace docs/meson.build \
79 --replace "'gi-docgen', ver" "'gi-docgen', native:true, ver"
80 '';
81
82 postFixup = ''
83 # Cannot be in postInstall, otherwise _multioutDocs hook in preFixup will move right back.
84 moveToOutput "share/doc" "$devdoc"
85 '';
86
87 separateDebugInfo = true;
88
89 passthru = {
90 updateScript = gnome.updateScript {
91 packageName = pname;
92 attrPath = "librest_1_0";
93 versionPolicy = "odd-unstable";
94 };
95 };
96
97 meta = with lib; {
98 description = "Helper library for RESTful services";
99 homepage = "https://gitlab.gnome.org/GNOME/librest";
100 license = licenses.lgpl21Only;
101 platforms = platforms.unix;
102 teams = [ teams.gnome ];
103 };
104}