gnu: khal: Fix build with python-urwid-2.1.0.
[jackhill/guix/guix.git] / gnu / packages / calendar.scm
CommitLineData
e5326da4
DT
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2015 David Thompson <davet@gnu.org>
be81133a 3;;; Copyright © 2015, 2016, 2017 Leo Famulari <leo@famulari.name>
3c8ba11a 4;;; Copyright © 2016 Kei Kebreau <kkebreau@posteo.net>
523ecbbb 5;;; Copyright © 2016, 2017 Efraim Flashner <efraim@flashner.co.il>
bc8273d0 6;;; Copyright © 2016 Troy Sankey <sankeytms@gmail.com>
696cb41b 7;;; Copyright © 2016 Stefan Reichoer <stefan@xsteve.at>
88888cd0 8;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
20fe3cd7 9;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com
1afd98dc 10;;; Copyright © 2020 Brendan Tildesley <mail@brendan.scot>
e5326da4
DT
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)
1eaba63f 29 #:use-module ((guix licenses) #:prefix license:)
1afd98dc 30 #:use-module (guix git-download)
e5326da4
DT
31 #:use-module (guix packages)
32 #:use-module (guix download)
696cb41b 33 #:use-module (guix build-system gnu)
e5326da4 34 #:use-module (guix build-system cmake)
78e6c4a8
LF
35 #:use-module (guix build-system python)
36 #:use-module (gnu packages base)
ac257f12 37 #:use-module (gnu packages check)
78e6c4a8
LF
38 #:use-module (gnu packages dav)
39 #:use-module (gnu packages freedesktop)
09183df2 40 #:use-module (gnu packages glib)
ab6693c4 41 #:use-module (gnu packages gtk)
e5326da4 42 #:use-module (gnu packages icu4c)
78e6c4a8 43 #:use-module (gnu packages perl)
09183df2 44 #:use-module (gnu packages pkg-config)
696cb41b 45 #:use-module (gnu packages python)
44d10b1f 46 #:use-module (gnu packages python-xyz)
9d0c291e 47 #:use-module (gnu packages sphinx)
cd0322a3 48 #:use-module (gnu packages sqlite)
33dc54b0 49 #:use-module (gnu packages time)
09183df2 50 #:use-module (gnu packages xml)
696cb41b 51 #:use-module (srfi srfi-26))
e5326da4 52
1afd98dc
BT
53(define-public date
54 ;; We make the same choice as the Arch package maintainer by choosing a
55 ;; recent commit to fix some bugs.
56 ;; https://github.com/Alexays/Waybar/issues/565
57 (let ((commit "9a0ee2542848ab8625984fc8cdbfb9b5414c0082"))
58 (package
59 (name "date")
60 (version (string-append "2.4.1-" (string-take commit 8)))
61 (source
62 (origin
63 (method git-fetch)
64 (uri (git-reference
65 (url "https://github.com/HowardHinnant/date.git")
66 (commit "9a0ee2542848ab8625984fc8cdbfb9b5414c0082")))
67 (file-name (git-file-name name version))
68 (sha256
69 (base32 "0yxsn0hj22n61bjywysxqgfv7hj5xvsl6isma95fl8xrimpny083"))
70 (patches
71 ;; Install pkg-config files
72 ;; https://github.com/HowardHinnant/date/pull/538
73 (search-patches "date-output-pkg-config-files.patch"))))
74 (inputs `(("tzdata" ,tzdata)))
75 (build-system cmake-build-system)
76 (arguments
77 '(#:configure-flags (list "-DUSE_SYSTEM_TZ_DB=ON"
78 "-DBUILD_SHARED_LIBS=ON"
79 "-DBUILD_TZ_LIB=ON"
80 "-DENABLE_DATE_TESTING=ON")
81 #:phases
82 (modify-phases %standard-phases
83 (add-after 'unpack 'patch-bin-bash
84 (lambda* (#:key inputs #:allow-other-keys)
85 (substitute* "compile_fail.sh"
86 (("/bin/bash") (which "bash")))
87 #t))
88 (add-after 'unpack 'patch-zoneinfo-path
89 (lambda* (#:key inputs #:allow-other-keys)
90 (substitute* "src/tz.cpp"
91 (("/usr/share/zoneinfo")
92 (string-append (assoc-ref inputs "tzdata") "/share/zoneinfo")))
93 #t))
94 (replace 'check
95 (lambda _
96 ;; Disable test that requires checking timezone that
97 ;; isn't set in the build environment.
98 (substitute* "CTestTestfile.cmake"
99 (("add_test.tz_test_pass_zoned_time_deduction_test.*") "")
100 (("set_tests_properties.tz_test_pass_zoned_time_deduction_test.*") ""))
101 (invoke "make" "testit"))))))
102 (synopsis "Date and time library for C++11 and C++14")
103 (description "Date is a header only C++ library that extends the chrono
104date algorithms library for calendar dates and durations. It also provides
105the <tz.h> library for handling time zones and leap seconds.")
106 (home-page "https://howardhinnant.github.io/date/date.html")
107 (license license:expat))))
108
e5326da4
DT
109(define-public libical
110 (package
111 (name "libical")
50adab10 112 (version "3.0.7")
e5326da4
DT
113 (source (origin
114 (method url-fetch)
115 (uri (string-append
116 "https://github.com/libical/libical/releases/download/v"
117 version "/libical-" version ".tar.gz"))
118 (sha256
119 (base32
20fe3cd7
MB
120 "1z33wzaazbd7drl6qbh1750whd78xl2cg0gjnxyya9m83vgndgha"))
121 (patches
122 ;; Add a patch slated for 3.0.8 which preserves backwards-
123 ;; compatibility in the icalattach_new_from_data() function,
124 ;; which accidentally changed in 3.0.7 and could break some uses.
125 ;; https://gitlab.gnome.org/GNOME/evolution-data-server/issues/185
126 ;; http://lists.infradead.org/pipermail/libical-devel/2020-January/000907.html
127 (list (origin
128 (method url-fetch)
129 (uri (string-append
130 "https://github.com/libical/libical/commit/"
131 "ae394010c889e4c185160da5e81527849f9de350.patch"))
132 (file-name "libical-3.0.7-preserve-icalattach-api.patch")
133 (sha256
134 (base32
135 "0v8qcxn8a6sh78grzxd61j9478928dx38l5mf8mkdrbxv47vmvvp")))))))
e5326da4
DT
136 (build-system cmake-build-system)
137 (arguments
22c161d0 138 '(#:tests? #f ; test suite appears broken
09183df2 139 #:configure-flags '("-DSHARED_ONLY=true")
22c161d0
KY
140 #:phases
141 (modify-phases %standard-phases
142 (add-before 'configure 'patch-paths
09183df2 143 (lambda* (#:key inputs #:allow-other-keys)
20fe3cd7
MB
144 ;; TODO: libical 3.1.0 supports using TZDIR instead of a hard-coded
145 ;; zoneinfo database. When that is released we can drop
09183df2
MB
146 ;; the tzdata dependency.
147 (let ((tzdata (assoc-ref inputs "tzdata")))
22c161d0 148 (substitute* "src/libical/icaltz-util.c"
be81133a
LF
149 (("\\\"/usr/share/zoneinfo\\\",")
150 (string-append "\"" tzdata "/share/zoneinfo\""))
151 (("\\\"/usr/lib/zoneinfo\\\",") "")
152 (("\\\"/etc/zoneinfo\\\",") "")
153 (("\\\"/usr/share/lib/zoneinfo\\\"") "")))
22c161d0 154 #t)))))
e5326da4 155 (native-inputs
ab6693c4
MB
156 `(("gtk-doc" ,gtk-doc)
157 ("perl" ,perl)
09183df2 158 ("pkg-config" ,pkg-config)))
e5326da4 159 (inputs
09183df2
MB
160 `(("glib" ,glib)
161 ("libxml2" ,libxml2)
22c161d0 162 ("tzdata" ,tzdata)))
09183df2
MB
163 (propagated-inputs
164 ;; In Requires.private of libical.pc.
165 `(("icu4c" ,icu4c)))
e5326da4
DT
166 (home-page "https://libical.github.io/libical/")
167 (synopsis "iCalendar protocols and data formats implementation")
168 (description
169 "Libical is an implementation of the iCalendar protocols and protocol
170data units.")
09183df2
MB
171 ;; Can be used with either license. See COPYING.
172 (license (list license:lgpl2.1 license:mpl2.0))))
78e6c4a8
LF
173
174(define-public khal
175 (package
176 (name "khal")
2125cf62 177 (version "0.10.1")
78e6c4a8
LF
178 (source (origin
179 (method url-fetch)
180 (uri (pypi-uri "khal" version))
181 (sha256
182 (base32
b9dd2a2f
EF
183 "1r8bkgjwkh7i8ygvsv51h1cnax50sb183vafg66x5snxf3dgjl6l"))
184 (patches
185 (list
186 (origin
187 (method url-fetch)
188 ;; This patch fixes an issue with python-urwid-2.1.0
189 (uri "https://github.com/pimutils/khal/commit/2c5990c2de2015b251ba23617faa40ee11b8c22a.patch")
190 (file-name "khal-compat-urwid-2.1.0.patch")
191 (sha256
192 (base32
193 "11nd8hkjz68imwqqn0p54zmb53z2pfxmzchaviy7jc1ky5s9l663")))))))
78e6c4a8
LF
194 (build-system python-build-system)
195 (arguments
196 `(#:phases (modify-phases %standard-phases
78e6c4a8
LF
197 ;; Building the manpage requires khal to be installed.
198 (add-after 'install 'manpage
32212074
HG
199 (lambda* (#:key inputs outputs #:allow-other-keys)
200 ;; Make installed package available for running the tests
201 (add-installed-pythonpath inputs outputs)
6c738fe9
TGR
202 (invoke "make" "--directory=doc/" "man")
203 (install-file
204 "doc/build/man/khal.1"
205 (string-append (assoc-ref outputs "out") "/share/man/man1"))
206 #t))
78e6c4a8
LF
207 (replace 'check
208 (lambda* (#:key inputs #:allow-other-keys)
3202d601 209 ;; The tests require us to choose a timezone.
78e6c4a8
LF
210 (setenv "TZ"
211 (string-append (assoc-ref inputs "tzdata")
212 "/share/zoneinfo/Zulu"))
6e1f91d9 213 (invoke "py.test" "tests"))))))
78e6c4a8 214 (native-inputs
928da609 215 `(("python-pytest" ,python-pytest)
bc8273d0 216 ("python-pytest-cov" ,python-pytest-cov)
78e6c4a8
LF
217 ("python-setuptools-scm" ,python-setuptools-scm)
218 ;; Required for tests
bc8273d0 219 ("python-freezegun" ,python-freezegun)
6e1f91d9 220 ("tzdata" ,tzdata-for-tests)
46f3c8f2 221 ("vdirsyncer" ,vdirsyncer)
78e6c4a8
LF
222 ;; Required to build manpage
223 ("python-sphinxcontrib-newsfeed" ,python-sphinxcontrib-newsfeed)
224 ("python-sphinx" ,python-sphinx)))
225 (inputs
226 `(("sqlite" ,sqlite)))
227 (propagated-inputs
228 `(("python-configobj" ,python-configobj)
22d7360b 229 ("python-dateutil" ,python-dateutil)
78e6c4a8
LF
230 ("python-icalendar" ,python-icalendar)
231 ("python-tzlocal" ,python-tzlocal)
232 ("python-urwid" ,python-urwid)
46f3c8f2 233 ("python-pyxdg" ,python-pyxdg)))
78e6c4a8
LF
234 (synopsis "Console calendar program")
235 (description "Khal is a standards based console calendar program,
236able to synchronize with CalDAV servers through vdirsyncer.")
5309c3a1 237 (home-page "https://lostpackets.de/khal/")
1eaba63f 238 (license license:expat)))
696cb41b
SR
239
240(define-public remind
241 (package
242 (name "remind")
e3ce8fbf 243 (version "3.1.17")
696cb41b
SR
244 (source
245 (origin
246 (method url-fetch)
88888cd0 247 (uri (string-append "https://dianne.skoll.ca/projects/remind/download/"
696cb41b
SR
248 "remind-"
249 (string-join (map (cut string-pad <> 2 #\0)
250 (string-split version #\.))
251 ".")
252 ".tar.gz"))
253 (sha256
e3ce8fbf 254 (base32 "0lgyc2j69aqqk4knywr8inz4fsnni0zq54dgqh7p4s6kzybc2mf9"))))
696cb41b
SR
255 (build-system gnu-build-system)
256 (arguments
88888cd0
TGR
257 '(#:tests? #f)) ; no "check" target
258 (home-page "https://dianne.skoll.ca/projects/remind/")
696cb41b
SR
259 (synopsis "Sophisticated calendar and alarm program")
260 (description
261 "Remind allows you to remind yourself of upcoming events and appointments.
262Each reminder or alarm can consist of a message sent to standard output, or a
263program to be executed. It also features: sophisticated date calculation,
264moon phases, sunrise/sunset, Hebrew calendar, alarms, PostScript output and
265proper handling of holidays.")
1eaba63f 266 (license license:gpl2)))
585b72c6
EF
267
268(define-public libhdate
269 (package
270 (name "libhdate")
271 (version "1.6.02")
272 (source
273 (origin
274 (method url-fetch)
275 (uri (string-append "mirror://sourceforge/libhdate/libhdate/libhdate-"
276 version "/" name "-" version ".tar.bz2"))
277 (sha256
278 (base32
279 "0qkpq412p78znw8gckwcx3l0wcss9s0dgw1pvjb1ih2pxf6hm4rw"))))
280 (build-system gnu-build-system)
281 (home-page "http://libhdate.sourceforge.net/")
282 (synopsis "Library to use Hebrew dates")
283 (description "LibHdate is a small library for the Hebrew calendar and times
284of day, written in C, and including bindings for C++, pascal, perl, php, python,
285and ruby. It includes two illustrative command-line programs, @code{hcal} and
286@code{hdate}, and some snippets and scripts written in the binding languages.")
1eaba63f 287 (license license:gpl3+)))