core/pkgs/by-name/li/libical/default.nix

91 lines
2.8 KiB
Nix
Raw Normal View History

2024-05-13 21:24:10 +00:00
{ lib, stdenv, fetchFromGitHub, pkgsBuildBuild, pkgsBuildHost, cmake, glib, icu
, libxml2, ninja, perl, pkg-config, libical, python3, tzdata
2024-05-02 00:46:19 +00:00
, fixDarwinDylibNames
, withIntrospection ? stdenv.hostPlatform.emulatorAvailable pkgsBuildHost
2024-05-13 21:24:10 +00:00
, gobject-introspection, vala }:
2024-05-02 00:46:19 +00:00
stdenv.mkDerivation rec {
pname = "libical";
version = "3.0.18";
outputs = [ "out" "dev" ]; # "devdoc" ];
src = fetchFromGitHub {
owner = "libical";
repo = "libical";
rev = "v${version}";
sha256 = "sha256-32FNnCybXO67Vtg1LM6miJUaK+r0mlfjxgLQg1LD8Es=";
};
strictDeps = true;
depsBuildBuild = lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
# provides ical-glib-src-generator that runs during build
libical
];
2024-05-13 21:24:10 +00:00
nativeBuildInputs = [ cmake ninja perl pkg-config ]
++ lib.optionals withIntrospection [
gobject-introspection
vala
# Docs building fails:
# https://github.com/NixOS/nixpkgs/pull/67204
# previously with https://github.com/NixOS/nixpkgs/pull/61657#issuecomment-495579489
# gtk-doc docbook_xsl docbook_xml_dtd_43 # for docs
] ++ lib.optionals stdenv.isDarwin [ fixDarwinDylibNames ];
2024-05-02 00:46:19 +00:00
nativeInstallCheckInputs = [
# running libical-glib tests
2024-05-13 21:24:10 +00:00
(python3.pythonOnBuildForHost.withPackages
(pkgs: with pkgs; [ pygobject3 ]))
2024-05-02 00:46:19 +00:00
];
2024-05-13 21:24:10 +00:00
buildInputs = [ glib libxml2 icu ];
2024-05-02 00:46:19 +00:00
cmakeFlags = [
"-DENABLE_GTK_DOC=False"
"-DGOBJECT_INTROSPECTION=${if withIntrospection then "True" else "False"}"
"-DICAL_GLIB_VAPI=${if withIntrospection then "True" else "False"}"
] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
2024-05-13 21:24:10 +00:00
"-DIMPORT_ICAL_GLIB_SRC_GENERATOR=${
lib.getDev pkgsBuildBuild.libical
}/lib/cmake/LibIcal/IcalGlibSrcGenerator.cmake"
2024-05-02 00:46:19 +00:00
];
patches = [
# Will appear in 3.1.0
# https://github.com/libical/libical/issues/350
./respect-env-tzdir.patch
];
# Using install check so we do not have to manually set
# LD_LIBRARY_PATH and GI_TYPELIB_PATH variables
# Musl does not support TZDIR.
doInstallCheck = !stdenv.hostPlatform.isMusl;
enableParallelChecking = false;
preInstallCheck = if stdenv.isDarwin then ''
for testexe in $(find ./src/test -maxdepth 1 -type f -executable); do
for lib in $(cd lib && ls *.3.dylib); do
install_name_tool -change $lib $out/lib/$lib $testexe
done
done
2024-05-13 21:24:10 +00:00
'' else
null;
2024-05-02 00:46:19 +00:00
installCheckPhase = ''
runHook preInstallCheck
export TZDIR=${tzdata}/share/zoneinfo
ctest --output-on-failure
runHook postInstallCheck
'';
meta = with lib; {
homepage = "https://github.com/libical/libical";
description = "An Open Source implementation of the iCalendar protocols";
2024-05-13 21:24:10 +00:00
changelog =
"https://github.com/libical/libical/raw/v${version}/ReleaseNotes.txt";
2024-05-02 00:46:19 +00:00
license = licenses.mpl20;
platforms = platforms.unix;
};
}