libical: fix cross-compilation

gobject-introspection cannot be cross-compiled, so disable it when
cross-compiling. The glib bindings attempt to run a binary compiled for the
host during the build, so add a patch that allows the binary to be provided
by buildPackages.libical.
This commit is contained in:
Ben Wolsieffer 2020-09-25 21:42:39 -04:00
parent 670fe111f4
commit 56ef82d0cd

View File

@ -1,18 +1,25 @@
{ stdenv { lib
, stdenv
, fetchFromGitHub , fetchFromGitHub
, fetchpatch
, buildPackages
, cmake , cmake
, glib , glib
, gobject-introspection
, icu , icu
, libxml2 , libxml2
, ninja , ninja
, perl , perl
, pkgconfig , pkgconfig
, libical
, python3 , python3
, tzdata , tzdata
, vala , introspectionSupport ? stdenv.buildPlatform == stdenv.hostPlatform
, gobject-introspection ? null
, vala ? null
}: }:
assert introspectionSupport -> gobject-introspection != null && vala != null;
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "libical"; pname = "libical";
version = "3.0.8"; version = "3.0.8";
@ -28,15 +35,19 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ nativeBuildInputs = [
cmake cmake
gobject-introspection
ninja ninja
perl perl
pkgconfig pkgconfig
vala
# Docs building fails: # Docs building fails:
# https://github.com/NixOS/nixpkgs/pull/67204 # https://github.com/NixOS/nixpkgs/pull/67204
# previously with https://github.com/NixOS/nixpkgs/pull/61657#issuecomment-495579489 # previously with https://github.com/NixOS/nixpkgs/pull/61657#issuecomment-495579489
# gtk-doc docbook_xsl docbook_xml_dtd_43 # for docs # gtk-doc docbook_xsl docbook_xml_dtd_43 # for docs
] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
# provides ical-glib-src-generator that runs during build
libical
] ++ lib.optionals introspectionSupport [
gobject-introspection
vala
]; ];
installCheckInputs = [ installCheckInputs = [
# running libical-glib tests # running libical-glib tests
@ -52,15 +63,24 @@ stdenv.mkDerivation rec {
]; ];
cmakeFlags = [ cmakeFlags = [
"-DGOBJECT_INTROSPECTION=True"
"-DENABLE_GTK_DOC=False" "-DENABLE_GTK_DOC=False"
] ++ lib.optionals introspectionSupport [
"-DGOBJECT_INTROSPECTION=True"
"-DICAL_GLIB_VAPI=True" "-DICAL_GLIB_VAPI=True"
] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
"-DIMPORT_GLIB_SRC_GENERATOR=${lib.getDev buildPackages.libical}/lib/cmake/LibIcal/GlibSrcGenerator.cmake"
]; ];
patches = [ patches = [
# Will appear in 3.1.0 # Will appear in 3.1.0
# https://github.com/libical/libical/issues/350 # https://github.com/libical/libical/issues/350
./respect-env-tzdir.patch ./respect-env-tzdir.patch
# Export src-generator binary for use while cross-compiling
# https://github.com/libical/libical/pull/439
(fetchpatch {
url = "https://github.com/libical/libical/commit/1197d84b63dce179b55a6293cfd6d0523607baf1.patch";
sha256 = "18i1khnwmw488s7g5a1kf05sladf8dbyhfc69mbcf6dkc4nnc3dg";
})
]; ];
# Using install check so we do not have to manually set # Using install check so we do not have to manually set