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