Skip to content

Commit 8821e2e

Browse files
authored
evolution-data-server: enable cross compilation (NixOS#366487)
2 parents 98dd0ae + 51feeea commit 8821e2e

File tree

1 file changed

+34
-18
lines changed

1 file changed

+34
-18
lines changed

pkgs/by-name/ev/evolution-data-server/package.nix

Lines changed: 34 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
stdenv,
33
lib,
4+
buildPackages,
45
fetchurl,
56
pkg-config,
67
gnome,
@@ -133,25 +134,40 @@ stdenv.mkDerivation rec {
133134
json-glib
134135
];
135136

136-
cmakeFlags = [
137-
"-DENABLE_VALA_BINDINGS=ON"
138-
"-DENABLE_INTROSPECTION=ON"
139-
"-DINCLUDE_INSTALL_DIR=${placeholder "dev"}/include"
140-
"-DWITH_PHONENUMBER=ON"
141-
"-DENABLE_GTK=${lib.boolToString withGtk3}"
142-
"-DENABLE_EXAMPLES=${lib.boolToString withGtk3}"
143-
"-DENABLE_CANBERRA=${lib.boolToString withGtk3}"
144-
"-DENABLE_GTK4=${lib.boolToString withGtk4}"
145-
"-DENABLE_OAUTH2_WEBKITGTK=${lib.boolToString (withGtk3 && enableOAuth2)}"
146-
"-DENABLE_OAUTH2_WEBKITGTK4=${lib.boolToString (withGtk4 && enableOAuth2)}"
147-
];
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+
];
148153

149-
postPatch = lib.optionalString stdenv.hostPlatform.isDarwin ''
150-
substituteInPlace cmake/modules/SetupBuildFlags.cmake \
151-
--replace "-Wl,--no-undefined" ""
152-
substituteInPlace src/services/evolution-alarm-notify/e-alarm-notify.c \
153-
--replace "G_OS_WIN32" "__APPLE__"
154-
'';
154+
strictDeps = true;
155+
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+
'';
155171

156172
postInstall = lib.optionalString stdenv.hostPlatform.isDarwin ''
157173
ln -s $out/lib/evolution-data-server/*.dylib $out/lib/

0 commit comments

Comments
 (0)