python312Packages.llama-index: 0.12.9 -> 0.12.9.post1 (#371957)
[NixPkgs.git] / pkgs / by-name / li / libical / package.nix
blobef92eddd101146a37e073fe10e87a020e302a6de
2   lib,
3   stdenv,
4   fetchFromGitHub,
5   pkgsBuildBuild,
6   pkgsBuildHost,
7   cmake,
8   glib,
9   icu,
10   libxml2,
11   ninja,
12   perl,
13   pkg-config,
14   libical,
15   python3,
16   tzdata,
17   fixDarwinDylibNames,
18   withIntrospection ? stdenv.hostPlatform.emulatorAvailable pkgsBuildHost,
19   gobject-introspection,
20   vala,
23 stdenv.mkDerivation rec {
24   pname = "libical";
25   version = "3.0.18";
27   outputs = [
28     "out"
29     "dev"
30   ]; # "devdoc" ];
32   src = fetchFromGitHub {
33     owner = "libical";
34     repo = "libical";
35     rev = "v${version}";
36     sha256 = "sha256-32FNnCybXO67Vtg1LM6miJUaK+r0mlfjxgLQg1LD8Es=";
37   };
39   strictDeps = true;
41   depsBuildBuild = lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
42     # provides ical-glib-src-generator that runs during build
43     libical
44   ];
46   nativeBuildInputs =
47     [
48       cmake
49       icu
50       ninja
51       perl
52       pkg-config
53     ]
54     ++ lib.optionals withIntrospection [
55       gobject-introspection
56       vala
57       # Docs building fails:
58       # https://github.com/NixOS/nixpkgs/pull/67204
59       # previously with https://github.com/NixOS/nixpkgs/pull/61657#issuecomment-495579489
60       # gtk-doc docbook_xsl docbook_xml_dtd_43 # for docs
61     ]
62     ++ lib.optionals stdenv.hostPlatform.isDarwin [
63       fixDarwinDylibNames
64     ];
65   nativeInstallCheckInputs = [
66     # running libical-glib tests
67     (python3.pythonOnBuildForHost.withPackages (
68       pkgs: with pkgs; [
69         pygobject3
70       ]
71     ))
72   ];
74   buildInputs = [
75     glib
76     libxml2
77     icu
78   ];
80   cmakeFlags =
81     [
82       "-DENABLE_GTK_DOC=False"
83       "-DGOBJECT_INTROSPECTION=${if withIntrospection then "True" else "False"}"
84       "-DICAL_GLIB_VAPI=${if withIntrospection then "True" else "False"}"
85     ]
86     ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
87       "-DIMPORT_ICAL_GLIB_SRC_GENERATOR=${lib.getDev pkgsBuildBuild.libical}/lib/cmake/LibIcal/IcalGlibSrcGenerator.cmake"
88     ];
90   patches = [
91     # Will appear in 3.1.0
92     # https://github.com/libical/libical/issues/350
93     ./respect-env-tzdir.patch
94   ];
96   postPatch = ''
97     # Fix typo in test env setup
98     # https://github.com/libical/libical/commit/03c02ced21494413920744a400c638b0cb5d493f
99     substituteInPlace src/test/libical-glib/CMakeLists.txt \
100       --replace-fail "''${CMAKE_BINARY_DIR}/src/libical-glib;\$ENV{GI_TYPELIB_PATH}" "''${CMAKE_BINARY_DIR}/src/libical-glib:\$ENV{GI_TYPELIB_PATH}" \
101       --replace-fail "''${LIBRARY_OUTPUT_PATH};\$ENV{LD_LIBRARY_PATH}" "''${LIBRARY_OUTPUT_PATH}:\$ENV{LD_LIBRARY_PATH}"
102   '';
104   # Using install check so we do not have to manually set
105   # LD_LIBRARY_PATH and GI_TYPELIB_PATH variables
106   # Musl does not support TZDIR.
107   doInstallCheck = !stdenv.hostPlatform.isMusl;
108   enableParallelChecking = false;
109   preInstallCheck =
110     if stdenv.hostPlatform.isDarwin then
111       ''
112         for testexe in $(find ./src/test -maxdepth 1 -type f -executable); do
113           for lib in $(cd lib && ls *.3.dylib); do
114             install_name_tool -change $lib $out/lib/$lib $testexe
115           done
116         done
117       ''
118     else
119       null;
120   installCheckPhase = ''
121     runHook preInstallCheck
123     export TZDIR=${tzdata}/share/zoneinfo
124     ctest --output-on-failure
126     runHook postInstallCheck
127   '';
129   meta = with lib; {
130     homepage = "https://github.com/libical/libical";
131     description = "Open Source implementation of the iCalendar protocols";
132     changelog = "https://github.com/libical/libical/raw/v${version}/ReleaseNotes.txt";
133     license = licenses.mpl20;
134     platforms = platforms.unix;
135   };