nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib
2, stdenv
3, fetchFromGitHub
4, buildPackages
5, cmake
6, glib
7, icu
8, libxml2
9, ninja
10, perl
11, pkg-config
12, libical
13, python3
14, tzdata
15, fixDarwinDylibNames
16, withIntrospection ? stdenv.buildPlatform == stdenv.hostPlatform
17, gobject-introspection
18, vala
19}:
20
21stdenv.mkDerivation rec {
22 pname = "libical";
23 version = "3.0.14";
24
25 outputs = [ "out" "dev" ]; # "devdoc" ];
26
27 src = fetchFromGitHub {
28 owner = "libical";
29 repo = "libical";
30 rev = "v${version}";
31 sha256 = "sha256-gZ6IBjG5pNKJ+hWcTzXMP7yxL4he4LTklZGoC9vXra8=";
32 };
33
34 strictDeps = true;
35 nativeBuildInputs = [
36 cmake
37 ninja
38 perl
39 pkg-config
40 # Docs building fails:
41 # https://github.com/NixOS/nixpkgs/pull/67204
42 # previously with https://github.com/NixOS/nixpkgs/pull/61657#issuecomment-495579489
43 # gtk-doc docbook_xsl docbook_xml_dtd_43 # for docs
44 ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
45 # provides ical-glib-src-generator that runs during build
46 libical
47 ] ++ lib.optionals withIntrospection [
48 gobject-introspection
49 vala
50 ] ++ lib.optionals stdenv.isDarwin [
51 fixDarwinDylibNames
52 ];
53 installCheckInputs = [
54 # running libical-glib tests
55 (python3.withPackages (pkgs: with pkgs; [
56 pygobject3
57 ]))
58 ];
59
60 buildInputs = [
61 glib
62 libxml2
63 icu
64 ] ++ lib.optionals withIntrospection [
65 gobject-introspection
66 ];
67
68 cmakeFlags = [
69 "-DENABLE_GTK_DOC=False"
70 "-DGOBJECT_INTROSPECTION=${if withIntrospection then "True" else "False"}"
71 "-DICAL_GLIB_VAPI=${if withIntrospection then "True" else "False"}"
72 ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
73 "-DIMPORT_ICAL_GLIB_SRC_GENERATOR=${lib.getDev buildPackages.libical}/lib/cmake/LibIcal/IcalGlibSrcGenerator.cmake"
74 ];
75
76 patches = [
77 # Will appear in 3.1.0
78 # https://github.com/libical/libical/issues/350
79 ./respect-env-tzdir.patch
80 ];
81
82 # Using install check so we do not have to manually set
83 # LD_LIBRARY_PATH and GI_TYPELIB_PATH variables
84 doInstallCheck = true;
85 enableParallelChecking = false;
86 preInstallCheck = if stdenv.isDarwin then ''
87 for testexe in $(find ./src/test -maxdepth 1 -type f -executable); do
88 for lib in $(cd lib && ls *.3.dylib); do
89 install_name_tool -change $lib $out/lib/$lib $testexe
90 done
91 done
92 '' else null;
93 installCheckPhase = ''
94 runHook preInstallCheck
95
96 export TZDIR=${tzdata}/share/zoneinfo
97 ctest --output-on-failure
98
99 runHook postInstallCheck
100 '';
101
102 meta = with lib; {
103 broken = stdenv.isDarwin;
104 homepage = "https://github.com/libical/libical";
105 description = "An Open Source implementation of the iCalendar protocols";
106 license = licenses.mpl20;
107 platforms = platforms.unix;
108 };
109}