diff --git a/pkgs/desktops/gnome/core/evolution-data-server/0001-M-93-Port-to-libgweather4.patch b/pkgs/desktops/gnome/core/evolution-data-server/0001-M-93-Port-to-libgweather4.patch new file mode 100644 index 000000000000..7b00a8023e8c --- /dev/null +++ b/pkgs/desktops/gnome/core/evolution-data-server/0001-M-93-Port-to-libgweather4.patch @@ -0,0 +1,140 @@ +From 4adf9032fd820414d9ebd12cc746fee1895cc910 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Javier=20Jard=C3=B3n?= +Date: Sat, 8 Jan 2022 15:30:52 +0000 +Subject: [PATCH] M!93 - Port to libgweather4 + +Adds support for linking against gweather4 (pass -DWITH_GWEATHER4=ON). + +Co-Authored-By: Jan Tojnar +Closes https://gitlab.gnome.org/GNOME/evolution-data-server/-/merge_requests/93 +--- + CMakeLists.txt | 9 ++++++++- + config.h.in | 3 +++ + .../backends/weather/e-cal-backend-weather.c | 8 ++++++++ + .../backends/weather/e-weather-source.c | 17 +++++++++++++++-- + 4 files changed, 34 insertions(+), 3 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 234f605be..5182a4792 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -119,6 +119,7 @@ set(sqlite_minimum_version 3.7.17) + # Optional Packages + set(goa_minimum_version 3.8) + set(gweather_minimum_version 3.10) ++set(gweather4_minimum_version 3.91.0) + set(libaccounts_glib_minimum_version 1.4) + set(libsignon_glib_minimum_version 1.8) + set(json_glib_minimum_version 1.0.4) +@@ -755,7 +756,13 @@ endif(NOT have_addrinfo) + add_printable_option(ENABLE_WEATHER "Build the weather calendar backend" ON) + + if(ENABLE_WEATHER) +- pkg_check_modules_for_option(ENABLE_WEATHER "weather calendar backend" LIBGWEATHER gweather-3.0>=${gweather_minimum_version}) ++ add_printable_variable(WITH_GWEATHER4 "Use GWeather 4 instead of 3" OFF) ++ ++ if(WITH_GWEATHER4) ++ pkg_check_modules_for_option(ENABLE_WEATHER "weather calendar backend" LIBGWEATHER gweather4>=${gweather4_minimum_version}) ++ else(WITH_GWEATHER4) ++ pkg_check_modules_for_option(ENABLE_WEATHER "weather calendar backend" LIBGWEATHER gweather-3.0>=${gweather_minimum_version}) ++ endif(WITH_GWEATHER4) + + set(CMAKE_REQUIRED_INCLUDES ${LIBGWEATHER_INCLUDE_DIRS}) + set(CMAKE_REQUIRED_LIBRARIES ${LIBGWEATHER_LDFLAGS}) +diff --git a/config.h.in b/config.h.in +index 4e79549ab..c087d2b04 100644 +--- a/config.h.in ++++ b/config.h.in +@@ -197,6 +197,9 @@ + /* gweather_info_new() has only one argument */ + #cmakedefine HAVE_ONE_ARG_GWEATHER_INFO_NEW 1 + ++/* Defined when linking against gweather4. Cannot just use GWEATHER_CHECK_VERSION because 40.0 made the versions non-monotonic. */ ++#cmakedefine WITH_GWEATHER4 1 ++ + /* evolution-alarm-notify - Define if using Canberra-GTK for sound */ + #cmakedefine HAVE_CANBERRA 1 + +diff --git a/src/calendar/backends/weather/e-cal-backend-weather.c b/src/calendar/backends/weather/e-cal-backend-weather.c +index 72faccd62..c4999671f 100644 +--- a/src/calendar/backends/weather/e-cal-backend-weather.c ++++ b/src/calendar/backends/weather/e-cal-backend-weather.c +@@ -464,7 +464,11 @@ create_weather (ECalBackendWeather *cbw, + time_t update_time; + ICalTimezone *update_zone = NULL; + const GWeatherLocation *location; ++ #ifdef WITH_GWEATHER4 ++ GTimeZone *w_timezone; ++ #else + const GWeatherTimezone *w_timezone; ++ #endif + gdouble tmin = 0.0, tmax = 0.0, temp = 0.0; + + g_return_val_if_fail (E_IS_CAL_BACKEND_WEATHER (cbw), NULL); +@@ -484,7 +488,11 @@ create_weather (ECalBackendWeather *cbw, + /* use timezone of the location to determine date for which this is set */ + location = gweather_info_get_location (report); + if (location && (w_timezone = gweather_location_get_timezone ((GWeatherLocation *) location))) ++ #ifdef WITH_GWEATHER4 ++ update_zone = i_cal_timezone_get_builtin_timezone (g_time_zone_get_identifier (w_timezone)); ++ #else + update_zone = i_cal_timezone_get_builtin_timezone (gweather_timezone_get_tzid ((GWeatherTimezone *) w_timezone)); ++ #endif + + if (!update_zone) + update_zone = i_cal_timezone_get_utc_timezone (); +diff --git a/src/calendar/backends/weather/e-weather-source.c b/src/calendar/backends/weather/e-weather-source.c +index 3052d034c..031b7a6ad 100644 +--- a/src/calendar/backends/weather/e-weather-source.c ++++ b/src/calendar/backends/weather/e-weather-source.c +@@ -39,8 +39,11 @@ weather_source_dispose (GObject *object) + EWeatherSourcePrivate *priv; + + priv = E_WEATHER_SOURCE (object)->priv; ++ #ifdef WITH_GWEATHER4 ++ g_clear_object (&priv->location); ++ #else + g_clear_pointer (&priv->location, gweather_location_unref); +- ++ #endif + g_clear_object (&priv->info); + + /* Chain up to parent's dispose() method. */ +@@ -85,7 +88,11 @@ weather_source_find_location_by_coords (GWeatherLocation *start, + gweather_location_get_coords (location, &lat, &lon); + + if (lat == latitude && lon == longitude) { ++ #ifdef WITH_GWEATHER4 ++ g_object_ref (location); ++ #else + gweather_location_ref (location); ++ #endif + return location; + } + } +@@ -96,7 +103,11 @@ weather_source_find_location_by_coords (GWeatherLocation *start, + + result = weather_source_find_location_by_coords (child, latitude, longitude); + if (result) { ++ #ifdef WITH_GWEATHER4 ++ g_object_unref (child); ++ #else + gweather_location_unref (child); ++ #endif + return result; + } + } +@@ -159,7 +170,9 @@ e_weather_source_new (const gchar *location) + } + } + +-#if GWEATHER_CHECK_VERSION(3, 39, 0) ++#ifdef WITH_GWEATHER4 ++ g_object_unref (world); ++#elif GWEATHER_CHECK_VERSION(3, 39, 0) + gweather_location_unref (world); + #endif + g_strfreev (tokens); +-- +2.35.1 + diff --git a/pkgs/desktops/gnome/core/evolution-data-server/default.nix b/pkgs/desktops/gnome/core/evolution-data-server/default.nix index b7ba12be1356..409b7a0762ae 100644 --- a/pkgs/desktops/gnome/core/evolution-data-server/default.nix +++ b/pkgs/desktops/gnome/core/evolution-data-server/default.nix @@ -1,18 +1,57 @@ -{ fetchurl, lib, stdenv, substituteAll, pkg-config, gnome, python3, gobject-introspection -, intltool, libsoup, libxml2, libsecret, icu, sqlite, tzdata, libcanberra-gtk3, gcr, p11-kit -, db, nspr, nss, libical, gperf, wrapGAppsHook, glib-networking, pcre, vala, cmake, ninja -, libkrb5, openldap, webkitgtk, libaccounts-glib, json-glib, glib, gtk3, libphonenumber -, gnome-online-accounts, libgweather, libgdata, gsettings-desktop-schemas, boost, protobuf }: +{ stdenv +, lib +, fetchurl +, substituteAll +, pkg-config +, gnome +, python3 +, gobject-introspection +, gettext +, libsoup +, libxml2 +, libsecret +, icu +, sqlite +, tzdata +, libcanberra-gtk3 +, gcr +, p11-kit +, db +, nspr +, nss +, libical +, gperf +, wrapGAppsHook +, glib-networking +, pcre +, vala +, cmake +, ninja +, libkrb5 +, openldap +, webkitgtk +, libaccounts-glib +, json-glib +, glib +, gtk3 +, libphonenumber +, gnome-online-accounts +, libgweather +, libgdata +, gsettings-desktop-schemas +, boost +, protobuf +}: stdenv.mkDerivation rec { pname = "evolution-data-server"; - version = "3.42.4"; + version = "3.43.2"; outputs = [ "out" "dev" ]; src = fetchurl { url = "mirror://gnome/sources/evolution-data-server/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz"; - sha256 = "fftBs+bAWBHUSajeTfx3q5sZ+O3yCzL92FeRhmIm0lI="; + sha256 = "jmV4HGQPoNm0+AEP9Q6Cpo11VTZWrVDZPxMRJ1y7RBw="; }; patches = [ @@ -20,22 +59,54 @@ stdenv.mkDerivation rec { src = ./fix-paths.patch; inherit tzdata; }) + + # Fix build with gweather4 + # https://gitlab.gnome.org/GNOME/evolution-data-server/-/merge_requests/93 + ./0001-M-93-Port-to-libgweather4.patch ]; prePatch = '' - substitute ${./hardcode-gsettings.patch} hardcode-gsettings.patch --subst-var-by ESD_GSETTINGS_PATH ${glib.makeSchemaPath "$out" "${pname}-${version}"} \ + substitute ${./hardcode-gsettings.patch} hardcode-gsettings.patch \ + --subst-var-by ESD_GSETTINGS_PATH ${glib.makeSchemaPath "$out" "${pname}-${version}"} \ --subst-var-by GDS_GSETTINGS_PATH ${glib.getSchemaPath gsettings-desktop-schemas} patches="$patches $PWD/hardcode-gsettings.patch" ''; nativeBuildInputs = [ - cmake ninja pkg-config intltool python3 gperf wrapGAppsHook gobject-introspection vala + cmake + ninja + pkg-config + gettext + python3 + gperf + wrapGAppsHook + gobject-introspection + vala ]; + buildInputs = [ - glib libsoup libxml2 gtk3 gnome-online-accounts - gcr p11-kit libgweather libgdata libaccounts-glib json-glib - icu sqlite libkrb5 openldap webkitgtk glib-networking - libcanberra-gtk3 pcre libphonenumber boost protobuf + glib + libsoup + libxml2 + gtk3 + gnome-online-accounts + gcr + p11-kit + libgweather + libgdata + libaccounts-glib + json-glib + icu + sqlite + libkrb5 + openldap + webkitgtk + glib-networking + libcanberra-gtk3 + pcre + libphonenumber + boost + protobuf ]; propagatedBuildInputs = [ @@ -55,6 +126,7 @@ stdenv.mkDerivation rec { "-DCMAKE_SKIP_BUILD_RPATH=OFF" "-DINCLUDE_INSTALL_DIR=${placeholder "dev"}/include" "-DWITH_PHONENUMBER=ON" + "-DWITH_GWEATHER4=ON" ]; passthru = {