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