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