1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2014, 2015, 2016 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, 2016 Mark H Weaver <mhw@netris.org>
6 ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
7 ;;; Copyright © 2016 Lukas Gradl <lgradl@openmailbox.org>
9 ;;; This file is part of GNU Guix.
11 ;;; GNU Guix is free software; you can redistribute it and/or modify it
12 ;;; under the terms of the GNU General Public License as published by
13 ;;; the Free Software Foundation; either version 3 of the License, or (at
14 ;;; your option) any later version.
16 ;;; GNU Guix is distributed in the hope that it will be useful, but
17 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;;; GNU General Public License for more details.
21 ;;; You should have received a copy of the GNU General Public License
22 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
24 (define-module (gnu packages glib)
25 #:use-module ((guix licenses) #:prefix license:)
26 #:use-module (guix packages)
27 #:use-module (guix download)
28 #:use-module (guix utils)
29 #:use-module (guix build-system gnu)
30 #:use-module (guix build-system python)
31 #:use-module (gnu packages)
32 #:use-module (gnu packages base)
33 #:use-module (gnu packages bison)
34 #:use-module (gnu packages compression)
35 #:use-module (gnu packages enlightenment)
36 #:use-module (gnu packages flex)
37 #:use-module (gnu packages gettext)
38 #:use-module (gnu packages gnome)
39 #:use-module (gnu packages gtk)
40 #:use-module (gnu packages libffi)
41 #:use-module (gnu packages pcre)
42 #:use-module (gnu packages perl)
43 #:use-module (gnu packages pkg-config)
44 #:use-module (gnu packages python)
45 #:use-module (gnu packages xml)
46 #:use-module (gnu packages bash)
47 #:use-module (gnu packages file)
48 #:use-module (gnu packages xml)
49 #:use-module (gnu packages xorg)
50 #:use-module (gnu packages m4)
52 ;; Export variables up-front to allow circular dependency with the 'xorg'
67 (replacement dbus-1.10.12)
72 "https://dbus.freedesktop.org/releases/dbus/dbus-"
76 "0hwsfczhx2djmc9116vj5v230i7gpjihwh3vbljs1ldlk831v3wx"))
77 (patches (search-patches "dbus-helper-search-path.patch"))))
78 (build-system gnu-build-system)
82 ;; Install the system bus socket under /var.
83 "--localstatedir=/var"
85 ;; Install the session bus socket under /tmp.
86 "--with-session-socket-dir=/tmp"
88 ;; Use /etc/dbus-1 for system-wide config.
89 ;; Look for configuration file under
90 ;; /etc/dbus-1. This is notably required by
91 ;; 'dbus-daemon-launch-helper', which looks for
92 ;; the 'system.conf' file in that place,
93 ;; regardless of what '--config-file' was
94 ;; passed to 'dbus-daemon' on the command line;
95 ;; see <https://bugs.freedesktop.org/show_bug.cgi?id=92458>.
98 (modify-phases %standard-phases
101 ;; Don't try to create /var and /etc.
103 "localstatedir=/tmp/dummy"
104 "sysconfdir=/tmp/dummy"
107 `(("pkg-config" ,pkg-config)))
111 ;; Add a dependency on libx11 so that 'dbus-launch' has support for
115 (home-page "http://dbus.freedesktop.org/")
116 (synopsis "Message bus for inter-process communication (IPC)")
118 "D-Bus is a message bus system, a simple way for applications to
119 talk to one another. In addition to interprocess communication, D-Bus
120 helps coordinate process lifecycle; it makes it simple and reliable to
121 code a \"single instance\" application or daemon, and to launch
122 applications and daemons on demand when their services are needed.
124 D-Bus supplies both a system daemon (for events such as \"new hardware
125 device added\" or \"printer queue changed\") and a
126 per-user-login-session daemon (for general IPC needs among user
127 applications). Also, the message bus is built on top of a general
128 one-to-one message passing framework, which can be used by any two apps
129 to communicate directly (without going through the message bus
130 daemon). Currently the communicating applications are on one computer,
131 or through unencrypted TCP/IP suitable for use behind a firewall with
132 shared NFS home directories.")
133 (license license:gpl2+))) ; or Academic Free License 2.1
140 (let ((version "1.10.12"))
142 (inherit (package-source dbus))
144 "https://dbus.freedesktop.org/releases/dbus/dbus-"
148 "0pa71vf5c0d7k3gni06iascmplj0j5g70wbc833ayvi71d1pj2i1")))))))
156 (uri (string-append "mirror://gnome/sources/"
157 name "/" (string-take version 4) "/"
158 name "-" version ".tar.xz"))
161 "1x6kwrk1zyd3csv0ca3pmwc4bnkc33agn95cds15h6nbi4apappj"))
162 (patches (search-patches "glib-tests-timer.patch"))))
163 (build-system gnu-build-system)
164 (outputs '("out" ; everything
165 "bin" ; glib-mkenums, gtester, etc.; depends on Python
166 "doc")) ; 20 MiB of GTK-Doc reference
168 `(("pcre" ,pcre))) ; in the Requires.private field of glib-2.0.pc
170 `(("coreutils" ,coreutils)
173 ("tzdata" ,tzdata))) ; for tests/gdatetime.c
175 `(("gettext" ,gettext-minimal)
176 ("dbus" ,dbus) ; for GDBus tests
177 ("pkg-config" ,pkg-config)
178 ("python" ,python-wrapper)
179 ("perl" ,perl) ; needed by GIO tests
183 (modify-phases %standard-phases
184 (add-before 'build 'pre-build
185 (lambda* (#:key inputs outputs #:allow-other-keys)
186 ;; For tests/gdatetime.c.
188 (string-append (assoc-ref inputs "tzdata")
191 ;; Some tests want write access there.
192 (setenv "HOME" (getcwd))
193 (setenv "XDG_CACHE_HOME" (getcwd))
195 (substitute* '("glib/gspawn.c"
197 "tests/spawn-test.c")
199 (string-append (assoc-ref inputs "bash") "/bin/sh")))))
200 (add-before 'check 'disable-failing-tests
203 (lambda (test-file test-paths)
204 (define pattern+procs
205 (map (lambda (test-path)
207 ;; XXX: only works for single line statements.
208 (format #f "g_test_add_func.*\"~a\".*" test-path)
211 (substitute test-file pattern+procs)))
213 '(("glib/tests/thread.c"
214 (;; prlimit(2) returns ENOSYS on Linux 2.6.32-5-xen-amd64
215 ;; as found on hydra.gnu.org, and strace(1) doesn't
219 ("glib/tests/timer.c"
220 (;; fails if compiler optimizations are enabled, which they
224 ("gio/tests/gapplication.c"
225 (;; XXX: proven to be unreliable. See:
226 ;; <https://bugs.debian.org/756273>
227 ;; <http://bugs.gnu.org/18445>
230 ;; XXX: fails randomly for unknown reason. See:
231 ;; <https://lists.gnu.org/archive/html/guix-devel/2016-04/msg00215.html>
232 "/gapplication/local-actions"))
234 ("gio/tests/contenttype.c"
235 (;; XXX: requires shared-mime-info.
237 "/contenttype/subtype"
240 "/contenttype/symbolic-icon"
241 "/contenttype/tree"))
243 ("gio/tests/appinfo.c"
244 (;; XXX: requires update-desktop-database.
245 "/appinfo/associations"))
247 ("gio/tests/desktop-app-info.c"
248 (;; XXX: requires update-desktop-database.
249 "/desktop-app-info/delete"
250 "/desktop-app-info/default"
251 "/desktop-app-info/fallback"
252 "/desktop-app-info/lastused"
253 "/desktop-app-info/search"))
255 ("gio/tests/gdbus-peer.c"
256 (;; Requires /etc/machine-id.
257 "/gdbus/codegen-peer-to-peer"))
259 ("gio/tests/gdbus-unix-addresses.c"
260 (;; Requires /etc/machine-id.
261 "/gdbus/x11-autolaunch")))))
262 (and-map (lambda (x) (apply disable x)) failing-tests)))))
264 ;; Note: `--docdir' and `--htmldir' are not honored, so work around it.
265 #:configure-flags (list (string-append "--with-html-dir="
266 (assoc-ref %outputs "doc")
267 "/share/gtk-doc/html"))
269 ;; In 'gio/tests', 'gdbus-test-codegen-generated.h' is #included in a
270 ;; file that gets compiled possibly before it has been fully generated.
271 #:parallel-tests? #f))
274 ;; This variable is not really "owned" by GLib, but several related
275 ;; packages refer to it: gobject-introspection's tools use it as a search
276 ;; path for .gir files, and it's also a search path for schemas produced
277 ;; by 'glib-compile-schemas'.
278 (list (search-path-specification
279 (variable "XDG_DATA_DIRS")
281 ;; To load extra gio modules from glib-networking, etc.
282 (search-path-specification
283 (variable "GIO_EXTRA_MODULES")
284 (files '("lib/gio/modules")))))
285 (search-paths native-search-paths)
287 (synopsis "Thread-safe general utility library; basis of GTK+ and GNOME")
289 "GLib provides data structure handling for C, portability wrappers,
290 and interfaces for such runtime functionality as an event loop, threads,
291 dynamic loading, and an object system.")
292 (home-page "http://developer.gnome.org/glib/")
293 (license license:lgpl2.0+))) ; some files are under lgpl2.1+
295 (define gobject-introspection
297 (name "gobject-introspection")
301 (uri (string-append "mirror://gnome/sources/"
302 "gobject-introspection/" (version-major+minor version)
303 "/gobject-introspection-" version ".tar.xz"))
305 (base32 "0xsqwxhfqzr79av89mg766kxpb2i41bd0vwspk01xjdzrnn5l9zs"))
306 (modules '((guix build utils)))
308 '(substitute* "tools/g-ir-tool-template.in"
309 (("#!/usr/bin/env @PYTHON@") "#!@PYTHON@")))
310 (patches (search-patches
311 "gobject-introspection-cc.patch"
312 "gobject-introspection-girepository.patch"
313 "gobject-introspection-absolute-shlib-path.patch"))))
314 (build-system gnu-build-system)
319 ("python-2" ,python-2)))
321 `(("glib" ,glib "bin")
322 ("pkg-config" ,pkg-config)))
324 `(;; In practice, GIR users will need libffi when using
325 ;; gobject-introspection.
328 (list (search-path-specification
329 (variable "GI_TYPELIB_PATH")
330 (files '("lib/girepository-1.0")))))
331 (search-paths native-search-paths)
333 `(;; The patch 'gobject-introspection-absolute-shlib-path.patch' causes
334 ;; some tests to fail.
336 (home-page "https://wiki.gnome.org/GObjectIntrospection")
337 (synopsis "Generate interface introspection data for GObject libraries")
339 "GObject introspection is a middleware layer between C libraries (using
340 GObject) and language bindings. The C library can be scanned at compile time
341 and generate a metadata file, in addition to the actual native C library. Then
342 at runtime, language bindings can read this metadata and automatically provide
343 bindings to call into the C library.")
344 ; Some bits are distributed under the LGPL2+, others under the GPL2+
345 (license license:gpl2+)))
353 (uri (string-append "https://launchpad.net/intltool/trunk/"
354 version "/+download/intltool-"
358 "1karx4sb7bnm2j67q0q74hspkfn6lqprpy5r99vkn5bb36a4viv7"))))
359 (build-system gnu-build-system)
363 `(;; Propagate gettext because users expect it to be there, and so does
364 ;; the `intltool-update' script.
365 ("gettext" ,gettext-minimal)
367 ("perl-xml-parser" ,perl-xml-parser)
370 `(#:phases (alist-cons-after
371 'unpack 'patch-file-references
372 (lambda* (#:key inputs #:allow-other-keys)
373 (let ((file (assoc-ref inputs "file")))
374 (substitute* "intltool-update.in"
375 (("`file") (string-append "`" file "/bin/file")))))
377 (home-page "https://launchpad.net/intltool/+download")
378 (synopsis "Tools to centralise translations of different file formats")
380 "Intltool is a set of tools to centralise translations of many different
381 file formats using GNU gettext-compatible PO files.
383 The intltool collection can be used to do these things:
385 Extract translatable strings from various source files (.xml.in,
386 glade, .desktop.in, .server.in, .oaf.in).
388 Collect the extracted strings together with messages from traditional
389 source files (.c, .h) in po/$(PACKAGE).pot.
391 Merge back the translations from .po files into .xml, .desktop and
392 oaf files. This merge step will happen at build resp. installation time.")
393 (license license:gpl2+)))
401 (uri (string-append "http://files.itstool.org/itstool/itstool-"
405 "0fh34wi52i0qikgvlmrcpf1vx6gc1xqdad4539l4d9hikfsrz45z"))))
406 (build-system gnu-build-system)
408 `(("libxml2" ,libxml2)
409 ("python2-libxml2" ,python2-libxml2)
410 ("python-2" ,python-2)))
413 (modify-phases %standard-phases
415 'install 'wrap-program
416 (lambda* (#:key outputs #:allow-other-keys)
417 (let ((prog (string-append (assoc-ref outputs "out")
420 `("PYTHONPATH" = (,(getenv "PYTHONPATH"))))))))))
421 (home-page "http://www.itstool.org")
422 (synopsis "Tool to translate XML documents with PO files")
424 "ITS Tool allows you to translate your XML documents with PO files, using
425 rules from the W3C Internationalization Tag Set (ITS) to determine what to
426 translate and how to separate it into PO file messages.
428 PO files are the standard translation format for GNU and other Unix-like
429 systems. They present translatable information as discrete messages, allowing
430 each message to be translated independently. In contrast to whole-page
431 translation, translating with a message-based format like PO means you can
432 easily track changes to the source document down to the paragraph. When new
433 strings are added or existing strings are modified, you only need to update the
434 corresponding messages.
436 ITS Tool is designed to make XML documents translatable through PO files by
437 applying standard ITS rules, as well as extension rules specific to ITS Tool.
438 ITS also provides an industry standard way for authors to override translation
439 information in their documents, such as whether a particular element should be
441 (license license:gpl3+)))
450 (string-append "https://dbus.freedesktop.org/releases/dbus-glib/dbus-glib-"
454 "0in0i6v68ixcy0ip28i84hdczf10ykq9x682qgcvls6gdmq552dk"))))
455 (build-system gnu-build-system)
456 (propagated-inputs ; according to dbus-glib-1.pc
462 `(("glib" ,glib "bin")
463 ("pkg-config" ,pkg-config)))
464 (home-page "http://dbus.freedesktop.org/doc/dbus-glib/")
465 (synopsis "D-Bus GLib bindings")
467 "GLib bindings for D-Bus. The package is obsolete and superseded
468 by GDBus included in Glib.")
469 (license license:gpl2))) ; or Academic Free License 2.1
477 (uri (string-append "mirror://gnome/sources/libsigc++/"
478 (version-major+minor version) "/"
479 name "-" version ".tar.xz"))
482 "0lcnzzdq6718znfshs1hflpwqq6awbzwdyp4kv5lfaf54z880jbp"))))
483 (build-system gnu-build-system)
484 (native-inputs `(("pkg-config" ,pkg-config)
486 (home-page "http://libsigc.sourceforge.net/")
487 (synopsis "Type-safe callback system for standard C++")
489 "Libsigc++ implements a type-safe callback system for standard C++. It
490 allows you to define signals and to connect those signals to any callback
491 function, either global or a member function, regardless of whether it is
494 It also contains adaptor classes for connection of dissimilar callbacks and
495 has an ease of use unmatched by other C++ callback libraries.")
496 (license license:lgpl2.1+)))
504 (uri (string-append "mirror://gnome/sources/glibmm/"
505 (version-major+minor version)
506 "/glibmm-" version ".tar.xz"))
509 "1pvw2mrm03p51p03179rb6fk9p42iykkwj1jcdv7jr265xymy8nw"))))
510 (build-system gnu-build-system)
512 `(#:phases (alist-cons-before
515 ;; This test uses /etc/fstab as an example file to read
516 ;; from; choose a better example.
517 (substitute* "tests/giomm_simple/main.cc"
519 (string-append (getcwd)
520 "/tests/giomm_simple/main.cc")))
522 ;; This test does a DNS lookup, and then expects to be able
523 ;; to open a TLS session; just skip it.
524 (substitute* "tests/giomm_tls_client/main.cc"
528 (native-inputs `(("pkg-config" ,pkg-config)
529 ("glib" ,glib "bin")))
531 `(("libsigc++" ,libsigc++)
533 (home-page "http://gtkmm.org/")
534 (synopsis "C++ interface to the GLib library")
536 "Glibmm provides a C++ programming interface to the part of GLib that are
538 (license license:lgpl2.1+)))
540 (define-public python2-pygobject-2
542 (name "python2-pygobject")
543 ;; This was the last version to declare the 2.0 platform number, i.e. its
544 ;; pkg-config files were named pygobject-2.0.pc
549 (uri (string-append "mirror://gnome/sources/pygobject/"
550 (version-major+minor version)
551 "/pygobject-" version ".tar.xz"))
554 "1f5dfxjnil2glfwxnqr14d2cjfbkghsbsn8n04js2c2icr7iv2pv"))
555 (patches (search-patches
556 "python2-pygobject-2-gi-info-type-error-domain.patch"))))
557 (build-system gnu-build-system)
560 ("glib-bin" ,glib "bin") ;for tests: glib-compile-schemas
561 ("pkg-config" ,pkg-config)
562 ("dbus" ,dbus))) ;for tests
564 `(("python" ,python-2)
566 ("python2-pycairo" ,python2-pycairo)
567 ("gobject-introspection" ,gobject-introspection)))
569 `(("libffi" ,libffi))) ;mentioned in pygobject-2.0.pc
571 `(#:tests? #f ;segfaults during tests
572 #:configure-flags '("LIBS=-lcairo-gobject")))
573 (home-page "https://pypi.python.org/pypi/PyGObject")
574 (synopsis "Python bindings for GObject")
576 "Python bindings for GLib, GObject, and GIO.")
577 (license license:lgpl2.1+)))
579 (define-public python-pygobject
581 (name "python-pygobject")
586 (uri (string-append "mirror://gnome/sources/pygobject/"
587 (version-major+minor version)
588 "/pygobject-" version ".tar.xz"))
591 "0ikzh3l7g1gjh8jj8vg6mdvrb25svp63gxcam4m0i404yh0lgari"))))
592 (build-system gnu-build-system)
595 ("glib-bin" ,glib "bin") ;for tests: glib-compile-schemas
596 ("pkg-config" ,pkg-config)))
599 ("python-pycairo" ,python-pycairo)
600 ("gobject-introspection" ,gobject-introspection)))
602 ;; pygobject-3.0.pc refers to all these.
606 ;; TODO: failing tests: test_native_calls_async
607 ;; test_native_calls_async_errors test_native_calls_sync
608 ;; test_native_calls_sync_errors test_python_calls_async
609 ;; test_python_calls_async_error test_python_calls_async_error_result
610 ;; test_python_calls_sync test_python_calls_sync_errors
611 ;; test_python_calls_sync_noargs test_callback_user_data_middle_none
612 ;; test_callback_user_data_middle_single
613 ;; test_callback_user_data_middle_tuple
615 ;; For finding typelib files, since gobject-introscpetion isn't propagated.
616 (native-search-paths (package-native-search-paths gobject-introspection))
617 (home-page "https://live.gnome.org/PyGObject")
618 (synopsis "Python bindings for GObject")
620 "Python bindings for GLib, GObject, and GIO.")
621 (license license:lgpl2.1+)
622 (properties `((python2-variant . ,(delay python2-pygobject))))))
624 (define-public python2-pygobject
625 (package (inherit (strip-python2-variant python-pygobject))
626 (name "python2-pygobject")
628 `(("python" ,python-2)
629 ("python-pycairo" ,python2-pycairo)
630 ("gobject-introspection" ,gobject-introspection)))))
632 (define telepathy-glib
634 (name "telepathy-glib")
641 "https://telepathy.freedesktop.org/releases/telepathy-glib/"
642 "telepathy-glib-" version ".tar.gz"))
645 "1symyzbjmxvksn2ifdkk50lafjm2llf2sbmky062gq2pz3cg23cy"))
648 ;; Don't use the same test name for multiple tests.
649 ;; <https://bugs.freedesktop.org/show_bug.cgi?id=92245>
652 (uri "https://bugs.freedesktop.org/attachment.cgi?id=118608")
653 (file-name (string-append "telepathy-glib-duplicate-tests.patch"))
656 "0z261fwrszxb28ccg3hsg9rizig4s84zvwmx6y31a4pyv7bvs5w3")))))))
657 (build-system gnu-build-system)
659 '(#:configure-flags '("--enable-vala-bindings")))
661 `(("glib" ,glib "bin") ; uses glib-mkenums
662 ("gobject-introspection" ,gobject-introspection)
663 ("pkg-config" ,pkg-config)
666 ("xsltproc" ,libxslt)))
668 ;; There are all in the Requires.private field of telepathy-glib.pc.
670 ("dbus-glib" ,dbus-glib)
672 (home-page "http://telepathy.freedesktop.org/wiki/")
673 (synopsis "GLib Real-time communications framework over D-Bus")
674 (description "Telepathy is a flexible, modular communications framework
675 that enables real-time communication over D-Bus via pluggable protocol
676 backends. Telepathy is a communications service that can be accessed by
677 many applications simultaneously.
679 This package provides the library for GLib applications.")
680 (license license:lgpl2.1+)))
683 (define-public dbus-c++
691 "mirror://sourceforge/dbus-cplusplus/dbus-c%2B%2B/"
692 version "/libdbus-c%2B%2B-" version ".tar.gz"))
693 (file-name (string-append name "-" version ".tar.gz"))
696 "0qafmy2i6dzx4n1dqp6pygyy6gjljnb7hwjcj2z11c1wgclsq4dw"))))
697 (build-system gnu-build-system)
699 `(("dbus" ,dbus))) ;mentioned in the pkg-config file
705 `(("pkg-config" ,pkg-config)))
707 `(;; The 'configure' machinery fails to detect that it needs -lpthread.
708 #:configure-flags (list "LDFLAGS=-lpthread")
710 (modify-phases %standard-phases
711 (add-before 'configure 'add-missing-header
713 (substitute* "include/dbus-c++/eventloop-integration.h"
714 (("#include <errno.h>")
715 "#include <errno.h>\n#include <unistd.h>")))))))
716 (synopsis "D-Bus API for C++")
717 (description "This package provides D-Bus client API bindings for the C++
718 programming langauage. It also contains the utility
719 @command{dbuscxx-xml2cpp}.")
720 (home-page "https://sourceforge.net/projects/dbus-cplusplus/")
721 (license license:lgpl2.1+)))