gnu: libical: Add upstream patch to preserve API compatibility.
[jackhill/guix/guix.git] / gnu / packages / calendar.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2015 David Thompson <davet@gnu.org>
3 ;;; Copyright © 2015, 2016, 2017 Leo Famulari <leo@famulari.name>
4 ;;; Copyright © 2016 Kei Kebreau <kkebreau@posteo.net>
5 ;;; Copyright © 2016, 2017 Efraim Flashner <efraim@flashner.co.il>
6 ;;; Copyright © 2016 Troy Sankey <sankeytms@gmail.com>
7 ;;; Copyright © 2016 Stefan Reichoer <stefan@xsteve.at>
8 ;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
9 ;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com
10 ;;;
11 ;;; This file is part of GNU Guix.
12 ;;;
13 ;;; GNU Guix is free software; you can redistribute it and/or modify it
14 ;;; under the terms of the GNU General Public License as published by
15 ;;; the Free Software Foundation; either version 3 of the License, or (at
16 ;;; your option) any later version.
17 ;;;
18 ;;; GNU Guix is distributed in the hope that it will be useful, but
19 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
20 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ;;; GNU General Public License for more details.
22 ;;;
23 ;;; You should have received a copy of the GNU General Public License
24 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
25
26 (define-module (gnu packages calendar)
27 #:use-module (gnu packages)
28 #:use-module ((guix licenses) #:prefix license:)
29 #:use-module (guix packages)
30 #:use-module (guix download)
31 #:use-module (guix build-system gnu)
32 #:use-module (guix build-system cmake)
33 #:use-module (guix build-system python)
34 #:use-module (gnu packages base)
35 #:use-module (gnu packages check)
36 #:use-module (gnu packages dav)
37 #:use-module (gnu packages freedesktop)
38 #:use-module (gnu packages glib)
39 #:use-module (gnu packages gtk)
40 #:use-module (gnu packages icu4c)
41 #:use-module (gnu packages perl)
42 #:use-module (gnu packages pkg-config)
43 #:use-module (gnu packages python)
44 #:use-module (gnu packages python-xyz)
45 #:use-module (gnu packages sphinx)
46 #:use-module (gnu packages sqlite)
47 #:use-module (gnu packages time)
48 #:use-module (gnu packages xml)
49 #:use-module (srfi srfi-26))
50
51 (define-public libical
52 (package
53 (name "libical")
54 (version "3.0.7")
55 (source (origin
56 (method url-fetch)
57 (uri (string-append
58 "https://github.com/libical/libical/releases/download/v"
59 version "/libical-" version ".tar.gz"))
60 (sha256
61 (base32
62 "1z33wzaazbd7drl6qbh1750whd78xl2cg0gjnxyya9m83vgndgha"))
63 (patches
64 ;; Add a patch slated for 3.0.8 which preserves backwards-
65 ;; compatibility in the icalattach_new_from_data() function,
66 ;; which accidentally changed in 3.0.7 and could break some uses.
67 ;; https://gitlab.gnome.org/GNOME/evolution-data-server/issues/185
68 ;; http://lists.infradead.org/pipermail/libical-devel/2020-January/000907.html
69 (list (origin
70 (method url-fetch)
71 (uri (string-append
72 "https://github.com/libical/libical/commit/"
73 "ae394010c889e4c185160da5e81527849f9de350.patch"))
74 (file-name "libical-3.0.7-preserve-icalattach-api.patch")
75 (sha256
76 (base32
77 "0v8qcxn8a6sh78grzxd61j9478928dx38l5mf8mkdrbxv47vmvvp")))))))
78 (build-system cmake-build-system)
79 (arguments
80 '(#:tests? #f ; test suite appears broken
81 #:configure-flags '("-DSHARED_ONLY=true")
82 #:phases
83 (modify-phases %standard-phases
84 (add-before 'configure 'patch-paths
85 (lambda* (#:key inputs #:allow-other-keys)
86 ;; TODO: libical 3.1.0 supports using TZDIR instead of a hard-coded
87 ;; zoneinfo database. When that is released we can drop
88 ;; the tzdata dependency.
89 (let ((tzdata (assoc-ref inputs "tzdata")))
90 (substitute* "src/libical/icaltz-util.c"
91 (("\\\"/usr/share/zoneinfo\\\",")
92 (string-append "\"" tzdata "/share/zoneinfo\""))
93 (("\\\"/usr/lib/zoneinfo\\\",") "")
94 (("\\\"/etc/zoneinfo\\\",") "")
95 (("\\\"/usr/share/lib/zoneinfo\\\"") "")))
96 #t)))))
97 (native-inputs
98 `(("gtk-doc" ,gtk-doc)
99 ("perl" ,perl)
100 ("pkg-config" ,pkg-config)))
101 (inputs
102 `(("glib" ,glib)
103 ("libxml2" ,libxml2)
104 ("tzdata" ,tzdata)))
105 (propagated-inputs
106 ;; In Requires.private of libical.pc.
107 `(("icu4c" ,icu4c)))
108 (home-page "https://libical.github.io/libical/")
109 (synopsis "iCalendar protocols and data formats implementation")
110 (description
111 "Libical is an implementation of the iCalendar protocols and protocol
112 data units.")
113 ;; Can be used with either license. See COPYING.
114 (license (list license:lgpl2.1 license:mpl2.0))))
115
116 (define-public khal
117 (package
118 (name "khal")
119 (version "0.10.1")
120 (source (origin
121 (method url-fetch)
122 (uri (pypi-uri "khal" version))
123 (sha256
124 (base32
125 "1r8bkgjwkh7i8ygvsv51h1cnax50sb183vafg66x5snxf3dgjl6l"))))
126 (build-system python-build-system)
127 (arguments
128 `(#:phases (modify-phases %standard-phases
129 ;; Building the manpage requires khal to be installed.
130 (add-after 'install 'manpage
131 (lambda* (#:key inputs outputs #:allow-other-keys)
132 ;; Make installed package available for running the tests
133 (add-installed-pythonpath inputs outputs)
134 (invoke "make" "--directory=doc/" "man")
135 (install-file
136 "doc/build/man/khal.1"
137 (string-append (assoc-ref outputs "out") "/share/man/man1"))
138 #t))
139 (replace 'check
140 (lambda* (#:key inputs #:allow-other-keys)
141 ;; The tests require us to choose a timezone.
142 (setenv "TZ"
143 (string-append (assoc-ref inputs "tzdata")
144 "/share/zoneinfo/Zulu"))
145 (invoke "py.test" "tests"))))))
146 (native-inputs
147 `(("python-pytest" ,python-pytest)
148 ("python-pytest-cov" ,python-pytest-cov)
149 ("python-setuptools-scm" ,python-setuptools-scm)
150 ;; Required for tests
151 ("python-freezegun" ,python-freezegun)
152 ("tzdata" ,tzdata-for-tests)
153 ("vdirsyncer" ,vdirsyncer)
154 ;; Required to build manpage
155 ("python-sphinxcontrib-newsfeed" ,python-sphinxcontrib-newsfeed)
156 ("python-sphinx" ,python-sphinx)))
157 (inputs
158 `(("sqlite" ,sqlite)))
159 (propagated-inputs
160 `(("python-configobj" ,python-configobj)
161 ("python-dateutil" ,python-dateutil)
162 ("python-icalendar" ,python-icalendar)
163 ("python-tzlocal" ,python-tzlocal)
164 ("python-urwid" ,python-urwid)
165 ("python-pyxdg" ,python-pyxdg)))
166 (synopsis "Console calendar program")
167 (description "Khal is a standards based console calendar program,
168 able to synchronize with CalDAV servers through vdirsyncer.")
169 (home-page "https://lostpackets.de/khal/")
170 (license license:expat)))
171
172 (define-public remind
173 (package
174 (name "remind")
175 (version "3.1.17")
176 (source
177 (origin
178 (method url-fetch)
179 (uri (string-append "https://dianne.skoll.ca/projects/remind/download/"
180 "remind-"
181 (string-join (map (cut string-pad <> 2 #\0)
182 (string-split version #\.))
183 ".")
184 ".tar.gz"))
185 (sha256
186 (base32 "0lgyc2j69aqqk4knywr8inz4fsnni0zq54dgqh7p4s6kzybc2mf9"))))
187 (build-system gnu-build-system)
188 (arguments
189 '(#:tests? #f)) ; no "check" target
190 (home-page "https://dianne.skoll.ca/projects/remind/")
191 (synopsis "Sophisticated calendar and alarm program")
192 (description
193 "Remind allows you to remind yourself of upcoming events and appointments.
194 Each reminder or alarm can consist of a message sent to standard output, or a
195 program to be executed. It also features: sophisticated date calculation,
196 moon phases, sunrise/sunset, Hebrew calendar, alarms, PostScript output and
197 proper handling of holidays.")
198 (license license:gpl2)))
199
200 (define-public libhdate
201 (package
202 (name "libhdate")
203 (version "1.6.02")
204 (source
205 (origin
206 (method url-fetch)
207 (uri (string-append "mirror://sourceforge/libhdate/libhdate/libhdate-"
208 version "/" name "-" version ".tar.bz2"))
209 (sha256
210 (base32
211 "0qkpq412p78znw8gckwcx3l0wcss9s0dgw1pvjb1ih2pxf6hm4rw"))))
212 (build-system gnu-build-system)
213 (home-page "http://libhdate.sourceforge.net/")
214 (synopsis "Library to use Hebrew dates")
215 (description "LibHdate is a small library for the Hebrew calendar and times
216 of day, written in C, and including bindings for C++, pascal, perl, php, python,
217 and ruby. It includes two illustrative command-line programs, @code{hcal} and
218 @code{hdate}, and some snippets and scripts written in the binding languages.")
219 (license license:gpl3+)))