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 gtk)
37 #:use-module (gnu packages libffi)
38 #:use-module (gnu packages pcre)
39 #:use-module (gnu packages perl)
40 #:use-module (gnu packages pkg-config)
41 #:use-module (gnu packages python)
42 #:use-module (gnu packages xml)
43 #:use-module (gnu packages bash)
44 #:use-module (gnu packages file)
45 #:use-module (gnu packages xorg)
46 #:use-module (gnu packages m4)
48 ;; Export variables up-front to allow circular dependency with the 'xorg'
67 "https://dbus.freedesktop.org/releases/dbus/dbus-"
71 "0560y3hxpgh346w6avcrcz79c8ansmn771y5xpcvvlr6m8mx5wxs"))
72 (patches (search-patches "dbus-helper-search-path.patch"))))
73 (build-system gnu-build-system)
77 ;; Install the system bus socket under /var.
78 "--localstatedir=/var"
80 ;; Install the session bus socket under /tmp.
81 "--with-session-socket-dir=/tmp"
83 ;; Use /etc/dbus-1 for system-wide config.
84 ;; Look for configuration file under
85 ;; /etc/dbus-1. This is notably required by
86 ;; 'dbus-daemon-launch-helper', which looks for
87 ;; the 'system.conf' file in that place,
88 ;; regardless of what '--config-file' was
89 ;; passed to 'dbus-daemon' on the command line;
90 ;; see <https://bugs.freedesktop.org/show_bug.cgi?id=92458>.
93 (modify-phases %standard-phases
96 ;; Don't try to create /var and /etc.
98 "localstatedir=/tmp/dummy"
99 "sysconfdir=/tmp/dummy"
102 `(("pkg-config" ,pkg-config)))
106 ;; Add a dependency on libx11 so that 'dbus-launch' has support for
110 (home-page "http://dbus.freedesktop.org/")
111 (synopsis "Message bus for inter-process communication (IPC)")
113 "D-Bus is a message bus system, a simple way for applications to
114 talk to one another. In addition to interprocess communication, D-Bus
115 helps coordinate process lifecycle; it makes it simple and reliable to
116 code a \"single instance\" application or daemon, and to launch
117 applications and daemons on demand when their services are needed.
119 D-Bus supplies both a system daemon (for events such as \"new hardware
120 device added\" or \"printer queue changed\") and a
121 per-user-login-session daemon (for general IPC needs among user
122 applications). Also, the message bus is built on top of a general
123 one-to-one message passing framework, which can be used by any two apps
124 to communicate directly (without going through the message bus
125 daemon). Currently the communicating applications are on one computer,
126 or through unencrypted TCP/IP suitable for use behind a firewall with
127 shared NFS home directories.")
128 (license license:gpl2+))) ; or Academic Free License 2.1
136 (uri (string-append "mirror://gnome/sources/"
137 name "/" (string-take version 4) "/"
138 name "-" version ".tar.xz"))
141 "0d3w2hblrw7vvpx60l1kbvb830ygn3v8zhwdz65cc5593j9ycjvl"))
142 (patches (search-patches "glib-tests-timer.patch"))))
143 (build-system gnu-build-system)
144 (outputs '("out" ; everything
145 "bin" ; glib-mkenums, gtester, etc.; depends on Python
146 "doc")) ; 20 MiB of GTK-Doc reference
148 `(("pcre" ,pcre))) ; in the Requires.private field of glib-2.0.pc
150 `(("coreutils" ,coreutils)
153 ("tzdata" ,tzdata))) ; for tests/gdatetime.c
155 `(("gettext" ,gnu-gettext)
156 ("dbus" ,dbus) ; for GDBus tests
157 ("pkg-config" ,pkg-config)
158 ("python" ,python-wrapper)
159 ("perl" ,perl) ; needed by GIO tests
163 (modify-phases %standard-phases
164 (add-before 'build 'pre-build
165 (lambda* (#:key inputs outputs #:allow-other-keys)
166 ;; For tests/gdatetime.c.
168 (string-append (assoc-ref inputs "tzdata")
171 ;; Some tests want write access there.
172 (setenv "HOME" (getcwd))
173 (setenv "XDG_CACHE_HOME" (getcwd))
175 (substitute* '("glib/gspawn.c"
177 "tests/spawn-test.c")
179 (string-append (assoc-ref inputs "bash") "/bin/sh")))))
180 (add-before 'check 'disable-failing-tests
183 (lambda (test-file test-paths)
184 (define pattern+procs
185 (map (lambda (test-path)
187 ;; XXX: only works for single line statements.
188 (format #f "g_test_add_func.*\"~a\".*" test-path)
191 (substitute test-file pattern+procs)))
193 '(("glib/tests/thread.c"
194 (;; prlimit(2) returns ENOSYS on Linux 2.6.32-5-xen-amd64
195 ;; as found on hydra.gnu.org, and strace(1) doesn't
199 ("glib/tests/timer.c"
200 (;; fails if compiler optimizations are enabled, which they
204 ("gio/tests/gapplication.c"
205 (;; XXX: proven to be unreliable. See:
206 ;; <https://bugs.debian.org/756273>
207 ;; <http://bugs.gnu.org/18445>
210 ;; XXX: fails randomly for unknown reason. See:
211 ;; <https://lists.gnu.org/archive/html/guix-devel/2016-04/msg00215.html>
212 "/gapplication/local-actions"))
214 ("gio/tests/contenttype.c"
215 (;; XXX: requires shared-mime-info.
217 "/contenttype/subtype"
220 "/contenttype/symbolic-icon"
221 "/contenttype/tree"))
223 ("gio/tests/appinfo.c"
224 (;; XXX: requires update-desktop-database.
225 "/appinfo/associations"))
227 ("gio/tests/desktop-app-info.c"
228 (;; XXX: requires update-desktop-database.
229 "/desktop-app-info/delete"
230 "/desktop-app-info/default"
231 "/desktop-app-info/fallback"
232 "/desktop-app-info/lastused"
233 "/desktop-app-info/search"))
235 ("gio/tests/gdbus-peer.c"
236 (;; Requires /etc/machine-id.
237 "/gdbus/codegen-peer-to-peer"))
239 ("gio/tests/gdbus-unix-addresses.c"
240 (;; Requires /etc/machine-id.
241 "/gdbus/x11-autolaunch")))))
242 (and-map (lambda (x) (apply disable x)) failing-tests)))))
244 ;; Note: `--docdir' and `--htmldir' are not honored, so work around it.
245 #:configure-flags (list (string-append "--with-html-dir="
246 (assoc-ref %outputs "doc")
247 "/share/gtk-doc/html"))
249 ;; In 'gio/tests', 'gdbus-test-codegen-generated.h' is #included in a
250 ;; file that gets compiled possibly before it has been fully generated.
251 #:parallel-tests? #f))
254 ;; This variable is not really "owned" by GLib, but several related
255 ;; packages refer to it: gobject-introspection's tools use it as a search
256 ;; path for .gir files, and it's also a search path for schemas produced
257 ;; by 'glib-compile-schemas'.
258 (list (search-path-specification
259 (variable "XDG_DATA_DIRS")
261 ;; To load extra gio modules from glib-networking, etc.
262 (search-path-specification
263 (variable "GIO_EXTRA_MODULES")
264 (files '("lib/gio/modules")))))
265 (search-paths native-search-paths)
267 (synopsis "Thread-safe general utility library; basis of GTK+ and GNOME")
269 "GLib provides data structure handling for C, portability wrappers,
270 and interfaces for such runtime functionality as an event loop, threads,
271 dynamic loading, and an object system.")
272 (home-page "http://developer.gnome.org/glib/")
273 (license license:lgpl2.0+))) ; some files are under lgpl2.1+
275 (define gobject-introspection
277 (name "gobject-introspection")
281 (uri (string-append "mirror://gnome/sources/"
282 "gobject-introspection/" (version-major+minor version)
283 "/gobject-introspection-" version ".tar.xz"))
285 (base32 "0xsqwxhfqzr79av89mg766kxpb2i41bd0vwspk01xjdzrnn5l9zs"))
286 (modules '((guix build utils)))
288 '(substitute* "tools/g-ir-tool-template.in"
289 (("#!/usr/bin/env @PYTHON@") "#!@PYTHON@")))
290 (patches (search-patches
291 "gobject-introspection-cc.patch"
292 "gobject-introspection-girepository.patch"
293 "gobject-introspection-absolute-shlib-path.patch"))))
294 (build-system gnu-build-system)
299 ("python-2" ,python-2)))
301 `(("glib" ,glib "bin")
302 ("pkg-config" ,pkg-config)))
304 `(;; In practice, GIR users will need libffi when using
305 ;; gobject-introspection.
308 (list (search-path-specification
309 (variable "GI_TYPELIB_PATH")
310 (files '("lib/girepository-1.0")))))
311 (search-paths native-search-paths)
313 `(;; The patch 'gobject-introspection-absolute-shlib-path.patch' causes
314 ;; some tests to fail.
316 (home-page "https://wiki.gnome.org/GObjectIntrospection")
317 (synopsis "Generate interface introspection data for GObject libraries")
319 "GObject introspection is a middleware layer between C libraries (using
320 GObject) and language bindings. The C library can be scanned at compile time
321 and generate a metadata file, in addition to the actual native C library. Then
322 at runtime, language bindings can read this metadata and automatically provide
323 bindings to call into the C library.")
324 ; Some bits are distributed under the LGPL2+, others under the GPL2+
325 (license license:gpl2+)))
333 (uri (string-append "https://launchpad.net/intltool/trunk/"
334 version "/+download/intltool-"
338 "1karx4sb7bnm2j67q0q74hspkfn6lqprpy5r99vkn5bb36a4viv7"))))
339 (build-system gnu-build-system)
343 `(;; Propagate gettext because users expect it to be there, and so does
344 ;; the `intltool-update' script.
345 ("gettext" ,gnu-gettext)
347 ("perl-xml-parser" ,perl-xml-parser)
350 `(#:phases (alist-cons-after
351 'unpack 'patch-file-references
352 (lambda* (#:key inputs #:allow-other-keys)
353 (let ((file (assoc-ref inputs "file")))
354 (substitute* "intltool-update.in"
355 (("`file") (string-append "`" file "/bin/file")))))
357 (home-page "https://launchpad.net/intltool/+download")
358 (synopsis "Tools to centralise translations of different file formats")
360 "Intltool is a set of tools to centralise translations of many different
361 file formats using GNU gettext-compatible PO files.
363 The intltool collection can be used to do these things:
365 Extract translatable strings from various source files (.xml.in,
366 glade, .desktop.in, .server.in, .oaf.in).
368 Collect the extracted strings together with messages from traditional
369 source files (.c, .h) in po/$(PACKAGE).pot.
371 Merge back the translations from .po files into .xml, .desktop and
372 oaf files. This merge step will happen at build resp. installation time.")
373 (license license:gpl2+)))
381 (uri (string-append "http://files.itstool.org/itstool/itstool-"
385 "0fh34wi52i0qikgvlmrcpf1vx6gc1xqdad4539l4d9hikfsrz45z"))))
386 (build-system gnu-build-system)
388 `(("libxml2" ,libxml2)
389 ("python2-libxml2" ,python2-libxml2)
390 ("python-2" ,python-2)))
393 (modify-phases %standard-phases
395 'install 'wrap-program
396 (lambda* (#:key outputs #:allow-other-keys)
397 (let ((prog (string-append (assoc-ref outputs "out")
400 `("PYTHONPATH" = (,(getenv "PYTHONPATH"))))))))))
401 (home-page "http://www.itstool.org")
402 (synopsis "Tool to translate XML documents with PO files")
404 "ITS Tool allows you to translate your XML documents with PO files, using
405 rules from the W3C Internationalization Tag Set (ITS) to determine what to
406 translate and how to separate it into PO file messages.
408 PO files are the standard translation format for GNU and other Unix-like
409 systems. They present translatable information as discrete messages, allowing
410 each message to be translated independently. In contrast to whole-page
411 translation, translating with a message-based format like PO means you can
412 easily track changes to the source document down to the paragraph. When new
413 strings are added or existing strings are modified, you only need to update the
414 corresponding messages.
416 ITS Tool is designed to make XML documents translatable through PO files by
417 applying standard ITS rules, as well as extension rules specific to ITS Tool.
418 ITS also provides an industry standard way for authors to override translation
419 information in their documents, such as whether a particular element should be
421 (license license:gpl3+)))
430 (string-append "https://dbus.freedesktop.org/releases/dbus-glib/dbus-glib-"
434 "1xi1v1msz75qs0s4lkyf1psrksdppa3hwkg0mznc6gpw5flg3hdz"))))
435 (build-system gnu-build-system)
436 (propagated-inputs ; according to dbus-glib-1.pc
442 `(("glib" ,glib "bin")
443 ("pkg-config" ,pkg-config)))
444 (home-page "http://dbus.freedesktop.org/doc/dbus-glib/")
445 (synopsis "D-Bus GLib bindings")
447 "GLib bindings for D-Bus. The package is obsolete and superseded
448 by GDBus included in Glib.")
449 (license license:gpl2))) ; or Academic Free License 2.1
457 (uri (string-append "mirror://gnome/sources/libsigc++/"
458 (version-major+minor version) "/"
459 name "-" version ".tar.xz"))
462 "0lcnzzdq6718znfshs1hflpwqq6awbzwdyp4kv5lfaf54z880jbp"))))
463 (build-system gnu-build-system)
464 (native-inputs `(("pkg-config" ,pkg-config)
466 (home-page "http://libsigc.sourceforge.net/")
467 (synopsis "Type-safe callback system for standard C++")
469 "Libsigc++ implements a type-safe callback system for standard C++. It
470 allows you to define signals and to connect those signals to any callback
471 function, either global or a member function, regardless of whether it is
474 It also contains adaptor classes for connection of dissimilar callbacks and
475 has an ease of use unmatched by other C++ callback libraries.")
476 (license license:lgpl2.1+)))
484 (uri (string-append "mirror://gnome/sources/glibmm/"
485 (version-major+minor version)
486 "/glibmm-" version ".tar.xz"))
489 "1pvw2mrm03p51p03179rb6fk9p42iykkwj1jcdv7jr265xymy8nw"))))
490 (build-system gnu-build-system)
492 `(#:phases (alist-cons-before
495 ;; This test uses /etc/fstab as an example file to read
496 ;; from; choose a better example.
497 (substitute* "tests/giomm_simple/main.cc"
499 (string-append (getcwd)
500 "/tests/giomm_simple/main.cc")))
502 ;; This test does a DNS lookup, and then expects to be able
503 ;; to open a TLS session; just skip it.
504 (substitute* "tests/giomm_tls_client/main.cc"
508 (native-inputs `(("pkg-config" ,pkg-config)
509 ("glib" ,glib "bin")))
511 `(("libsigc++" ,libsigc++)
513 (home-page "http://gtkmm.org/")
514 (synopsis "C++ interface to the GLib library")
516 "Glibmm provides a C++ programming interface to the part of GLib that are
518 (license license:lgpl2.1+)))
520 (define-public python2-pygobject-2
522 (name "python2-pygobject")
523 ;; This was the last version to declare the 2.0 platform number, i.e. its
524 ;; pkg-config files were named pygobject-2.0.pc
529 (uri (string-append "mirror://gnome/sources/pygobject/"
530 (version-major+minor version)
531 "/pygobject-" version ".tar.xz"))
534 "1f5dfxjnil2glfwxnqr14d2cjfbkghsbsn8n04js2c2icr7iv2pv"))
535 (patches (search-patches
536 "python2-pygobject-2-gi-info-type-error-domain.patch"))))
537 (build-system gnu-build-system)
540 ("glib-bin" ,glib "bin") ;for tests: glib-compile-schemas
541 ("pkg-config" ,pkg-config)
542 ("dbus" ,dbus))) ;for tests
544 `(("python" ,python-2)
546 ("python2-pycairo" ,python2-pycairo)
547 ("gobject-introspection" ,gobject-introspection)))
549 `(("libffi" ,libffi))) ;mentioned in pygobject-2.0.pc
551 `(#:tests? #f ;segfaults during tests
552 #:configure-flags '("LIBS=-lcairo-gobject")))
553 (home-page "https://pypi.python.org/pypi/PyGObject")
554 (synopsis "Python bindings for GObject")
556 "Python bindings for GLib, GObject, and GIO.")
557 (license license:lgpl2.1+)))
559 (define-public python-pygobject
561 (name "python-pygobject")
566 (uri (string-append "mirror://gnome/sources/pygobject/"
567 (version-major+minor version)
568 "/pygobject-" version ".tar.xz"))
571 "0ikzh3l7g1gjh8jj8vg6mdvrb25svp63gxcam4m0i404yh0lgari"))))
572 (build-system gnu-build-system)
575 ("glib-bin" ,glib "bin") ;for tests: glib-compile-schemas
576 ("pkg-config" ,pkg-config)))
579 ("python-pycairo" ,python-pycairo)
580 ("gobject-introspection" ,gobject-introspection)))
582 ;; pygobject-3.0.pc refers to all these.
586 ;; TODO: failing tests: test_native_calls_async
587 ;; test_native_calls_async_errors test_native_calls_sync
588 ;; test_native_calls_sync_errors test_python_calls_async
589 ;; test_python_calls_async_error test_python_calls_async_error_result
590 ;; test_python_calls_sync test_python_calls_sync_errors
591 ;; test_python_calls_sync_noargs test_callback_user_data_middle_none
592 ;; test_callback_user_data_middle_single
593 ;; test_callback_user_data_middle_tuple
595 ;; For finding typelib files, since gobject-introscpetion isn't propagated.
596 (native-search-paths (package-native-search-paths gobject-introspection))
597 (home-page "https://live.gnome.org/PyGObject")
598 (synopsis "Python bindings for GObject")
600 "Python bindings for GLib, GObject, and GIO.")
601 (license license:lgpl2.1+)
602 (properties `((python2-variant . ,(delay python2-pygobject))))))
604 (define-public python2-pygobject
605 (package (inherit (strip-python2-variant python-pygobject))
606 (name "python2-pygobject")
608 `(("python" ,python-2)
609 ("python-pycairo" ,python2-pycairo)
610 ("gobject-introspection" ,gobject-introspection)))))
612 (define telepathy-glib
614 (name "telepathy-glib")
621 "https://telepathy.freedesktop.org/releases/telepathy-glib/"
622 "telepathy-glib-" version ".tar.gz"))
625 "1symyzbjmxvksn2ifdkk50lafjm2llf2sbmky062gq2pz3cg23cy"))
628 ;; Don't use the same test name for multiple tests.
629 ;; <https://bugs.freedesktop.org/show_bug.cgi?id=92245>
632 (uri "https://bugs.freedesktop.org/attachment.cgi?id=118608")
633 (file-name (string-append "telepathy-glib-duplicate-tests.patch"))
636 "0z261fwrszxb28ccg3hsg9rizig4s84zvwmx6y31a4pyv7bvs5w3")))))))
637 (build-system gnu-build-system)
639 `(("glib" ,glib "bin") ; uses glib-mkenums
640 ("gobject-introspection" ,gobject-introspection)
641 ("pkg-config" ,pkg-config)
643 ("xsltproc" ,libxslt)))
645 ;; There are all in the Requires.private field of telepathy-glib.pc.
647 ("dbus-glib" ,dbus-glib)
649 (home-page "http://telepathy.freedesktop.org/wiki/")
650 (synopsis "GLib Real-time communications framework over D-Bus")
651 (description "Telepathy is a flexible, modular communications framework
652 that enables real-time communication over D-Bus via pluggable protocol
653 backends. Telepathy is a communications service that can be accessed by
654 many applications simultaneously.
656 This package provides the library for GLib applications.")
657 (license license:lgpl2.1+)))