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>
7 ;;; This file is part of GNU Guix.
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.
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.
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/>.
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)
45 ;; Export variables up-front to allow circular dependency with the 'xorg'
62 ;; TODO: Apply patch from DBUS/ACTIVATION below.
65 "http://dbus.freedesktop.org/releases/dbus/dbus-"
69 "0jwj7wlrhq5y0fwfh8k2d9rgdpfax06lj8698g6iqbwrzd2rgyqx"))))
70 (build-system gnu-build-system)
74 ;; Install the system bus socket under /var.
75 "--localstatedir=/var"
77 ;; Install the session bus socket under /tmp.
78 "--with-session-socket-dir=/tmp"
80 ;; Use /etc/dbus-1 for system-wide config.
81 ;; Look for configuration file under
82 ;; /etc/dbus-1. This is notably required by
83 ;; 'dbus-daemon-launch-helper', which looks for
84 ;; the 'system.conf' file in that place,
85 ;; regardless of what '--config-file' was
86 ;; passed to 'dbus-daemon' on the command line;
87 ;; see <https://bugs.freedesktop.org/show_bug.cgi?id=92458>.
90 (modify-phases %standard-phases
93 ;; Don't try to create /var and /etc.
95 "localstatedir=/tmp/dummy"
96 "sysconfdir=/tmp/dummy"
99 `(("pkg-config" ,pkg-config)))
103 ;; Add a dependency on libx11 so that 'dbus-launch' has support for
107 (home-page "http://dbus.freedesktop.org/")
108 (synopsis "Message bus for inter-process communication (IPC)")
110 "D-Bus is a message bus system, a simple way for applications to
111 talk to one another. In addition to interprocess communication, D-Bus
112 helps coordinate process lifecycle; it makes it simple and reliable to
113 code a \"single instance\" application or daemon, and to launch
114 applications and daemons on demand when their services are needed.
116 D-Bus supplies both a system daemon (for events such as \"new hardware
117 device added\" or \"printer queue changed\") and a
118 per-user-login-session daemon (for general IPC needs among user
119 applications). Also, the message bus is built on top of a general
120 one-to-one message passing framework, which can be used by any two apps
121 to communicate directly (without going through the message bus
122 daemon). Currently the communicating applications are on one computer,
123 or through unencrypted TCP/IP suitable for use behind a firewall with
124 shared NFS home directories.")
125 (license license:gpl2+))) ; or Academic Free License 2.1
127 (define-public dbus/activation
128 ;; D-Bus with a patch to fix service activation.
129 ;; TODO: Merge with DBUS above.
132 (version (string-append (package-version dbus) ".a"))
134 (inherit (package-source dbus))
136 (list (search-patch "dbus-helper-search-path.patch")))))))
144 (uri (string-append "mirror://gnome/sources/"
145 name "/" (string-take version 4) "/"
146 name "-" version ".tar.xz"))
149 "1yzxr1ip3l0m9ydk5nq32piq70c9f17p5f0jyvlsghzbaawh67ss"))
150 (patches (list (search-patch "glib-tests-homedir.patch")
151 (search-patch "glib-tests-desktop.patch")
152 (search-patch "glib-tests-prlimit.patch")
153 (search-patch "glib-tests-timer.patch")
154 (search-patch "glib-tests-gapplication.patch")))))
155 (build-system gnu-build-system)
156 (outputs '("out" ; everything
157 "bin" ; glib-mkenums, gtester, etc.; depends on Python
158 "doc")) ; 20 MiB of GTK-Doc reference
160 `(("coreutils" ,coreutils)
163 ("tzdata" ,tzdata))) ; for tests/gdatetime.c
165 `(("gettext" ,gnu-gettext)
166 ("dbus" ,dbus) ; for GDBus tests
167 ("pkg-config" ,pkg-config)
168 ("python" ,python-wrapper)
169 ("perl" ,perl) ; needed by GIO tests
172 '(#:phases (alist-cons-before
174 (lambda* (#:key inputs outputs #:allow-other-keys)
175 ;; For tests/gdatetime.c.
177 (string-append (assoc-ref inputs "tzdata")
180 ;; Some tests want write access there.
181 (setenv "XDG_CACHE_HOME" (getcwd))
183 (substitute* '("glib/gspawn.c"
185 "tests/spawn-test.c")
187 (string-append (assoc-ref inputs "bash") "/bin/sh")))
189 ;; Disable a test that requires dbus.
190 (substitute* "gio/tests/gdbus-serialization.c"
192 \\(\"/gdbus/message-serialize/double-array\", test_double_array\\);" all)
193 (string-append "/* " all " */"))))
196 ;; Note: `--docdir' and `--htmldir' are not honored, so work around it.
197 #:configure-flags (list (string-append "--with-html-dir="
198 (assoc-ref %outputs "doc")
199 "/share/gtk-doc/html"))
201 ;; In 'gio/tests', 'gdbus-test-codegen-generated.h' is #included in a
202 ;; file that gets compiled possibly before it has been fully generated.
203 #:parallel-tests? #f))
206 ;; This variable is not really "owned" by GLib, but several related
207 ;; packages refer to it: gobject-introspection's tools use it as a search
208 ;; path for .gir files, and it's also a search path for schemas produced
209 ;; by 'glib-compile-schemas'.
210 (list (search-path-specification
211 (variable "XDG_DATA_DIRS")
213 ;; To load extra gio modules from glib-networking, etc.
214 (search-path-specification
215 (variable "GIO_EXTRA_MODULES")
216 (files '("lib/gio/modules")))))
217 (search-paths native-search-paths)
219 (synopsis "Thread-safe general utility library; basis of GTK+ and GNOME")
221 "GLib provides data structure handling for C, portability wrappers,
222 and interfaces for such runtime functionality as an event loop, threads,
223 dynamic loading, and an object system.")
224 (home-page "http://developer.gnome.org/glib/")
225 (license license:lgpl2.0+))) ; some files are under lgpl2.1+
227 (define gobject-introspection
229 (name "gobject-introspection")
233 (uri (string-append "mirror://gnome/sources/"
234 "gobject-introspection/" (version-major+minor version)
235 "/gobject-introspection-" version ".tar.xz"))
237 (base32 "0cs27r18fga44ypp8icy62fwx6nh70r1bvhi4lzfn4w85cybsn36"))
238 (modules '((guix build utils)))
240 '(substitute* "tools/g-ir-tool-template.in"
241 (("#!/usr/bin/env @PYTHON@") "#!@PYTHON@")))
243 (search-patch "gobject-introspection-cc.patch")
245 "gobject-introspection-girepository.patch")
247 "gobject-introspection-absolute-shlib-path.patch")))))
248 (build-system gnu-build-system)
254 ("pkg-config" ,pkg-config)
255 ("python-2" ,python-2)))
257 `(("glib" ,glib "bin")))
259 `(;; In practice, GIR users will need libffi when using
260 ;; gobject-introspection.
263 (list (search-path-specification
264 (variable "GI_TYPELIB_PATH")
265 (files '("lib/girepository-1.0")))))
266 (search-paths native-search-paths)
268 `(;; The patch 'gobject-introspection-absolute-shlib-path.patch' causes
269 ;; some tests to fail.
271 (home-page "https://wiki.gnome.org/GObjectIntrospection")
272 (synopsis "Generate interface introspection data for GObject libraries")
274 "GObject introspection is a middleware layer between C libraries (using
275 GObject) and language bindings. The C library can be scanned at compile time
276 and generate a metadata file, in addition to the actual native C library. Then
277 at runtime, language bindings can read this metadata and automatically provide
278 bindings to call into the C library.")
279 ; Some bits are distributed under the LGPL2+, others under the GPL2+
280 (license license:gpl2+)))
288 (uri (string-append "https://launchpad.net/intltool/trunk/"
289 version "/+download/intltool-"
293 "1karx4sb7bnm2j67q0q74hspkfn6lqprpy5r99vkn5bb36a4viv7"))))
294 (build-system gnu-build-system)
298 `(;; Propagate gettext because users expect it to be there, and so does
299 ;; the `intltool-update' script.
300 ("gettext" ,gnu-gettext)
302 ("perl-xml-parser" ,perl-xml-parser)
305 `(#:phases (alist-cons-after
306 'unpack 'patch-file-references
307 (lambda* (#:key inputs #:allow-other-keys)
308 (let ((file (assoc-ref inputs "file")))
309 (substitute* "intltool-update.in"
310 (("`file") (string-append "`" file "/bin/file")))))
312 (home-page "https://launchpad.net/intltool/+download")
313 (synopsis "Tools to centralise translations of different file formats")
315 "Intltool is a set of tools to centralise translations of many different
316 file formats using GNU gettext-compatible PO files.
318 The intltool collection can be used to do these things:
320 Extract translatable strings from various source files (.xml.in,
321 glade, .desktop.in, .server.in, .oaf.in).
323 Collect the extracted strings together with messages from traditional
324 source files (.c, .h) in po/$(PACKAGE).pot.
326 Merge back the translations from .po files into .xml, .desktop and
327 oaf files. This merge step will happen at build resp. installation time.")
328 (license license:gpl2+)))
336 (uri (string-append "http://files.itstool.org/itstool/itstool-"
340 "0fh34wi52i0qikgvlmrcpf1vx6gc1xqdad4539l4d9hikfsrz45z"))))
341 (build-system gnu-build-system)
343 `(("libxml2" ,libxml2)
344 ("python2-libxml2" ,python2-libxml2)
345 ("python-2" ,python-2)))
348 (modify-phases %standard-phases
350 'install 'wrap-program
351 (lambda* (#:key outputs #:allow-other-keys)
352 (let ((prog (string-append (assoc-ref outputs "out")
355 `("PYTHONPATH" = (,(getenv "PYTHONPATH"))))))))))
356 (home-page "http://www.itstool.org")
357 (synopsis "Tool to translate XML documents with PO files")
359 "ITS Tool allows you to translate your XML documents with PO files, using
360 rules from the W3C Internationalization Tag Set (ITS) to determine what to
361 translate and how to separate it into PO file messages.
363 PO files are the standard translation format for GNU and other Unix-like
364 systems. They present translatable information as discrete messages, allowing
365 each message to be translated independently. In contrast to whole-page
366 translation, translating with a message-based format like PO means you can
367 easily track changes to the source document down to the paragraph. When new
368 strings are added or existing strings are modified, you only need to update the
369 corresponding messages.
371 ITS Tool is designed to make XML documents translatable through PO files by
372 applying standard ITS rules, as well as extension rules specific to ITS Tool.
373 ITS also provides an industry standard way for authors to override translation
374 information in their documents, such as whether a particular element should be
376 (license license:gpl3+)))
385 (string-append "http://dbus.freedesktop.org/releases/dbus-glib/dbus-glib-"
389 "1xi1v1msz75qs0s4lkyf1psrksdppa3hwkg0mznc6gpw5flg3hdz"))))
390 (build-system gnu-build-system)
391 (propagated-inputs ; according to dbus-glib-1.pc
397 `(("glib" ,glib "bin")
398 ("pkg-config" ,pkg-config)))
399 (home-page "http://dbus.freedesktop.org/doc/dbus-glib/")
400 (synopsis "D-Bus GLib bindings")
402 "GLib bindings for D-Bus. The package is obsolete and superseded
403 by GDBus included in Glib.")
404 (license license:gpl2))) ; or Academic Free License 2.1
412 (uri (string-append "mirror://gnome/sources/libsigc++/"
413 (version-major+minor version) "/"
414 name "-" version ".tar.xz"))
417 "06xyvxaaxh3nbpjg86gcq5zcc2qnpx354wcfrqlhbndkq5kj2vqq"))))
418 (build-system gnu-build-system)
419 (native-inputs `(("pkg-config" ,pkg-config)
421 (home-page "http://libsigc.sourceforge.net/")
422 (synopsis "Type-safe callback system for standard C++")
424 "Libsigc++ implements a type-safe callback system for standard C++. It
425 allows you to define signals and to connect those signals to any callback
426 function, either global or a member function, regardless of whether it is
429 It also contains adaptor classes for connection of dissimilar callbacks and
430 has an ease of use unmatched by other C++ callback libraries.")
431 (license license:lgpl2.1+)))
439 (uri (string-append "mirror://gnome/sources/glibmm/"
440 (version-major+minor version)
441 "/glibmm-" version ".tar.xz"))
444 "1an4v1yk06svlmcyp1psk2a3bsn29s1a4gdx0ai2w788q6bfaiwn"))))
445 (build-system gnu-build-system)
447 `(#:phases (alist-cons-before
450 ;; This test uses /etc/fstab as an example file to read
451 ;; from; choose a better example.
452 (substitute* "tests/giomm_simple/main.cc"
454 (string-append (getcwd)
455 "/tests/giomm_simple/main.cc")))
457 ;; This test does a DNS lookup, and then expects to be able
458 ;; to open a TLS session; just skip it.
459 (substitute* "tests/giomm_tls_client/main.cc"
463 (native-inputs `(("pkg-config" ,pkg-config)
464 ("glib" ,glib "bin")))
466 `(("libsigc++" ,libsigc++)
468 (home-page "http://gtkmm.org/")
469 (synopsis "C++ interface to the GLib library")
471 "Glibmm provides a C++ programming interface to the part of GLib that are
473 (license license:lgpl2.1+)))
475 (define-public python2-pygobject-2
477 (name "python2-pygobject")
478 ;; This was the last version to declare the 2.0 platform number, i.e. its
479 ;; pkg-config files were named pygobject-2.0.pc
484 (uri (string-append "mirror://gnome/sources/pygobject/"
485 (version-major+minor version)
486 "/pygobject-" version ".tar.xz"))
489 "1f5dfxjnil2glfwxnqr14d2cjfbkghsbsn8n04js2c2icr7iv2pv"))
492 "python2-pygobject-2-gi-info-type-error-domain.patch")))))
493 (build-system gnu-build-system)
496 ("glib-bin" ,glib "bin") ;for tests: glib-compile-schemas
497 ("pkg-config" ,pkg-config)
498 ("dbus" ,dbus))) ;for tests
500 `(("python" ,python-2)
502 ("python2-pycairo" ,python2-pycairo)
503 ("gobject-introspection" ,gobject-introspection)))
505 `(("libffi" ,libffi))) ;mentioned in pygobject-2.0.pc
507 `(#:tests? #f ;segfaults during tests
508 #:configure-flags '("LIBS=-lcairo-gobject")))
509 (home-page "https://pypi.python.org/pypi/PyGObject")
510 (synopsis "Python bindings for GObject")
512 "Python bindings for GLib, GObject, and GIO.")
513 (license license:lgpl2.1+)))
515 (define-public python-pygobject
517 (name "python-pygobject")
522 (uri (string-append "mirror://gnome/sources/pygobject/"
523 (version-major+minor version)
524 "/pygobject-" version ".tar.xz"))
527 "1jbd2m39vcjh5h3m33l0317ziq8dxfzi40r6hrfcs4rp5l8s2fqw"))))
528 (build-system gnu-build-system)
531 ("glib-bin" ,glib "bin") ;for tests: glib-compile-schemas
532 ("pkg-config" ,pkg-config)))
536 ("python-pycairo" ,python-pycairo)
537 ("gobject-introspection" ,gobject-introspection)
540 ;; TODO: failing tests: test_native_calls_async
541 ;; test_native_calls_async_errors test_native_calls_sync
542 ;; test_native_calls_sync_errors test_python_calls_async
543 ;; test_python_calls_async_error test_python_calls_async_error_result
544 ;; test_python_calls_sync test_python_calls_sync_errors
545 ;; test_python_calls_sync_noargs test_callback_user_data_middle_none
546 ;; test_callback_user_data_middle_single
547 ;; test_callback_user_data_middle_tuple
549 (home-page "https://live.gnome.org/PyGObject")
550 (synopsis "Python bindings for GObject")
552 "Python bindings for GLib, GObject, and GIO.")
553 (license license:lgpl2.1+)))
555 (define-public python2-pygobject
556 (package (inherit python-pygobject)
557 (name "python2-pygobject")
559 `(("python" ,python-2)
561 ("python-pycairo" ,python2-pycairo)
562 ("gobject-introspection" ,gobject-introspection)
563 ("libffi" ,libffi)))))
565 (define telepathy-glib
567 (name "telepathy-glib")
574 "http://telepathy.freedesktop.org/releases/telepathy-glib/"
575 "telepathy-glib-" version ".tar.gz"))
578 "1symyzbjmxvksn2ifdkk50lafjm2llf2sbmky062gq2pz3cg23cy"))
581 ;; Don't use the same test name for multiple tests.
582 ;; <https://bugs.freedesktop.org/show_bug.cgi?id=92245>
585 (uri "https://bugs.freedesktop.org/attachment.cgi?id=118608")
586 (file-name (string-append "telepathy-glib-duplicate-tests.patch"))
589 "0z261fwrszxb28ccg3hsg9rizig4s84zvwmx6y31a4pyv7bvs5w3")))))))
590 (build-system gnu-build-system)
592 `(("glib" ,glib "bin") ; uses glib-mkenums
593 ("gobject-introspection" ,gobject-introspection)
594 ("pkg-config" ,pkg-config)
596 ("xsltproc" ,libxslt)))
598 ;; There are all in the Requires.private field of telepathy-glib.pc.
600 ("dbus-glib" ,dbus-glib)
602 (home-page "http://telepathy.freedesktop.org/wiki/")
603 (synopsis "GLib Real-time communications framework over D-Bus")
604 (description "Telepathy is a flexible, modular communications framework
605 that enables real-time communication over D-Bus via pluggable protocol
606 backends. Telepathy is a communications service that can be accessed by
607 many applications simultaneously.
609 This package provides the library for GLib applications.")
610 (license license:lgpl2.1+)))