1{
2 stdenv,
3 lib,
4 buildPackages,
5 fetchurl,
6 pkg-config,
7 gnome,
8 _experimental-update-script-combinators,
9 python3,
10 gobject-introspection,
11 gettext,
12 libsoup_3,
13 libxml2,
14 libsecret,
15 icu,
16 sqlite,
17 libcanberra-gtk3,
18 p11-kit,
19 db,
20 nspr,
21 nss,
22 libical,
23 gperf,
24 wrapGAppsHook3,
25 glib-networking,
26 gsettings-desktop-schemas,
27 vala,
28 cmake,
29 ninja,
30 libkrb5,
31 openldap,
32 enableOAuth2 ? stdenv.hostPlatform.isLinux,
33 webkitgtk_4_1,
34 webkitgtk_6_0,
35 json-glib,
36 glib,
37 gtk3,
38 gtk4,
39 withGtk3 ? true,
40 withGtk4 ? false,
41 libphonenumber,
42 libuuid,
43 gnome-online-accounts,
44 libgweather,
45 boost,
46 protobuf,
47 libiconv,
48 makeHardcodeGsettingsPatch,
49}:
50
51stdenv.mkDerivation rec {
52 pname = "evolution-data-server";
53 version = "3.56.2";
54
55 outputs = [
56 "out"
57 "dev"
58 ];
59
60 src = fetchurl {
61 url = "mirror://gnome/sources/evolution-data-server/${lib.versions.majorMinor version}/evolution-data-server-${version}.tar.xz";
62 hash = "sha256-307CmVDymnbqxvvg+BTEjSzvfT/bkFACpKiD3XYc6Tw=";
63 };
64
65 patches = [
66 # Avoid using wrapper function, which the hardcode gsettings
67 # patch generator cannot handle.
68 ./drop-tentative-settings-constructor.patch
69 ];
70
71 prePatch = ''
72 substitute ${./hardcode-gsettings.patch} hardcode-gsettings.patch \
73 --subst-var-by EDS ${glib.makeSchemaPath "$out" "evolution-data-server-${version}"} \
74 --subst-var-by GDS ${glib.getSchemaPath gsettings-desktop-schemas}
75 patches="$patches $PWD/hardcode-gsettings.patch"
76 '';
77
78 nativeBuildInputs = [
79 cmake
80 ninja
81 pkg-config
82 gettext
83 python3
84 gperf
85 wrapGAppsHook3
86 gobject-introspection
87 vala
88 ];
89
90 buildInputs = [
91 glib
92 libsecret
93 libsoup_3
94 gnome-online-accounts
95 p11-kit
96 libgweather
97 icu
98 sqlite
99 libkrb5
100 openldap
101 glib-networking
102 libcanberra-gtk3
103 libphonenumber
104 libuuid
105 boost
106 protobuf
107 ]
108 ++ lib.optionals stdenv.hostPlatform.isDarwin [
109 libiconv
110 ]
111 ++ lib.optionals withGtk3 [
112 gtk3
113 ]
114 ++ lib.optionals (withGtk3 && enableOAuth2) [
115 webkitgtk_4_1
116 ]
117 ++ lib.optionals withGtk4 [
118 gtk4
119 ]
120 ++ lib.optionals (withGtk4 && enableOAuth2) [
121 webkitgtk_6_0
122 ];
123
124 propagatedBuildInputs = [
125 db
126 nss
127 nspr
128 libical
129 libsoup_3
130 libxml2
131 json-glib
132 ];
133
134 cmakeFlags = [
135 "-DENABLE_VALA_BINDINGS=ON"
136 "-DENABLE_INTROSPECTION=ON"
137 "-DINCLUDE_INSTALL_DIR=${placeholder "dev"}/include"
138 "-DWITH_PHONENUMBER=ON"
139 "-DENABLE_GTK=${lib.boolToString withGtk3}"
140 "-DENABLE_EXAMPLES=${lib.boolToString withGtk3}"
141 "-DENABLE_CANBERRA=${lib.boolToString withGtk3}"
142 "-DENABLE_GTK4=${lib.boolToString withGtk4}"
143 "-DENABLE_OAUTH2_WEBKITGTK=${lib.boolToString (withGtk3 && enableOAuth2)}"
144 "-DENABLE_OAUTH2_WEBKITGTK4=${lib.boolToString (withGtk4 && enableOAuth2)}"
145 ]
146 ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [
147 (lib.cmakeFeature "CMAKE_CROSSCOMPILING_EMULATOR" (stdenv.hostPlatform.emulator buildPackages))
148 ];
149
150 strictDeps = true;
151
152 postPatch =
153 lib.optionalString stdenv.hostPlatform.isDarwin ''
154 substituteInPlace cmake/modules/SetupBuildFlags.cmake \
155 --replace "-Wl,--no-undefined" ""
156 substituteInPlace src/services/evolution-alarm-notify/e-alarm-notify.c \
157 --replace "G_OS_WIN32" "__APPLE__"
158 ''
159 + lib.optionalString (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
160 substituteInPlace src/addressbook/libebook-contacts/CMakeLists.txt --replace-fail \
161 'COMMAND ''${CMAKE_CURRENT_BINARY_DIR}/gen-western-table' \
162 'COMMAND ${stdenv.hostPlatform.emulator buildPackages} ''${CMAKE_CURRENT_BINARY_DIR}/gen-western-table'
163 substituteInPlace src/camel/CMakeLists.txt --replace-fail \
164 'COMMAND ''${CMAKE_CURRENT_BINARY_DIR}/camel-gen-tables' \
165 'COMMAND ${stdenv.hostPlatform.emulator buildPackages} ''${CMAKE_CURRENT_BINARY_DIR}/camel-gen-tables'
166 '';
167
168 postInstall = lib.optionalString stdenv.hostPlatform.isDarwin ''
169 ln -s $out/lib/evolution-data-server/*.dylib $out/lib/
170 '';
171
172 passthru = {
173 hardcodeGsettingsPatch = makeHardcodeGsettingsPatch {
174 schemaIdToVariableMapping = {
175 "org.gnome.Evolution.DefaultSources" = "EDS";
176 "org.gnome.evolution.shell.network-config" = "EDS";
177 "org.gnome.evolution-data-server.addressbook" = "EDS";
178 "org.gnome.evolution-data-server.calendar" = "EDS";
179 "org.gnome.evolution-data-server" = "EDS";
180 "org.gnome.desktop.interface" = "GDS";
181 };
182 inherit src patches;
183 };
184 updateScript =
185 let
186 updateSource = gnome.updateScript {
187 packageName = "evolution-data-server";
188 versionPolicy = "odd-unstable";
189 };
190 updatePatch = _experimental-update-script-combinators.copyAttrOutputToFile "evolution-data-server.hardcodeGsettingsPatch" ./hardcode-gsettings.patch;
191 in
192 _experimental-update-script-combinators.sequence [
193 updateSource
194 updatePatch
195 ];
196 };
197
198 meta = {
199 description = "Unified backend for programs that work with contacts, tasks, and calendar information";
200 homepage = "https://gitlab.gnome.org/GNOME/evolution-data-server";
201 changelog = "https://gitlab.gnome.org/GNOME/evolution-data-server/-/blob/${version}/NEWS?ref_type=tags";
202 license = lib.licenses.lgpl2Plus;
203 teams = [ lib.teams.gnome ];
204 platforms = lib.platforms.linux; # requires libuuid
205 };
206}