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>
8 ;;; This file is part of GNU Guix.
10 ;;; GNU Guix is free software; you can redistribute it and/or modify it
11 ;;; under the terms of the GNU General Public License as published by
12 ;;; the Free Software Foundation; either version 3 of the License, or (at
13 ;;; your option) any later version.
15 ;;; GNU Guix is distributed in the hope that it will be useful, but
16 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;;; GNU General Public License for more details.
20 ;;; You should have received a copy of the GNU General Public License
21 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
23 (define-module (gnu packages glib)
24 #:use-module ((guix licenses) #:prefix license:)
25 #:use-module (guix packages)
26 #:use-module (guix download)
27 #:use-module (guix utils)
28 #:use-module (guix build-system gnu)
29 #:use-module (guix build-system python)
30 #:use-module (gnu packages)
31 #:use-module (gnu packages base)
32 #:use-module (gnu packages bison)
33 #:use-module (gnu packages compression)
34 #:use-module (gnu packages flex)
35 #:use-module (gnu packages gettext)
36 #:use-module (gnu packages gnome)
37 #:use-module (gnu packages gtk)
38 #:use-module (gnu packages libffi)
39 #:use-module (gnu packages pcre)
40 #:use-module (gnu packages perl)
41 #:use-module (gnu packages pkg-config)
42 #:use-module (gnu packages python)
43 #:use-module (gnu packages xml)
44 #:use-module (gnu packages bash)
45 #:use-module (gnu packages file)
46 #:use-module (gnu packages xorg)
47 #:use-module (gnu packages m4)
49 ;; Export variables up-front to allow circular dependency with the 'xorg'
68 "https://dbus.freedesktop.org/releases/dbus/dbus-"
72 "0hwsfczhx2djmc9116vj5v230i7gpjihwh3vbljs1ldlk831v3wx"))
73 (patches (search-patches "dbus-helper-search-path.patch"))))
74 (build-system gnu-build-system)
78 ;; Install the system bus socket under /var.
79 "--localstatedir=/var"
81 ;; Install the session bus socket under /tmp.
82 "--with-session-socket-dir=/tmp"
84 ;; Use /etc/dbus-1 for system-wide config.
85 ;; Look for configuration file under
86 ;; /etc/dbus-1. This is notably required by
87 ;; 'dbus-daemon-launch-helper', which looks for
88 ;; the 'system.conf' file in that place,
89 ;; regardless of what '--config-file' was
90 ;; passed to 'dbus-daemon' on the command line;
91 ;; see <https://bugs.freedesktop.org/show_bug.cgi?id=92458>.
94 (modify-phases %standard-phases
97 ;; Don't try to create /var and /etc.
99 "localstatedir=/tmp/dummy"
100 "sysconfdir=/tmp/dummy"
103 `(("pkg-config" ,pkg-config)))
107 ;; Add a dependency on libx11 so that 'dbus-launch' has support for
111 (home-page "http://dbus.freedesktop.org/")
112 (synopsis "Message bus for inter-process communication (IPC)")
114 "D-Bus is a message bus system, a simple way for applications to
115 talk to one another. In addition to interprocess communication, D-Bus
116 helps coordinate process lifecycle; it makes it simple and reliable to
117 code a \"single instance\" application or daemon, and to launch
118 applications and daemons on demand when their services are needed.
120 D-Bus supplies both a system daemon (for events such as \"new hardware
121 device added\" or \"printer queue changed\") and a
122 per-user-login-session daemon (for general IPC needs among user
123 applications). Also, the message bus is built on top of a general
124 one-to-one message passing framework, which can be used by any two apps
125 to communicate directly (without going through the message bus
126 daemon). Currently the communicating applications are on one computer,
127 or through unencrypted TCP/IP suitable for use behind a firewall with
128 shared NFS home directories.")
129 (license license:gpl2+))) ; or Academic Free License 2.1
137 (uri (string-append "mirror://gnome/sources/"
138 name "/" (string-take version 4) "/"
139 name "-" version ".tar.xz"))
142 "1x6kwrk1zyd3csv0ca3pmwc4bnkc33agn95cds15h6nbi4apappj"))
143 (patches (search-patches "glib-tests-timer.patch"))))
144 (build-system gnu-build-system)
145 (outputs '("out" ; everything
146 "bin" ; glib-mkenums, gtester, etc.; depends on Python
147 "doc")) ; 20 MiB of GTK-Doc reference
149 `(("pcre" ,pcre))) ; in the Requires.private field of glib-2.0.pc
151 `(("coreutils" ,coreutils)
154 ("tzdata" ,tzdata))) ; for tests/gdatetime.c
156 `(("gettext" ,gettext-minimal)
157 ("dbus" ,dbus) ; for GDBus tests
158 ("pkg-config" ,pkg-config)
159 ("python" ,python-wrapper)
160 ("perl" ,perl) ; needed by GIO tests
164 (modify-phases %standard-phases
165 (add-before 'build 'pre-build
166 (lambda* (#:key inputs outputs #:allow-other-keys)
167 ;; For tests/gdatetime.c.
169 (string-append (assoc-ref inputs "tzdata")
172 ;; Some tests want write access there.
173 (setenv "HOME" (getcwd))
174 (setenv "XDG_CACHE_HOME" (getcwd))
176 (substitute* '("glib/gspawn.c"
178 "tests/spawn-test.c")
180 (string-append (assoc-ref inputs "bash") "/bin/sh")))))
181 (add-before 'check 'disable-failing-tests
184 (lambda (test-file test-paths)
185 (define pattern+procs
186 (map (lambda (test-path)
188 ;; XXX: only works for single line statements.
189 (format #f "g_test_add_func.*\"~a\".*" test-path)
192 (substitute test-file pattern+procs)))
194 '(("glib/tests/thread.c"
195 (;; prlimit(2) returns ENOSYS on Linux 2.6.32-5-xen-amd64
196 ;; as found on hydra.gnu.org, and strace(1) doesn't
200 ("glib/tests/timer.c"
201 (;; fails if compiler optimizations are enabled, which they
205 ("gio/tests/gapplication.c"
206 (;; XXX: proven to be unreliable. See:
207 ;; <https://bugs.debian.org/756273>
208 ;; <http://bugs.gnu.org/18445>
211 ;; XXX: fails randomly for unknown reason. See:
212 ;; <https://lists.gnu.org/archive/html/guix-devel/2016-04/msg00215.html>
213 "/gapplication/local-actions"))
215 ("gio/tests/contenttype.c"
216 (;; XXX: requires shared-mime-info.
218 "/contenttype/subtype"
221 "/contenttype/symbolic-icon"
222 "/contenttype/tree"))
224 ("gio/tests/appinfo.c"
225 (;; XXX: requires update-desktop-database.
226 "/appinfo/associations"))
228 ("gio/tests/desktop-app-info.c"
229 (;; XXX: requires update-desktop-database.
230 "/desktop-app-info/delete"
231 "/desktop-app-info/default"
232 "/desktop-app-info/fallback"
233 "/desktop-app-info/lastused"
234 "/desktop-app-info/search"))
236 ("gio/tests/gdbus-peer.c"
237 (;; Requires /etc/machine-id.
238 "/gdbus/codegen-peer-to-peer"))
240 ("gio/tests/gdbus-unix-addresses.c"
241 (;; Requires /etc/machine-id.
242 "/gdbus/x11-autolaunch")))))
243 (and-map (lambda (x) (apply disable x)) failing-tests)))))
245 ;; Note: `--docdir' and `--htmldir' are not honored, so work around it.
246 #:configure-flags (list (string-append "--with-html-dir="
247 (assoc-ref %outputs "doc")
248 "/share/gtk-doc/html"))
250 ;; In 'gio/tests', 'gdbus-test-codegen-generated.h' is #included in a
251 ;; file that gets compiled possibly before it has been fully generated.
252 #:parallel-tests? #f))
255 ;; This variable is not really "owned" by GLib, but several related
256 ;; packages refer to it: gobject-introspection's tools use it as a search
257 ;; path for .gir files, and it's also a search path for schemas produced
258 ;; by 'glib-compile-schemas'.
259 (list (search-path-specification
260 (variable "XDG_DATA_DIRS")
262 ;; To load extra gio modules from glib-networking, etc.
263 (search-path-specification
264 (variable "GIO_EXTRA_MODULES")
265 (files '("lib/gio/modules")))))
266 (search-paths native-search-paths)
268 (synopsis "Thread-safe general utility library; basis of GTK+ and GNOME")
270 "GLib provides data structure handling for C, portability wrappers,
271 and interfaces for such runtime functionality as an event loop, threads,
272 dynamic loading, and an object system.")
273 (home-page "http://developer.gnome.org/glib/")
274 (license license:lgpl2.0+))) ; some files are under lgpl2.1+
276 (define gobject-introspection
278 (name "gobject-introspection")
282 (uri (string-append "mirror://gnome/sources/"
283 "gobject-introspection/" (version-major+minor version)
284 "/gobject-introspection-" version ".tar.xz"))
286 (base32 "0xsqwxhfqzr79av89mg766kxpb2i41bd0vwspk01xjdzrnn5l9zs"))
287 (modules '((guix build utils)))
289 '(substitute* "tools/g-ir-tool-template.in"
290 (("#!/usr/bin/env @PYTHON@") "#!@PYTHON@")))
291 (patches (search-patches
292 "gobject-introspection-cc.patch"
293 "gobject-introspection-girepository.patch"
294 "gobject-introspection-absolute-shlib-path.patch"))))
295 (build-system gnu-build-system)
300 ("python-2" ,python-2)))
302 `(("glib" ,glib "bin")
303 ("pkg-config" ,pkg-config)))
305 `(;; In practice, GIR users will need libffi when using
306 ;; gobject-introspection.
309 (list (search-path-specification
310 (variable "GI_TYPELIB_PATH")
311 (files '("lib/girepository-1.0")))))
312 (search-paths native-search-paths)
314 `(;; The patch 'gobject-introspection-absolute-shlib-path.patch' causes
315 ;; some tests to fail.
317 (home-page "https://wiki.gnome.org/GObjectIntrospection")
318 (synopsis "Generate interface introspection data for GObject libraries")
320 "GObject introspection is a middleware layer between C libraries (using
321 GObject) and language bindings. The C library can be scanned at compile time
322 and generate a metadata file, in addition to the actual native C library. Then
323 at runtime, language bindings can read this metadata and automatically provide
324 bindings to call into the C library.")
325 ; Some bits are distributed under the LGPL2+, others under the GPL2+
326 (license license:gpl2+)))
334 (uri (string-append "https://launchpad.net/intltool/trunk/"
335 version "/+download/intltool-"
339 "1karx4sb7bnm2j67q0q74hspkfn6lqprpy5r99vkn5bb36a4viv7"))))
340 (build-system gnu-build-system)
344 `(;; Propagate gettext because users expect it to be there, and so does
345 ;; the `intltool-update' script.
346 ("gettext" ,gettext-minimal)
348 ("perl-xml-parser" ,perl-xml-parser)
351 `(#:phases (alist-cons-after
352 'unpack 'patch-file-references
353 (lambda* (#:key inputs #:allow-other-keys)
354 (let ((file (assoc-ref inputs "file")))
355 (substitute* "intltool-update.in"
356 (("`file") (string-append "`" file "/bin/file")))))
358 (home-page "https://launchpad.net/intltool/+download")
359 (synopsis "Tools to centralise translations of different file formats")
361 "Intltool is a set of tools to centralise translations of many different
362 file formats using GNU gettext-compatible PO files.
364 The intltool collection can be used to do these things:
366 Extract translatable strings from various source files (.xml.in,
367 glade, .desktop.in, .server.in, .oaf.in).
369 Collect the extracted strings together with messages from traditional
370 source files (.c, .h) in po/$(PACKAGE).pot.
372 Merge back the translations from .po files into .xml, .desktop and
373 oaf files. This merge step will happen at build resp. installation time.")
374 (license license:gpl2+)))
382 (uri (string-append "http://files.itstool.org/itstool/itstool-"
386 "0fh34wi52i0qikgvlmrcpf1vx6gc1xqdad4539l4d9hikfsrz45z"))))
387 (build-system gnu-build-system)
389 `(("libxml2" ,libxml2)
390 ("python2-libxml2" ,python2-libxml2)
391 ("python-2" ,python-2)))
394 (modify-phases %standard-phases
396 'install 'wrap-program
397 (lambda* (#:key outputs #:allow-other-keys)
398 (let ((prog (string-append (assoc-ref outputs "out")
401 `("PYTHONPATH" = (,(getenv "PYTHONPATH"))))))))))
402 (home-page "http://www.itstool.org")
403 (synopsis "Tool to translate XML documents with PO files")
405 "ITS Tool allows you to translate your XML documents with PO files, using
406 rules from the W3C Internationalization Tag Set (ITS) to determine what to
407 translate and how to separate it into PO file messages.
409 PO files are the standard translation format for GNU and other Unix-like
410 systems. They present translatable information as discrete messages, allowing
411 each message to be translated independently. In contrast to whole-page
412 translation, translating with a message-based format like PO means you can
413 easily track changes to the source document down to the paragraph. When new
414 strings are added or existing strings are modified, you only need to update the
415 corresponding messages.
417 ITS Tool is designed to make XML documents translatable through PO files by
418 applying standard ITS rules, as well as extension rules specific to ITS Tool.
419 ITS also provides an industry standard way for authors to override translation
420 information in their documents, such as whether a particular element should be
422 (license license:gpl3+)))
431 (string-append "https://dbus.freedesktop.org/releases/dbus-glib/dbus-glib-"
435 "0in0i6v68ixcy0ip28i84hdczf10ykq9x682qgcvls6gdmq552dk"))))
436 (build-system gnu-build-system)
437 (propagated-inputs ; according to dbus-glib-1.pc
443 `(("glib" ,glib "bin")
444 ("pkg-config" ,pkg-config)))
445 (home-page "http://dbus.freedesktop.org/doc/dbus-glib/")
446 (synopsis "D-Bus GLib bindings")
448 "GLib bindings for D-Bus. The package is obsolete and superseded
449 by GDBus included in Glib.")
450 (license license:gpl2))) ; or Academic Free License 2.1
458 (uri (string-append "mirror://gnome/sources/libsigc++/"
459 (version-major+minor version) "/"
460 name "-" version ".tar.xz"))
463 "0lcnzzdq6718znfshs1hflpwqq6awbzwdyp4kv5lfaf54z880jbp"))))
464 (build-system gnu-build-system)
465 (native-inputs `(("pkg-config" ,pkg-config)
467 (home-page "http://libsigc.sourceforge.net/")
468 (synopsis "Type-safe callback system for standard C++")
470 "Libsigc++ implements a type-safe callback system for standard C++. It
471 allows you to define signals and to connect those signals to any callback
472 function, either global or a member function, regardless of whether it is
475 It also contains adaptor classes for connection of dissimilar callbacks and
476 has an ease of use unmatched by other C++ callback libraries.")
477 (license license:lgpl2.1+)))
485 (uri (string-append "mirror://gnome/sources/glibmm/"
486 (version-major+minor version)
487 "/glibmm-" version ".tar.xz"))
490 "1pvw2mrm03p51p03179rb6fk9p42iykkwj1jcdv7jr265xymy8nw"))))
491 (build-system gnu-build-system)
493 `(#:phases (alist-cons-before
496 ;; This test uses /etc/fstab as an example file to read
497 ;; from; choose a better example.
498 (substitute* "tests/giomm_simple/main.cc"
500 (string-append (getcwd)
501 "/tests/giomm_simple/main.cc")))
503 ;; This test does a DNS lookup, and then expects to be able
504 ;; to open a TLS session; just skip it.
505 (substitute* "tests/giomm_tls_client/main.cc"
509 (native-inputs `(("pkg-config" ,pkg-config)
510 ("glib" ,glib "bin")))
512 `(("libsigc++" ,libsigc++)
514 (home-page "http://gtkmm.org/")
515 (synopsis "C++ interface to the GLib library")
517 "Glibmm provides a C++ programming interface to the part of GLib that are
519 (license license:lgpl2.1+)))
521 (define-public python2-pygobject-2
523 (name "python2-pygobject")
524 ;; This was the last version to declare the 2.0 platform number, i.e. its
525 ;; pkg-config files were named pygobject-2.0.pc
530 (uri (string-append "mirror://gnome/sources/pygobject/"
531 (version-major+minor version)
532 "/pygobject-" version ".tar.xz"))
535 "1f5dfxjnil2glfwxnqr14d2cjfbkghsbsn8n04js2c2icr7iv2pv"))
536 (patches (search-patches
537 "python2-pygobject-2-gi-info-type-error-domain.patch"))))
538 (build-system gnu-build-system)
541 ("glib-bin" ,glib "bin") ;for tests: glib-compile-schemas
542 ("pkg-config" ,pkg-config)
543 ("dbus" ,dbus))) ;for tests
545 `(("python" ,python-2)
547 ("python2-pycairo" ,python2-pycairo)
548 ("gobject-introspection" ,gobject-introspection)))
550 `(("libffi" ,libffi))) ;mentioned in pygobject-2.0.pc
552 `(#:tests? #f ;segfaults during tests
553 #:configure-flags '("LIBS=-lcairo-gobject")))
554 (home-page "https://pypi.python.org/pypi/PyGObject")
555 (synopsis "Python bindings for GObject")
557 "Python bindings for GLib, GObject, and GIO.")
558 (license license:lgpl2.1+)))
560 (define-public python-pygobject
562 (name "python-pygobject")
567 (uri (string-append "mirror://gnome/sources/pygobject/"
568 (version-major+minor version)
569 "/pygobject-" version ".tar.xz"))
572 "0ikzh3l7g1gjh8jj8vg6mdvrb25svp63gxcam4m0i404yh0lgari"))))
573 (build-system gnu-build-system)
576 ("glib-bin" ,glib "bin") ;for tests: glib-compile-schemas
577 ("pkg-config" ,pkg-config)))
580 ("python-pycairo" ,python-pycairo)
581 ("gobject-introspection" ,gobject-introspection)))
583 ;; pygobject-3.0.pc refers to all these.
587 ;; TODO: failing tests: test_native_calls_async
588 ;; test_native_calls_async_errors test_native_calls_sync
589 ;; test_native_calls_sync_errors test_python_calls_async
590 ;; test_python_calls_async_error test_python_calls_async_error_result
591 ;; test_python_calls_sync test_python_calls_sync_errors
592 ;; test_python_calls_sync_noargs test_callback_user_data_middle_none
593 ;; test_callback_user_data_middle_single
594 ;; test_callback_user_data_middle_tuple
596 ;; For finding typelib files, since gobject-introscpetion isn't propagated.
597 (native-search-paths (package-native-search-paths gobject-introspection))
598 (home-page "https://live.gnome.org/PyGObject")
599 (synopsis "Python bindings for GObject")
601 "Python bindings for GLib, GObject, and GIO.")
602 (license license:lgpl2.1+)
603 (properties `((python2-variant . ,(delay python2-pygobject))))))
605 (define-public python2-pygobject
606 (package (inherit (strip-python2-variant python-pygobject))
607 (name "python2-pygobject")
609 `(("python" ,python-2)
610 ("python-pycairo" ,python2-pycairo)
611 ("gobject-introspection" ,gobject-introspection)))))
613 (define telepathy-glib
615 (name "telepathy-glib")
622 "https://telepathy.freedesktop.org/releases/telepathy-glib/"
623 "telepathy-glib-" version ".tar.gz"))
626 "1symyzbjmxvksn2ifdkk50lafjm2llf2sbmky062gq2pz3cg23cy"))
629 ;; Don't use the same test name for multiple tests.
630 ;; <https://bugs.freedesktop.org/show_bug.cgi?id=92245>
633 (uri "https://bugs.freedesktop.org/attachment.cgi?id=118608")
634 (file-name (string-append "telepathy-glib-duplicate-tests.patch"))
637 "0z261fwrszxb28ccg3hsg9rizig4s84zvwmx6y31a4pyv7bvs5w3")))))))
638 (build-system gnu-build-system)
640 '(#:configure-flags '("--enable-vala-bindings")))
642 `(("glib" ,glib "bin") ; uses glib-mkenums
643 ("gobject-introspection" ,gobject-introspection)
644 ("pkg-config" ,pkg-config)
647 ("xsltproc" ,libxslt)))
649 ;; There are all in the Requires.private field of telepathy-glib.pc.
651 ("dbus-glib" ,dbus-glib)
653 (home-page "http://telepathy.freedesktop.org/wiki/")
654 (synopsis "GLib Real-time communications framework over D-Bus")
655 (description "Telepathy is a flexible, modular communications framework
656 that enables real-time communication over D-Bus via pluggable protocol
657 backends. Telepathy is a communications service that can be accessed by
658 many applications simultaneously.
660 This package provides the library for GLib applications.")
661 (license license:lgpl2.1+)))