gnu: Adjust formatting as recommended by 'guix lint'.
[jackhill/guix/guix.git] / gnu / packages / glib.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2013, 2015 Andreas Enge <andreas@enge.fr>
4 ;;; Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org>
5 ;;; Copyright © 2014, 2015 Mark H Weaver <mhw@netris.org>
6 ;;;
7 ;;; This file is part of GNU Guix.
8 ;;;
9 ;;; GNU Guix is free software; you can redistribute it and/or modify it
10 ;;; under the terms of the GNU General Public License as published by
11 ;;; the Free Software Foundation; either version 3 of the License, or (at
12 ;;; your option) any later version.
13 ;;;
14 ;;; GNU Guix is distributed in the hope that it will be useful, but
15 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;;; GNU General Public License for more details.
18 ;;;
19 ;;; You should have received a copy of the GNU General Public License
20 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
21
22 (define-module (gnu packages glib)
23 #:use-module ((guix licenses) #:prefix license:)
24 #:use-module (guix packages)
25 #:use-module (guix download)
26 #:use-module (guix utils)
27 #:use-module (guix build-system gnu)
28 #:use-module (gnu packages)
29 #:use-module (gnu packages base)
30 #:use-module (gnu packages bison)
31 #:use-module (gnu packages compression)
32 #:use-module (gnu packages flex)
33 #:use-module (gnu packages gettext)
34 #:use-module (gnu packages gtk)
35 #:use-module (gnu packages libffi)
36 #:use-module (gnu packages perl)
37 #:use-module (gnu packages pkg-config)
38 #:use-module (gnu packages python)
39 #:use-module (gnu packages xml)
40 #:use-module (gnu packages bash)
41 #:use-module (gnu packages file)
42 #:use-module (gnu packages xorg)
43 #:use-module (gnu packages m4)
44
45 ;; Export variables up-front to allow circular dependency with the 'xorg'
46 ;; module.
47 #:export (dbus
48 glib
49 gobject-introspection
50 dbus-glib
51 intltool
52 itstool
53 libsigc++
54 glibmm
55 telepathy-glib))
56
57 (define dbus
58 (package
59 (name "dbus")
60 (version "1.10.0")
61 (source (origin
62 ;; TODO: Apply patch from DBUS/ACTIVATION below.
63 (method url-fetch)
64 (uri (string-append
65 "http://dbus.freedesktop.org/releases/dbus/dbus-"
66 version ".tar.gz"))
67 (sha256
68 (base32
69 "0jwj7wlrhq5y0fwfh8k2d9rgdpfax06lj8698g6iqbwrzd2rgyqx"))))
70 (build-system gnu-build-system)
71 (arguments
72 '(#:configure-flags
73 (list
74 ;; Install the system bus socket under /var.
75 "--localstatedir=/var"
76
77 ;; Install the session bus socket under /tmp.
78 "--with-session-socket-dir=/tmp"
79
80 ;; Use /etc/dbus-1 for system-wide config.
81 ;; Look for configuration file under
82 ;; /etc/dbus-1. This is notably required by
83 ;; 'dbus-daemon-launch-helper', which looks for
84 ;; the 'system.conf' file in that place,
85 ;; regardless of what '--config-file' was
86 ;; passed to 'dbus-daemon' on the command line;
87 ;; see <https://bugs.freedesktop.org/show_bug.cgi?id=92458>.
88 "--sysconfdir=/etc")
89 #:phases
90 (modify-phases %standard-phases
91 (replace 'install
92 (lambda _
93 ;; Don't try to create /var and /etc.
94 (system* "make"
95 "localstatedir=/tmp/dummy"
96 "sysconfdir=/tmp/dummy"
97 "install"))))))
98 (native-inputs
99 `(("pkg-config" ,pkg-config)))
100 (inputs
101 `(("expat" ,expat)
102
103 ;; Add a dependency on libx11 so that 'dbus-launch' has support for
104 ;; '--autolaunch'.
105 ("libx11" ,libx11)))
106
107 (home-page "http://dbus.freedesktop.org/")
108 (synopsis "Message bus for inter-process communication (IPC)")
109 (description
110 "D-Bus is a message bus system, a simple way for applications to
111 talk to one another. In addition to interprocess communication, D-Bus
112 helps coordinate process lifecycle; it makes it simple and reliable to
113 code a \"single instance\" application or daemon, and to launch
114 applications and daemons on demand when their services are needed.
115
116 D-Bus supplies both a system daemon (for events such as \"new hardware
117 device added\" or \"printer queue changed\") and a
118 per-user-login-session daemon (for general IPC needs among user
119 applications). Also, the message bus is built on top of a general
120 one-to-one message passing framework, which can be used by any two apps
121 to communicate directly (without going through the message bus
122 daemon). Currently the communicating applications are on one computer,
123 or through unencrypted TCP/IP suitable for use behind a firewall with
124 shared NFS home directories.")
125 (license license:gpl2+))) ; or Academic Free License 2.1
126
127 (define-public dbus/activation
128 ;; D-Bus with a patch to fix service activation.
129 ;; TODO: Merge with DBUS above.
130 (package
131 (inherit dbus)
132 (version (string-append (package-version dbus) ".a"))
133 (source (origin
134 (inherit (package-source dbus))
135 (patches
136 (list (search-patch "dbus-helper-search-path.patch")))))))
137
138 (define glib
139 (package
140 (name "glib")
141 (version "2.46.1")
142 (source (origin
143 (method url-fetch)
144 (uri (string-append "mirror://gnome/sources/"
145 name "/" (string-take version 4) "/"
146 name "-" version ".tar.xz"))
147 (sha256
148 (base32
149 "1yzxr1ip3l0m9ydk5nq32piq70c9f17p5f0jyvlsghzbaawh67ss"))
150 (patches (list (search-patch "glib-tests-homedir.patch")
151 (search-patch "glib-tests-desktop.patch")
152 (search-patch "glib-tests-prlimit.patch")
153 (search-patch "glib-tests-timer.patch")
154 (search-patch "glib-tests-gapplication.patch")))))
155 (build-system gnu-build-system)
156 (outputs '("out" ; everything
157 "bin" ; glib-mkenums, gtester, etc.; depends on Python
158 "doc")) ; 20 MiB of GTK-Doc reference
159 (inputs
160 `(("coreutils" ,coreutils)
161 ("libffi" ,libffi)
162 ("zlib" ,zlib)
163 ("tzdata" ,tzdata))) ; for tests/gdatetime.c
164 (native-inputs
165 `(("gettext" ,gnu-gettext)
166 ("dbus" ,dbus) ; for GDBus tests
167 ("pkg-config" ,pkg-config)
168 ("python" ,python-wrapper)
169 ("perl" ,perl) ; needed by GIO tests
170 ("bash" ,bash)))
171 (arguments
172 '(#:phases (alist-cons-before
173 'build 'pre-build
174 (lambda* (#:key inputs outputs #:allow-other-keys)
175 ;; For tests/gdatetime.c.
176 (setenv "TZDIR"
177 (string-append (assoc-ref inputs "tzdata")
178 "/share/zoneinfo"))
179
180 ;; Some tests want write access there.
181 (setenv "XDG_CACHE_HOME" (getcwd))
182
183 (substitute* '("glib/gspawn.c"
184 "glib/tests/utils.c"
185 "tests/spawn-test.c")
186 (("/bin/sh")
187 (string-append (assoc-ref inputs "bash") "/bin/sh")))
188
189 ;; Disable a test that requires dbus.
190 (substitute* "gio/tests/gdbus-serialization.c"
191 (("g_test_add_func \
192 \\(\"/gdbus/message-serialize/double-array\", test_double_array\\);" all)
193 (string-append "/* " all " */"))))
194 %standard-phases)
195
196 ;; Note: `--docdir' and `--htmldir' are not honored, so work around it.
197 #:configure-flags (list (string-append "--with-html-dir="
198 (assoc-ref %outputs "doc")
199 "/share/gtk-doc/html"))
200
201 ;; In 'gio/tests', 'gdbus-test-codegen-generated.h' is #included in a
202 ;; file that gets compiled possibly before it has been fully generated.
203 #:parallel-tests? #f))
204
205 (native-search-paths
206 ;; This variable is not really "owned" by GLib, but several related
207 ;; packages refer to it: gobject-introspection's tools use it as a search
208 ;; path for .gir files, and it's also a search path for schemas produced
209 ;; by 'glib-compile-schemas'.
210 (list (search-path-specification
211 (variable "XDG_DATA_DIRS")
212 (files '("share")))
213 ;; To load extra gio modules from glib-networking, etc.
214 (search-path-specification
215 (variable "GIO_EXTRA_MODULES")
216 (files '("lib/gio/modules")))))
217 (search-paths native-search-paths)
218
219 (synopsis "Thread-safe general utility library; basis of GTK+ and GNOME")
220 (description
221 "GLib provides data structure handling for C, portability wrappers,
222 and interfaces for such runtime functionality as an event loop, threads,
223 dynamic loading, and an object system.")
224 (home-page "http://developer.gnome.org/glib/")
225 (license license:lgpl2.0+))) ; some files are under lgpl2.1+
226
227 (define gobject-introspection
228 (package
229 (name "gobject-introspection")
230 (version "1.46.0")
231 (source (origin
232 (method url-fetch)
233 (uri (string-append "mirror://gnome/sources/"
234 "gobject-introspection/" (version-major+minor version)
235 "/gobject-introspection-" version ".tar.xz"))
236 (sha256
237 (base32 "0cs27r18fga44ypp8icy62fwx6nh70r1bvhi4lzfn4w85cybsn36"))
238 (modules '((guix build utils)))
239 (snippet
240 '(substitute* "tools/g-ir-tool-template.in"
241 (("#!/usr/bin/env @PYTHON@") "#!@PYTHON@")))
242 (patches (list
243 (search-patch "gobject-introspection-cc.patch")
244 (search-patch
245 "gobject-introspection-girepository.patch")
246 (search-patch
247 "gobject-introspection-absolute-shlib-path.patch")))))
248 (build-system gnu-build-system)
249 (inputs
250 `(("bison" ,bison)
251 ("cairo" ,cairo)
252 ("flex" ,flex)
253 ("glib" ,glib)
254 ("pkg-config" ,pkg-config)
255 ("python-2" ,python-2)))
256 (native-inputs
257 `(("glib" ,glib "bin")))
258 (propagated-inputs
259 `(;; In practice, GIR users will need libffi when using
260 ;; gobject-introspection.
261 ("libffi" ,libffi)))
262 (native-search-paths
263 (list (search-path-specification
264 (variable "GI_TYPELIB_PATH")
265 (files '("lib/girepository-1.0")))))
266 (search-paths native-search-paths)
267 (arguments
268 `(;; The patch 'gobject-introspection-absolute-shlib-path.patch' causes
269 ;; some tests to fail.
270 #:tests? #f))
271 (home-page "https://wiki.gnome.org/GObjectIntrospection")
272 (synopsis "Generate interface introspection data for GObject libraries")
273 (description
274 "GObject introspection is a middleware layer between C libraries (using
275 GObject) and language bindings. The C library can be scanned at compile time
276 and generate a metadata file, in addition to the actual native C library. Then
277 at runtime, language bindings can read this metadata and automatically provide
278 bindings to call into the C library.")
279 ; Some bits are distributed under the LGPL2+, others under the GPL2+
280 (license license:gpl2+)))
281
282 (define intltool
283 (package
284 (name "intltool")
285 (version "0.51.0")
286 (source (origin
287 (method url-fetch)
288 (uri (string-append "https://launchpad.net/intltool/trunk/"
289 version "/+download/intltool-"
290 version ".tar.gz"))
291 (sha256
292 (base32
293 "1karx4sb7bnm2j67q0q74hspkfn6lqprpy5r99vkn5bb36a4viv7"))))
294 (build-system gnu-build-system)
295 (inputs
296 `(("file" ,file)))
297 (propagated-inputs
298 `(;; Propagate gettext because users expect it to be there, and so does
299 ;; the `intltool-update' script.
300 ("gettext" ,gnu-gettext)
301
302 ("perl-xml-parser" ,perl-xml-parser)
303 ("perl" ,perl)))
304 (arguments
305 `(#:phases (alist-cons-after
306 'unpack 'patch-file-references
307 (lambda* (#:key inputs #:allow-other-keys)
308 (let ((file (assoc-ref inputs "file")))
309 (substitute* "intltool-update.in"
310 (("`file") (string-append "`" file "/bin/file")))))
311 %standard-phases)))
312 (home-page "https://launchpad.net/intltool/+download")
313 (synopsis "Tools to centralise translations of different file formats")
314 (description
315 "Intltool is a set of tools to centralise translations of many different
316 file formats using GNU gettext-compatible PO files.
317
318 The intltool collection can be used to do these things:
319
320 Extract translatable strings from various source files (.xml.in,
321 glade, .desktop.in, .server.in, .oaf.in).
322
323 Collect the extracted strings together with messages from traditional
324 source files (.c, .h) in po/$(PACKAGE).pot.
325
326 Merge back the translations from .po files into .xml, .desktop and
327 oaf files. This merge step will happen at build resp. installation time.")
328 (license license:gpl2+)))
329
330 (define itstool
331 (package
332 (name "itstool")
333 (version "2.0.2")
334 (source (origin
335 (method url-fetch)
336 (uri (string-append "http://files.itstool.org/itstool/itstool-"
337 version ".tar.bz2"))
338 (sha256
339 (base32
340 "0fh34wi52i0qikgvlmrcpf1vx6gc1xqdad4539l4d9hikfsrz45z"))))
341 (build-system gnu-build-system)
342 (inputs
343 `(("libxml2" ,libxml2)
344 ("python2-libxml2" ,python2-libxml2)
345 ("python-2" ,python-2)))
346 (arguments
347 '(#:phases
348 (modify-phases %standard-phases
349 (add-after
350 'install 'wrap-program
351 (lambda* (#:key outputs #:allow-other-keys)
352 (let ((prog (string-append (assoc-ref outputs "out")
353 "/bin/itstool")))
354 (wrap-program prog
355 `("PYTHONPATH" = (,(getenv "PYTHONPATH"))))))))))
356 (home-page "http://www.itstool.org")
357 (synopsis "Tool to translate XML documents with PO files")
358 (description
359 "ITS Tool allows you to translate your XML documents with PO files, using
360 rules from the W3C Internationalization Tag Set (ITS) to determine what to
361 translate and how to separate it into PO file messages.
362
363 PO files are the standard translation format for GNU and other Unix-like
364 systems. They present translatable information as discrete messages, allowing
365 each message to be translated independently. In contrast to whole-page
366 translation, translating with a message-based format like PO means you can
367 easily track changes to the source document down to the paragraph. When new
368 strings are added or existing strings are modified, you only need to update the
369 corresponding messages.
370
371 ITS Tool is designed to make XML documents translatable through PO files by
372 applying standard ITS rules, as well as extension rules specific to ITS Tool.
373 ITS also provides an industry standard way for authors to override translation
374 information in their documents, such as whether a particular element should be
375 translated.")
376 (license license:gpl3+)))
377
378 (define dbus-glib
379 (package
380 (name "dbus-glib")
381 (version "0.104")
382 (source (origin
383 (method url-fetch)
384 (uri
385 (string-append "http://dbus.freedesktop.org/releases/dbus-glib/dbus-glib-"
386 version ".tar.gz"))
387 (sha256
388 (base32
389 "1xi1v1msz75qs0s4lkyf1psrksdppa3hwkg0mznc6gpw5flg3hdz"))))
390 (build-system gnu-build-system)
391 (propagated-inputs ; according to dbus-glib-1.pc
392 `(("dbus" ,dbus)
393 ("glib" ,glib)))
394 (inputs
395 `(("expat" ,expat)))
396 (native-inputs
397 `(("glib" ,glib "bin")
398 ("pkg-config" ,pkg-config)))
399 (home-page "http://dbus.freedesktop.org/doc/dbus-glib/")
400 (synopsis "D-Bus GLib bindings")
401 (description
402 "GLib bindings for D-Bus. The package is obsolete and superseded
403 by GDBus included in Glib.")
404 (license license:gpl2))) ; or Academic Free License 2.1
405
406 (define libsigc++
407 (package
408 (name "libsigc++")
409 (version "2.6.1")
410 (source (origin
411 (method url-fetch)
412 (uri (string-append "mirror://gnome/sources/libsigc++/"
413 (version-major+minor version) "/"
414 name "-" version ".tar.xz"))
415 (sha256
416 (base32
417 "06xyvxaaxh3nbpjg86gcq5zcc2qnpx354wcfrqlhbndkq5kj2vqq"))))
418 (build-system gnu-build-system)
419 (native-inputs `(("pkg-config" ,pkg-config)
420 ("m4" ,m4)))
421 (home-page "http://libsigc.sourceforge.net/")
422 (synopsis "Type-safe callback system for standard C++")
423 (description
424 "Libsigc++ implements a type-safe callback system for standard C++. It
425 allows you to define signals and to connect those signals to any callback
426 function, either global or a member function, regardless of whether it is
427 static or virtual.
428
429 It also contains adaptor classes for connection of dissimilar callbacks and
430 has an ease of use unmatched by other C++ callback libraries.")
431 (license license:lgpl2.1+)))
432
433 (define glibmm
434 (package
435 (name "glibmm")
436 (version "2.46.1")
437 (source (origin
438 (method url-fetch)
439 (uri (string-append "mirror://gnome/sources/glibmm/"
440 (version-major+minor version)
441 "/glibmm-" version ".tar.xz"))
442 (sha256
443 (base32
444 "1an4v1yk06svlmcyp1psk2a3bsn29s1a4gdx0ai2w788q6bfaiwn"))))
445 (build-system gnu-build-system)
446 (arguments
447 `(#:phases (alist-cons-before
448 'build 'pre-build
449 (lambda _
450 ;; This test uses /etc/fstab as an example file to read
451 ;; from; choose a better example.
452 (substitute* "tests/giomm_simple/main.cc"
453 (("/etc/fstab")
454 (string-append (getcwd)
455 "/tests/giomm_simple/main.cc")))
456
457 ;; This test does a DNS lookup, and then expects to be able
458 ;; to open a TLS session; just skip it.
459 (substitute* "tests/giomm_tls_client/main.cc"
460 (("Gio::init.*$")
461 "return 77;\n")))
462 %standard-phases)))
463 (native-inputs `(("pkg-config" ,pkg-config)
464 ("glib" ,glib "bin")))
465 (propagated-inputs
466 `(("libsigc++" ,libsigc++)
467 ("glib" ,glib)))
468 (home-page "http://gtkmm.org/")
469 (synopsis "C++ interface to the GLib library")
470 (description
471 "Glibmm provides a C++ programming interface to the part of GLib that are
472 useful for C++.")
473 (license license:lgpl2.1+)))
474
475 (define-public python2-pygobject-2
476 (package
477 (name "python2-pygobject")
478 ;; This was the last version to declare the 2.0 platform number, i.e. its
479 ;; pkg-config files were named pygobject-2.0.pc
480 (version "2.28.6")
481 (source
482 (origin
483 (method url-fetch)
484 (uri (string-append "mirror://gnome/sources/pygobject/"
485 (version-major+minor version)
486 "/pygobject-" version ".tar.xz"))
487 (sha256
488 (base32
489 "1f5dfxjnil2glfwxnqr14d2cjfbkghsbsn8n04js2c2icr7iv2pv"))
490 (patches
491 (list (search-patch
492 "python2-pygobject-2-gi-info-type-error-domain.patch")))))
493 (build-system gnu-build-system)
494 (native-inputs
495 `(("which" ,which)
496 ("glib-bin" ,glib "bin") ;for tests: glib-compile-schemas
497 ("pkg-config" ,pkg-config)
498 ("dbus" ,dbus))) ;for tests
499 (inputs
500 `(("python" ,python-2)
501 ("glib" ,glib)
502 ("python2-pycairo" ,python2-pycairo)
503 ("gobject-introspection" ,gobject-introspection)))
504 (propagated-inputs
505 `(("libffi" ,libffi))) ;mentioned in pygobject-2.0.pc
506 (arguments
507 `(#:tests? #f ;segfaults during tests
508 #:configure-flags '("LIBS=-lcairo-gobject")))
509 (home-page "https://pypi.python.org/pypi/PyGObject")
510 (synopsis "Python bindings for GObject")
511 (description
512 "Python bindings for GLib, GObject, and GIO.")
513 (license license:lgpl2.1+)))
514
515 (define-public python-pygobject
516 (package
517 (name "python-pygobject")
518 (version "3.18.0")
519 (source
520 (origin
521 (method url-fetch)
522 (uri (string-append "mirror://gnome/sources/pygobject/"
523 (version-major+minor version)
524 "/pygobject-" version ".tar.xz"))
525 (sha256
526 (base32
527 "1jbd2m39vcjh5h3m33l0317ziq8dxfzi40r6hrfcs4rp5l8s2fqw"))))
528 (build-system gnu-build-system)
529 (native-inputs
530 `(("which" ,which)
531 ("glib-bin" ,glib "bin") ;for tests: glib-compile-schemas
532 ("pkg-config" ,pkg-config)))
533 (inputs
534 `(("python" ,python)
535 ("glib" ,glib)
536 ("python-pycairo" ,python-pycairo)
537 ("gobject-introspection" ,gobject-introspection)
538 ("libffi" ,libffi)))
539 (arguments
540 ;; TODO: failing tests: test_native_calls_async
541 ;; test_native_calls_async_errors test_native_calls_sync
542 ;; test_native_calls_sync_errors test_python_calls_async
543 ;; test_python_calls_async_error test_python_calls_async_error_result
544 ;; test_python_calls_sync test_python_calls_sync_errors
545 ;; test_python_calls_sync_noargs test_callback_user_data_middle_none
546 ;; test_callback_user_data_middle_single
547 ;; test_callback_user_data_middle_tuple
548 '(#:tests? #f))
549 (home-page "https://live.gnome.org/PyGObject")
550 (synopsis "Python bindings for GObject")
551 (description
552 "Python bindings for GLib, GObject, and GIO.")
553 (license license:lgpl2.1+)))
554
555 (define-public python2-pygobject
556 (package (inherit python-pygobject)
557 (name "python2-pygobject")
558 (inputs
559 `(("python" ,python-2)
560 ("glib" ,glib)
561 ("python-pycairo" ,python2-pycairo)
562 ("gobject-introspection" ,gobject-introspection)
563 ("libffi" ,libffi)))))
564
565 (define telepathy-glib
566 (package
567 (name "telepathy-glib")
568 (version "0.24.1")
569 (source
570 (origin
571 (method url-fetch)
572 (uri
573 (string-append
574 "http://telepathy.freedesktop.org/releases/telepathy-glib/"
575 "telepathy-glib-" version ".tar.gz"))
576 (sha256
577 (base32
578 "1symyzbjmxvksn2ifdkk50lafjm2llf2sbmky062gq2pz3cg23cy"))
579 (patches
580 (list
581 ;; Don't use the same test name for multiple tests.
582 ;; <https://bugs.freedesktop.org/show_bug.cgi?id=92245>
583 (origin
584 (method url-fetch)
585 (uri "https://bugs.freedesktop.org/attachment.cgi?id=118608")
586 (file-name (string-append "telepathy-glib-duplicate-tests.patch"))
587 (sha256
588 (base32
589 "0z261fwrszxb28ccg3hsg9rizig4s84zvwmx6y31a4pyv7bvs5w3")))))))
590 (build-system gnu-build-system)
591 (native-inputs
592 `(("glib" ,glib "bin") ; uses glib-mkenums
593 ("gobject-introspection" ,gobject-introspection)
594 ("pkg-config" ,pkg-config)
595 ("python" ,python-2)
596 ("xsltproc" ,libxslt)))
597 (propagated-inputs
598 ;; There are all in the Requires.private field of telepathy-glib.pc.
599 `(("dbus" ,dbus)
600 ("dbus-glib" ,dbus-glib)
601 ("glib" ,glib)))
602 (home-page "http://telepathy.freedesktop.org/wiki/")
603 (synopsis "GLib Real-time communications framework over D-Bus")
604 (description "Telepathy is a flexible, modular communications framework
605 that enables real-time communication over D-Bus via pluggable protocol
606 backends. Telepathy is a communications service that can be accessed by
607 many applications simultaneously.
608
609 This package provides the library for GLib applications.")
610 (license license:lgpl2.1+)))