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