Merge branch 'master' into core-updates
[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 ;;; Copyright © 2020 Brendan Tildesley <mail@brendan.scot>
11 ;;;
12 ;;; This file is part of GNU Guix.
13 ;;;
14 ;;; GNU Guix is free software; you can redistribute it and/or modify it
15 ;;; under the terms of the GNU General Public License as published by
16 ;;; the Free Software Foundation; either version 3 of the License, or (at
17 ;;; your option) any later version.
18 ;;;
19 ;;; GNU Guix is distributed in the hope that it will be useful, but
20 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
21 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 ;;; GNU General Public License for more details.
23 ;;;
24 ;;; You should have received a copy of the GNU General Public License
25 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
26
27 (define-module (gnu packages calendar)
28 #:use-module (gnu packages)
29 #:use-module ((guix licenses) #:prefix license:)
30 #:use-module (guix git-download)
31 #:use-module (guix packages)
32 #:use-module (guix download)
33 #:use-module (guix build-system gnu)
34 #:use-module (guix build-system cmake)
35 #:use-module (guix build-system python)
36 #:use-module (gnu packages base)
37 #:use-module (gnu packages check)
38 #:use-module (gnu packages dav)
39 #:use-module (gnu packages freedesktop)
40 #:use-module (gnu packages glib)
41 #:use-module (gnu packages gnome)
42 #:use-module (gnu packages gtk)
43 #:use-module (gnu packages icu4c)
44 #:use-module (gnu packages perl)
45 #:use-module (gnu packages pkg-config)
46 #:use-module (gnu packages python)
47 #:use-module (gnu packages python-xyz)
48 #:use-module (gnu packages sphinx)
49 #:use-module (gnu packages sqlite)
50 #:use-module (gnu packages time)
51 #:use-module (gnu packages xml)
52 #:use-module (srfi srfi-26))
53
54 (define-public date
55 ;; We make the same choice as the Arch package maintainer by choosing a
56 ;; recent commit to fix some bugs.
57 ;; https://github.com/Alexays/Waybar/issues/565
58 (let ((commit "9a0ee2542848ab8625984fc8cdbfb9b5414c0082"))
59 (package
60 (name "date")
61 (version (string-append "2.4.1-" (string-take commit 8)))
62 (source
63 (origin
64 (method git-fetch)
65 (uri (git-reference
66 (url "https://github.com/HowardHinnant/date.git")
67 (commit "9a0ee2542848ab8625984fc8cdbfb9b5414c0082")))
68 (file-name (git-file-name name version))
69 (sha256
70 (base32 "0yxsn0hj22n61bjywysxqgfv7hj5xvsl6isma95fl8xrimpny083"))
71 (patches
72 ;; Install pkg-config files
73 ;; https://github.com/HowardHinnant/date/pull/538
74 (search-patches "date-output-pkg-config-files.patch"))))
75 (inputs `(("tzdata" ,tzdata)))
76 (build-system cmake-build-system)
77 (arguments
78 '(#:configure-flags (list "-DUSE_SYSTEM_TZ_DB=ON"
79 "-DBUILD_SHARED_LIBS=ON"
80 "-DBUILD_TZ_LIB=ON"
81 "-DENABLE_DATE_TESTING=ON")
82 #:phases
83 (modify-phases %standard-phases
84 (add-after 'unpack 'patch-bin-bash
85 (lambda* (#:key inputs #:allow-other-keys)
86 (substitute* "compile_fail.sh"
87 (("/bin/bash") (which "bash")))
88 #t))
89 (add-after 'unpack 'patch-zoneinfo-path
90 (lambda* (#:key inputs #:allow-other-keys)
91 (substitute* "src/tz.cpp"
92 (("/usr/share/zoneinfo")
93 (string-append (assoc-ref inputs "tzdata") "/share/zoneinfo")))
94 #t))
95 (replace 'check
96 (lambda _
97 ;; Disable test that requires checking timezone that
98 ;; isn't set in the build environment.
99 (substitute* "CTestTestfile.cmake"
100 (("add_test.tz_test_pass_zoned_time_deduction_test.*") "")
101 (("set_tests_properties.tz_test_pass_zoned_time_deduction_test.*") ""))
102 (invoke "make" "testit"))))))
103 (synopsis "Date and time library for C++11 and C++14")
104 (description "Date is a header only C++ library that extends the chrono
105 date algorithms library for calendar dates and durations. It also provides
106 the <tz.h> library for handling time zones and leap seconds.")
107 (home-page "https://howardhinnant.github.io/date/date.html")
108 (license license:expat))))
109
110 (define-public libical
111 (package
112 (name "libical")
113 (version "3.0.7")
114 (source (origin
115 (method url-fetch)
116 (uri (string-append
117 "https://github.com/libical/libical/releases/download/v"
118 version "/libical-" version ".tar.gz"))
119 (sha256
120 (base32
121 "1z33wzaazbd7drl6qbh1750whd78xl2cg0gjnxyya9m83vgndgha"))
122 (patches
123 ;; Add a patch slated for 3.0.8 which preserves backwards-
124 ;; compatibility in the icalattach_new_from_data() function,
125 ;; which accidentally changed in 3.0.7 and could break some uses.
126 ;; https://gitlab.gnome.org/GNOME/evolution-data-server/issues/185
127 ;; http://lists.infradead.org/pipermail/libical-devel/2020-January/000907.html
128 (list (origin
129 (method url-fetch)
130 (uri (string-append
131 "https://github.com/libical/libical/commit/"
132 "ae394010c889e4c185160da5e81527849f9de350.patch"))
133 (file-name "libical-3.0.7-preserve-icalattach-api.patch")
134 (sha256
135 (base32
136 "0v8qcxn8a6sh78grzxd61j9478928dx38l5mf8mkdrbxv47vmvvp")))))))
137 (build-system cmake-build-system)
138 (arguments
139 '(#:tests? #f ; test suite appears broken
140 #:configure-flags '("-DSHARED_ONLY=true"
141 ;; required by evolution-data-server
142 "-DGOBJECT_INTROSPECTION=true"
143 "-DICAL_GLIB_VAPI=true")
144 #:phases
145 (modify-phases %standard-phases
146 (add-before 'configure 'patch-paths
147 (lambda* (#:key inputs #:allow-other-keys)
148 ;; TODO: libical 3.1.0 supports using TZDIR instead of a hard-coded
149 ;; zoneinfo database. When that is released we can drop
150 ;; the tzdata dependency.
151 (let ((tzdata (assoc-ref inputs "tzdata")))
152 (substitute* "src/libical/icaltz-util.c"
153 (("\\\"/usr/share/zoneinfo\\\",")
154 (string-append "\"" tzdata "/share/zoneinfo\""))
155 (("\\\"/usr/lib/zoneinfo\\\",") "")
156 (("\\\"/etc/zoneinfo\\\",") "")
157 (("\\\"/usr/share/lib/zoneinfo\\\"") "")))
158 #t)))))
159 (native-inputs
160 `(("gobject-introspection" ,gobject-introspection)
161 ("gtk-doc" ,gtk-doc)
162 ("perl" ,perl)
163 ("pkg-config" ,pkg-config)
164 ("vala" ,vala)))
165 (inputs
166 `(("glib" ,glib)
167 ("libxml2" ,libxml2)
168 ("tzdata" ,tzdata)))
169 (propagated-inputs
170 ;; In Requires.private of libical.pc.
171 `(("icu4c" ,icu4c)))
172 (home-page "https://libical.github.io/libical/")
173 (synopsis "iCalendar protocols and data formats implementation")
174 (description
175 "Libical is an implementation of the iCalendar protocols and protocol
176 data units.")
177 ;; Can be used with either license. See COPYING.
178 (license (list license:lgpl2.1 license:mpl2.0))))
179
180 (define-public khal
181 (package
182 (name "khal")
183 (version "0.10.1")
184 (source (origin
185 (method url-fetch)
186 (uri (pypi-uri "khal" version))
187 (sha256
188 (base32
189 "1r8bkgjwkh7i8ygvsv51h1cnax50sb183vafg66x5snxf3dgjl6l"))
190 (patches
191 (list
192 (origin
193 (method url-fetch)
194 ;; This patch fixes an issue with python-urwid-2.1.0
195 (uri "https://github.com/pimutils/khal/commit/2c5990c2de2015b251ba23617faa40ee11b8c22a.patch")
196 (file-name "khal-compat-urwid-2.1.0.patch")
197 (sha256
198 (base32
199 "11nd8hkjz68imwqqn0p54zmb53z2pfxmzchaviy7jc1ky5s9l663")))))))
200 (build-system python-build-system)
201 (arguments
202 `(#:phases (modify-phases %standard-phases
203 ;; Building the manpage requires khal to be installed.
204 (add-after 'install 'manpage
205 (lambda* (#:key inputs outputs #:allow-other-keys)
206 ;; Make installed package available for running the tests
207 (add-installed-pythonpath inputs outputs)
208 (invoke "make" "--directory=doc/" "man")
209 (install-file
210 "doc/build/man/khal.1"
211 (string-append (assoc-ref outputs "out") "/share/man/man1"))
212 #t))
213 (replace 'check
214 (lambda* (#:key inputs #:allow-other-keys)
215 ;; The tests require us to choose a timezone.
216 (setenv "TZ"
217 (string-append (assoc-ref inputs "tzdata")
218 "/share/zoneinfo/Zulu"))
219 (invoke "py.test" "tests"))))))
220 (native-inputs
221 `(("python-pytest" ,python-pytest)
222 ("python-pytest-cov" ,python-pytest-cov)
223 ("python-setuptools-scm" ,python-setuptools-scm)
224 ;; Required for tests
225 ("python-freezegun" ,python-freezegun)
226 ("tzdata" ,tzdata-for-tests)
227 ("vdirsyncer" ,vdirsyncer)
228 ;; Required to build manpage
229 ("python-sphinxcontrib-newsfeed" ,python-sphinxcontrib-newsfeed)
230 ("python-sphinx" ,python-sphinx)))
231 (inputs
232 `(("sqlite" ,sqlite)
233 ("python-configobj" ,python-configobj)
234 ("python-dateutil" ,python-dateutil)
235 ("python-icalendar" ,python-icalendar)
236 ("python-tzlocal" ,python-tzlocal)
237 ("python-urwid" ,python-urwid)
238 ("python-pyxdg" ,python-pyxdg)))
239 (synopsis "Console calendar program")
240 (description "Khal is a standards based console calendar program,
241 able to synchronize with CalDAV servers through vdirsyncer.")
242 (home-page "https://lostpackets.de/khal/")
243 (license license:expat)))
244
245 (define-public remind
246 (package
247 (name "remind")
248 (version "3.1.17")
249 (source
250 (origin
251 (method url-fetch)
252 (uri (string-append "https://dianne.skoll.ca/projects/remind/download/"
253 "remind-"
254 (string-join (map (cut string-pad <> 2 #\0)
255 (string-split version #\.))
256 ".")
257 ".tar.gz"))
258 (sha256
259 (base32 "0lgyc2j69aqqk4knywr8inz4fsnni0zq54dgqh7p4s6kzybc2mf9"))))
260 (build-system gnu-build-system)
261 (arguments
262 '(#:tests? #f)) ; no "check" target
263 (home-page "https://dianne.skoll.ca/projects/remind/")
264 (synopsis "Sophisticated calendar and alarm program")
265 (description
266 "Remind allows you to remind yourself of upcoming events and appointments.
267 Each reminder or alarm can consist of a message sent to standard output, or a
268 program to be executed. It also features: sophisticated date calculation,
269 moon phases, sunrise/sunset, Hebrew calendar, alarms, PostScript output and
270 proper handling of holidays.")
271 (license license:gpl2)))
272
273 (define-public libhdate
274 (package
275 (name "libhdate")
276 (version "1.6.02")
277 (source
278 (origin
279 (method url-fetch)
280 (uri (string-append "mirror://sourceforge/libhdate/libhdate/libhdate-"
281 version "/" name "-" version ".tar.bz2"))
282 (sha256
283 (base32
284 "0qkpq412p78znw8gckwcx3l0wcss9s0dgw1pvjb1ih2pxf6hm4rw"))))
285 (build-system gnu-build-system)
286 (home-page "http://libhdate.sourceforge.net/")
287 (synopsis "Library to use Hebrew dates")
288 (description "LibHdate is a small library for the Hebrew calendar and times
289 of day, written in C, and including bindings for C++, pascal, perl, php, python,
290 and ruby. It includes two illustrative command-line programs, @code{hcal} and
291 @code{hdate}, and some snippets and scripts written in the binding languages.")
292 (license license:gpl3+)))