Merge pull request #329823 from ExpidusOS/fix/pkgsllvm/elfutils
[NixPkgs.git] / pkgs / by-name / ev / evolution-data-server / package.nix
blob4fb4c39bad6f8acd38e1adb443b106315becc4c3
1 { stdenv
2 , lib
3 , fetchurl
4 , substituteAll
5 , pkg-config
6 , gnome
7 , _experimental-update-script-combinators
8 , python3
9 , gobject-introspection
10 , gettext
11 , libsoup_3
12 , libxml2
13 , libsecret
14 , icu
15 , sqlite
16 , tzdata
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.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 , gnome-online-accounts
44 , libgweather
45 , boost
46 , protobuf
47 , libiconv
48 , makeHardcodeGsettingsPatch
51 stdenv.mkDerivation rec {
52   pname = "evolution-data-server";
53   version = "3.52.3";
55   outputs = [ "out" "dev" ];
57   src = fetchurl {
58     url = "mirror://gnome/sources/evolution-data-server/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
59     hash = "sha256-6fbIDBQgM7GAG8yqYiHEU9406tTqCJsghrGQhvmpwuQ=";
60   };
62   patches = [
63     (substituteAll {
64       src = ./fix-paths.patch;
65       inherit tzdata;
66     })
68     # Avoid using wrapper function, which the hardcode gsettings
69     # patch generator cannot handle.
70     ./drop-tentative-settings-constructor.patch
71   ];
73   prePatch = ''
74     substitute ${./hardcode-gsettings.patch} hardcode-gsettings.patch \
75       --subst-var-by EDS ${glib.makeSchemaPath "$out" "${pname}-${version}"} \
76       --subst-var-by GDS ${glib.getSchemaPath gsettings-desktop-schemas}
77     patches="$patches $PWD/hardcode-gsettings.patch"
78   '';
80   nativeBuildInputs = [
81     cmake
82     ninja
83     pkg-config
84     gettext
85     python3
86     gperf
87     wrapGAppsHook3
88     gobject-introspection
89     vala
90   ];
92   buildInputs = [
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     boost
108     protobuf
109   ] ++ lib.optionals stdenv.isDarwin [
110     libiconv
111   ] ++ lib.optionals withGtk3 [
112     gtk3
113   ] ++ lib.optionals (withGtk3 && enableOAuth2) [
114     webkitgtk_4_1
115   ] ++ lib.optionals withGtk4 [
116     gtk4
117   ] ++ lib.optionals (withGtk4 && enableOAuth2) [
118     webkitgtk_6_0
119   ];
121   propagatedBuildInputs = [
122     db
123     nss
124     nspr
125     libical
126     libsoup_3
127     libxml2
128     json-glib
129   ];
131   cmakeFlags = [
132     "-DENABLE_VALA_BINDINGS=ON"
133     "-DENABLE_INTROSPECTION=ON"
134     "-DINCLUDE_INSTALL_DIR=${placeholder "dev"}/include"
135     "-DWITH_PHONENUMBER=ON"
136     "-DENABLE_GTK=${lib.boolToString withGtk3}"
137     "-DENABLE_EXAMPLES=${lib.boolToString withGtk3}"
138     "-DENABLE_CANBERRA=${lib.boolToString withGtk3}"
139     "-DENABLE_GTK4=${lib.boolToString withGtk4}"
140     "-DENABLE_OAUTH2_WEBKITGTK=${lib.boolToString (withGtk3 && enableOAuth2)}"
141     "-DENABLE_OAUTH2_WEBKITGTK4=${lib.boolToString (withGtk4 && enableOAuth2)}"
142   ];
144   postPatch = lib.optionalString stdenv.isDarwin ''
145     substituteInPlace cmake/modules/SetupBuildFlags.cmake \
146       --replace "-Wl,--no-undefined" ""
147     substituteInPlace src/services/evolution-alarm-notify/e-alarm-notify.c \
148       --replace "G_OS_WIN32" "__APPLE__"
149   '';
151   postInstall = lib.optionalString stdenv.isDarwin ''
152     ln -s $out/lib/${pname}/*.dylib $out/lib/
153   '';
155   passthru = {
156     hardcodeGsettingsPatch = makeHardcodeGsettingsPatch {
157       schemaIdToVariableMapping = {
158         "org.gnome.Evolution.DefaultSources" = "EDS";
159         "org.gnome.evolution.shell.network-config" = "EDS";
160         "org.gnome.evolution-data-server.addressbook" = "EDS";
161         "org.gnome.evolution-data-server.calendar" = "EDS";
162         "org.gnome.evolution-data-server" = "EDS";
163         "org.gnome.desktop.interface" = "GDS";
164       };
165       inherit src patches;
166     };
167     updateScript =
168       let
169         updateSource = gnome.updateScript {
170           packageName = "evolution-data-server";
171           versionPolicy = "odd-unstable";
172         };
173         updatePatch = _experimental-update-script-combinators.copyAttrOutputToFile "evolution-data-server.hardcodeGsettingsPatch" ./hardcode-gsettings.patch;
174       in
175       _experimental-update-script-combinators.sequence [
176         updateSource
177         updatePatch
178       ];
179   };
181   meta = with lib; {
182     description = "Unified backend for programs that work with contacts, tasks, and calendar information";
183     homepage = "https://gitlab.gnome.org/GNOME/evolution-data-server";
184     license = licenses.lgpl2Plus;
185     maintainers = teams.gnome.members;
186     platforms = platforms.unix;
187   };