about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/libical
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/libical')
-rw-r--r--nixpkgs/pkgs/development/libraries/libical/default.nix85
-rw-r--r--nixpkgs/pkgs/development/libraries/libical/respect-env-tzdir.patch29
2 files changed, 114 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/libical/default.nix b/nixpkgs/pkgs/development/libraries/libical/default.nix
new file mode 100644
index 000000000000..050cba5460d9
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libical/default.nix
@@ -0,0 +1,85 @@
+{ stdenv
+, fetchFromGitHub
+, cmake
+, glib
+, gobject-introspection
+, icu
+, libxml2
+, ninja
+, perl
+, pkgconfig
+, python3
+, tzdata
+, vala
+}:
+
+stdenv.mkDerivation rec {
+  pname = "libical";
+  version = "3.0.5";
+
+  outputs = [ "out" "dev" ]; # "devdoc" ];
+
+  src = fetchFromGitHub {
+    owner = "libical";
+    repo = "libical";
+    rev = "v${version}";
+    sha256 = "03kjc4s1svmzkmzkr0irgczq37aslhj4bxnvjqav0jwa2zrynhra";
+  };
+
+  nativeBuildInputs = [
+    cmake
+    gobject-introspection
+    ninja
+    perl
+    pkgconfig
+    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
+  ];
+  installCheckInputs = [
+    # running libical-glib tests
+    (python3.withPackages (pkgs: with pkgs; [
+      pygobject3
+    ]))
+  ];
+
+  buildInputs = [
+    glib
+    libxml2
+    icu
+  ];
+
+  cmakeFlags = [
+    "-DGOBJECT_INTROSPECTION=True"
+    "-DENABLE_GTK_DOC=False"
+    "-DICAL_GLIB_VAPI=True"
+  ];
+
+  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
+  doInstallCheck = true;
+  enableParallelChecking = false;
+  installCheckPhase = ''
+    runHook preInstallCheck
+
+    export TZDIR=${tzdata}/share/zoneinfo
+    ctest --output-on-failure
+
+    runHook postInstallCheck
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = https://github.com/libical/libical;
+    description = "An Open Source implementation of the iCalendar protocols";
+    license = licenses.mpl20;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libical/respect-env-tzdir.patch b/nixpkgs/pkgs/development/libraries/libical/respect-env-tzdir.patch
new file mode 100644
index 000000000000..59d23e490e5a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libical/respect-env-tzdir.patch
@@ -0,0 +1,29 @@
+--- a/src/libical/icaltz-util.c
++++ b/src/libical/icaltz-util.c
+@@ -94,9 +94,9 @@
+ static const char *zdir = NULL;
+ 
+ static const char *search_paths[] = {
++    "/etc/zoneinfo",
+     "/usr/share/zoneinfo",
+     "/usr/lib/zoneinfo",
+-    "/etc/zoneinfo",
+     "/usr/share/lib/zoneinfo"
+ };
+ 
+@@ -178,6 +178,15 @@
+     const char *fname = ZONES_TAB_SYSTEM_FILENAME;
+     size_t i, num_search_paths;
+ 
++   const char *env_tzdir = getenv ("TZDIR");
++   if (env_tzdir) {
++       sprintf (file_path, "%s/%s", env_tzdir, fname);
++       if (!access (file_path, F_OK|R_OK)) {
++           zdir = env_tzdir;
++           return;
++       }
++   }
++
+     num_search_paths = sizeof(search_paths) / sizeof(search_paths[0]);
+     for (i = 0; i < num_search_paths; i++) {
+         snprintf(file_path, MAXPATHLEN, "%s/%s", search_paths[i], fname);