From 51feeeaf41472737623c8832338d7d658ac41a0b Mon Sep 17 00:00:00 2001 From: Colin Date: Thu, 19 Dec 2024 09:53:57 +0000 Subject: [PATCH] evolution-data-server: enable cross compilation --- .../ev/evolution-data-server/package.nix | 52 ++++++++++++------- 1 file changed, 34 insertions(+), 18 deletions(-) diff --git a/pkgs/by-name/ev/evolution-data-server/package.nix b/pkgs/by-name/ev/evolution-data-server/package.nix index d596e3f0ddb6..d2cfda341cd8 100644 --- a/pkgs/by-name/ev/evolution-data-server/package.nix +++ b/pkgs/by-name/ev/evolution-data-server/package.nix @@ -1,6 +1,7 @@ { stdenv, lib, + buildPackages, fetchurl, pkg-config, gnome, @@ -133,25 +134,40 @@ stdenv.mkDerivation rec { json-glib ]; - cmakeFlags = [ - "-DENABLE_VALA_BINDINGS=ON" - "-DENABLE_INTROSPECTION=ON" - "-DINCLUDE_INSTALL_DIR=${placeholder "dev"}/include" - "-DWITH_PHONENUMBER=ON" - "-DENABLE_GTK=${lib.boolToString withGtk3}" - "-DENABLE_EXAMPLES=${lib.boolToString withGtk3}" - "-DENABLE_CANBERRA=${lib.boolToString withGtk3}" - "-DENABLE_GTK4=${lib.boolToString withGtk4}" - "-DENABLE_OAUTH2_WEBKITGTK=${lib.boolToString (withGtk3 && enableOAuth2)}" - "-DENABLE_OAUTH2_WEBKITGTK4=${lib.boolToString (withGtk4 && enableOAuth2)}" - ]; + cmakeFlags = + [ + "-DENABLE_VALA_BINDINGS=ON" + "-DENABLE_INTROSPECTION=ON" + "-DINCLUDE_INSTALL_DIR=${placeholder "dev"}/include" + "-DWITH_PHONENUMBER=ON" + "-DENABLE_GTK=${lib.boolToString withGtk3}" + "-DENABLE_EXAMPLES=${lib.boolToString withGtk3}" + "-DENABLE_CANBERRA=${lib.boolToString withGtk3}" + "-DENABLE_GTK4=${lib.boolToString withGtk4}" + "-DENABLE_OAUTH2_WEBKITGTK=${lib.boolToString (withGtk3 && enableOAuth2)}" + "-DENABLE_OAUTH2_WEBKITGTK4=${lib.boolToString (withGtk4 && enableOAuth2)}" + ] + ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ + (lib.cmakeFeature "CMAKE_CROSSCOMPILING_EMULATOR" (stdenv.hostPlatform.emulator buildPackages)) + ]; - postPatch = lib.optionalString stdenv.hostPlatform.isDarwin '' - substituteInPlace cmake/modules/SetupBuildFlags.cmake \ - --replace "-Wl,--no-undefined" "" - substituteInPlace src/services/evolution-alarm-notify/e-alarm-notify.c \ - --replace "G_OS_WIN32" "__APPLE__" - ''; + strictDeps = true; + + postPatch = + lib.optionalString stdenv.hostPlatform.isDarwin '' + substituteInPlace cmake/modules/SetupBuildFlags.cmake \ + --replace "-Wl,--no-undefined" "" + substituteInPlace src/services/evolution-alarm-notify/e-alarm-notify.c \ + --replace "G_OS_WIN32" "__APPLE__" + '' + + lib.optionalString (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' + substituteInPlace src/addressbook/libebook-contacts/CMakeLists.txt --replace-fail \ + 'COMMAND ''${CMAKE_CURRENT_BINARY_DIR}/gen-western-table' \ + 'COMMAND ${stdenv.hostPlatform.emulator buildPackages} ''${CMAKE_CURRENT_BINARY_DIR}/gen-western-table' + substituteInPlace src/camel/CMakeLists.txt --replace-fail \ + 'COMMAND ''${CMAKE_CURRENT_BINARY_DIR}/camel-gen-tables' \ + 'COMMAND ${stdenv.hostPlatform.emulator buildPackages} ''${CMAKE_CURRENT_BINARY_DIR}/camel-gen-tables' + ''; postInstall = lib.optionalString stdenv.hostPlatform.isDarwin '' ln -s $out/lib/evolution-data-server/*.dylib $out/lib/