gnu: glib: Work around unreliable GIO test.
[jackhill/guix/guix.git] / gnu / packages / glib.scm
... / ...
CommitLineData
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2013, 2014 Ludovic Courtès <ludo@gnu.org>
3;;; Copyright © 2013 Andreas Enge <andreas@enge.fr>
4;;; Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org>
5;;;
6;;; This file is part of GNU Guix.
7;;;
8;;; GNU Guix is free software; you can redistribute it and/or modify it
9;;; under the terms of the GNU General Public License as published by
10;;; the Free Software Foundation; either version 3 of the License, or (at
11;;; your option) any later version.
12;;;
13;;; GNU Guix is distributed in the hope that it will be useful, but
14;;; WITHOUT ANY WARRANTY; without even the implied warranty of
15;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16;;; GNU General Public License for more details.
17;;;
18;;; You should have received a copy of the GNU General Public License
19;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
20
21(define-module (gnu packages glib)
22 #:use-module ((guix licenses) #:prefix license:)
23 #:use-module (guix packages)
24 #:use-module (guix download)
25 #:use-module (guix utils)
26 #:use-module (guix build-system gnu)
27 #:use-module (gnu packages)
28 #:use-module (gnu packages base)
29 #:use-module (gnu packages bison)
30 #:use-module (gnu packages compression)
31 #:use-module (gnu packages flex)
32 #:use-module (gnu packages gettext)
33 #:use-module (gnu packages gtk)
34 #:use-module (gnu packages libffi)
35 #:use-module (gnu packages perl)
36 #:use-module (gnu packages pkg-config)
37 #:use-module (gnu packages python)
38 #:use-module (gnu packages xml)
39 #:use-module (gnu packages bash)
40 #:use-module (gnu packages file)
41 #:use-module (gnu packages which)
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
56(define dbus
57 (package
58 (name "dbus")
59 (version "1.8.10")
60 (source (origin
61 (method url-fetch)
62 (uri
63 (string-append "http://dbus.freedesktop.org/releases/dbus/dbus-"
64 version ".tar.gz"))
65 (sha256
66 (base32
67 "13mgvwigm931r8n9363imnn0vn6dvc0m322k3p8fs5c8nvyqggqh"))
68 (patches (list (search-patch "dbus-localstatedir.patch")))))
69 (build-system gnu-build-system)
70 (arguments
71 '(#:configure-flags (list ;; Install the system bus socket under /var.
72 "--localstatedir=/var"
73
74 ;; XXX: Fix the following to allow system-wide
75 ;; config.
76 ;; "--sysconfdir=/etc"
77
78 "--with-session-socket-dir=/tmp")
79 #:phases (alist-cons-after
80 'install 'post-install
81 (lambda* (#:key outputs #:allow-other-keys)
82 ;; 'dbus-launch' bails out if the 'session.d' directory
83 ;; below is missing, so create it along with its companion.
84 (let ((out (assoc-ref outputs "out")))
85 (mkdir (string-append out "/etc/dbus-1/session.d"))
86 (mkdir (string-append out "/etc/dbus-1/system.d"))
87 #t))
88 %standard-phases)))
89 (native-inputs
90 `(("pkg-config" ,pkg-config)))
91 (inputs
92 `(("expat" ,expat)
93
94 ;; Add a dependency on libx11 so that 'dbus-launch' has support for
95 ;; '--autolaunch'.
96 ("libx11" ,libx11)))
97
98 (home-page "http://dbus.freedesktop.org/")
99 (synopsis "Message bus for inter-process communication (IPC)")
100 (description
101 "D-Bus is a message bus system, a simple way for applications to
102talk to one another. In addition to interprocess communication, D-Bus
103helps coordinate process lifecycle; it makes it simple and reliable to
104code a \"single instance\" application or daemon, and to launch
105applications and daemons on demand when their services are needed.
106
107D-Bus supplies both a system daemon (for events such as \"new hardware
108device added\" or \"printer queue changed\") and a
109per-user-login-session daemon (for general IPC needs among user
110applications). Also, the message bus is built on top of a general
111one-to-one message passing framework, which can be used by any two apps
112to communicate directly (without going through the message bus
113daemon). Currently the communicating applications are on one computer,
114or through unencrypted TCP/IP suitable for use behind a firewall with
115shared NFS home directories.")
116 (license license:gpl2+))) ; or Academic Free License 2.1
117
118(define glib
119 (package
120 (name "glib")
121 (version "2.40.0")
122 (source (origin
123 (method url-fetch)
124 (uri (string-append "mirror://gnome/sources/"
125 name "/" (string-take version 4) "/"
126 name "-" version ".tar.xz"))
127 (sha256
128 (base32 "1d98mbqjmc34s8095lkw1j1bwvnnkw9581yfvjaikjvfjsaz29qd"))
129 (patches (list (search-patch "glib-tests-homedir.patch")
130 (search-patch "glib-tests-desktop.patch")
131 (search-patch "glib-tests-prlimit.patch")
132 (search-patch "glib-tests-timer.patch")
133 (search-patch "glib-tests-gapplication.patch")))))
134 (build-system gnu-build-system)
135 (outputs '("out" ; everything
136 "bin" ; glib-mkenums, gtester, etc.; depends on Python
137 "doc")) ; 20 MiB of GTK-Doc reference
138 (inputs
139 `(("coreutils" ,coreutils)
140 ("libffi" ,libffi)
141 ("zlib" ,zlib)
142 ("tzdata" ,tzdata))) ; for tests/gdatetime.c
143 (native-inputs
144 `(("gettext" ,gnu-gettext)
145 ("dbus" ,dbus) ; for GDBus tests
146 ("pkg-config" ,pkg-config)
147 ("python" ,python-wrapper)
148 ("perl" ,perl) ; needed by GIO tests
149 ("bash" ,bash)))
150 (arguments
151 '(#:phases (alist-cons-before
152 'build 'pre-build
153 (lambda* (#:key inputs outputs #:allow-other-keys)
154 ;; For tests/gdatetime.c.
155 (setenv "TZDIR"
156 (string-append (assoc-ref inputs "tzdata")
157 "/share/zoneinfo"))
158
159 ;; Some tests want write access there.
160 (setenv "XDG_CACHE_HOME" (getcwd))
161
162 (substitute* '("glib/gspawn.c"
163 "glib/tests/utils.c"
164 "tests/spawn-test.c")
165 (("/bin/sh")
166 (string-append (assoc-ref inputs "bash") "/bin/sh"))))
167 %standard-phases)
168
169 ;; Note: `--docdir' and `--htmldir' are not honored, so work around it.
170 #:configure-flags (list (string-append "--with-html-dir="
171 (assoc-ref %outputs "doc")
172 "/share/gtk-doc"))
173
174 ;; In 'gio/tests', 'gdbus-test-codegen-generated.h' is #included in a
175 ;; file that gets compiled possibly before it has been fully generated.
176 #:parallel-tests? #f))
177
178 (native-search-paths
179 ;; This variable is not really "owned" by GLib, but several related
180 ;; packages refer to it: gobject-introspection's tools use it as a search
181 ;; path for .gir files, and it's also a search path for schemas produced
182 ;; by 'glib-compile-schemas'.
183 (list (search-path-specification
184 (variable "XDG_DATA_DIRS")
185 (directories '("share")))))
186 (search-paths native-search-paths)
187
188 (synopsis "Thread-safe general utility library; basis of GTK+ and GNOME")
189 (description
190 "GLib provides data structure handling for C, portability wrappers,
191and interfaces for such runtime functionality as an event loop, threads,
192dynamic loading, and an object system.")
193 (home-page "http://developer.gnome.org/glib/")
194 (license license:lgpl2.0+))) ; some files are under lgpl2.1+
195
196(define gobject-introspection
197 (package
198 (name "gobject-introspection")
199 (version "1.38.0")
200 (source (origin
201 (method url-fetch)
202 (uri (string-append "http://ftp.gnome.org/pub/GNOME/sources/"
203 "gobject-introspection/"
204 (substring version 0 (string-rindex version #\.))
205 "/gobject-introspection-"
206 version ".tar.xz"))
207 (sha256
208 (base32 "0wvxyvgajmms2bb6k3pf1rdpnd79xdxamykzvxzmcyn1ag9yax9m"))
209 (patches (list (search-patch "gobject-introspection-cc.patch")))))
210 (build-system gnu-build-system)
211 (inputs
212 `(("bison" ,bison)
213 ("cairo" ,cairo)
214 ("flex" ,flex)
215 ("glib" ,glib)
216 ("pkg-config" ,pkg-config)
217 ("python-2" ,python-2)))
218 (native-inputs
219 `(("glib" ,glib "bin")))
220 (propagated-inputs
221 `(;; In practice, GIR users will need libffi when using
222 ;; gobject-introspection.
223 ("libffi" ,libffi)))
224 (arguments
225 `(#:phases
226 (alist-cons-before
227 'configure 'patch-paths
228 (lambda _
229 (substitute* "giscanner/sourcescanner.py"
230 (("GUIX_GCC_PATH") (which "gcc"))))
231 %standard-phases)))
232 (home-page "https://wiki.gnome.org/GObjectIntrospection")
233 (synopsis "Generate interface introspection data for GObject libraries")
234 (description
235 "GObject introspection is a middleware layer between C libraries (using
236GObject) and language bindings. The C library can be scanned at compile time
237and generate a metadata file, in addition to the actual native C library. Then
238at runtime, language bindings can read this metadata and automatically provide
239bindings to call into the C library.")
240 ; Some bits are distributed under the LGPL2+, others under the GPL2+
241 (license license:gpl2+)))
242
243(define intltool
244 (package
245 (name "intltool")
246 (version "0.50.2")
247 (source (origin
248 (method url-fetch)
249 (uri (string-append "https://launchpad.net/intltool/trunk/"
250 version "/+download/intltool-"
251 version ".tar.gz"))
252 (sha256
253 (base32
254 "01j4yd7i84n9nk4ccs6yifg84pp68nr9by57jdbhj7dpdxf5rwk7"))))
255 (build-system gnu-build-system)
256 (inputs
257 `(("file" ,file)))
258 (propagated-inputs
259 `(;; Propagate gettext because users expect it to be there, and so does
260 ;; the `intltool-update' script.
261 ("gettext" ,gnu-gettext)
262
263 ("perl-xml-parser" ,perl-xml-parser)
264 ("perl" ,perl)))
265 (arguments
266 `(#:phases (alist-cons-after
267 'unpack 'patch-file-references
268 (lambda* (#:key inputs #:allow-other-keys)
269 (let ((file (assoc-ref inputs "file")))
270 (substitute* "intltool-update.in"
271 (("`file") (string-append "`" file "/bin/file")))))
272 %standard-phases)))
273 (home-page "https://launchpad.net/intltool/+download")
274 (synopsis "Tools to centralise translations of different file formats")
275 (description
276 "Intltool is a set of tools to centralise translations of many different
277file formats using GNU gettext-compatible PO files.
278
279The intltool collection can be used to do these things:
280
281 Extract translatable strings from various source files (.xml.in,
282 glade, .desktop.in, .server.in, .oaf.in).
283
284 Collect the extracted strings together with messages from traditional
285 source files (.c, .h) in po/$(PACKAGE).pot.
286
287 Merge back the translations from .po files into .xml, .desktop and
288 oaf files. This merge step will happen at build resp. installation time.")
289 (license license:gpl2+)))
290
291(define itstool
292 (package
293 (name "itstool")
294 (version "1.2.0")
295 (source (origin
296 (method url-fetch)
297 (uri (string-append "http://files.itstool.org/itstool/itstool-"
298 version ".tar.bz2"))
299 (sha256
300 (base32
301 "1akq75aflihm3y7js8biy7b5mw2g11vl8yq90gydnwlwp0zxdzj6"))))
302 (build-system gnu-build-system)
303 (propagated-inputs
304 `(("libxml2" ,libxml2)
305 ("python-2" ,python-2)))
306 (home-page "http://www.itstool.org")
307 (synopsis "Tool to translate XML documents with PO files")
308 (description
309 "ITS Tool allows you to translate your XML documents with PO files, using
310rules from the W3C Internationalization Tag Set (ITS) to determine what to
311translate and how to separate it into PO file messages.
312
313PO files are the standard translation format for GNU and other Unix-like
314systems. They present translatable information as discrete messages, allowing
315each message to be translated independently. In contrast to whole-page
316translation, translating with a message-based format like PO means you can
317easily track changes to the source document down to the paragraph. When new
318strings are added or existing strings are modified, you only need to update the
319corresponding messages.
320
321ITS Tool is designed to make XML documents translatable through PO files by
322applying standard ITS rules, as well as extension rules specific to ITS Tool.
323ITS also provides an industry standard way for authors to override translation
324information in their documents, such as whether a particular element should be
325translated.")
326 (license license:gpl3+)))
327
328(define dbus-glib
329 (package
330 (name "dbus-glib")
331 (version "0.100.2")
332 (source (origin
333 (method url-fetch)
334 (uri
335 (string-append "http://dbus.freedesktop.org/releases/dbus-glib/dbus-glib-"
336 version ".tar.gz"))
337 (sha256
338 (base32
339 "1ibav91yg70f2l3l18cr0hf4mna1h9d4mrg0c60w4l8zjbd45fx5"))))
340 (build-system gnu-build-system)
341 (inputs
342 `(("dbus" ,dbus)
343 ("expat" ,expat)
344 ("glib" ,glib)))
345 (native-inputs
346 `(("glib" ,glib "bin")
347 ("pkg-config" ,pkg-config)))
348 (home-page "http://dbus.freedesktop.org/doc/dbus-glib/")
349 (synopsis "D-Bus GLib bindings")
350 (description
351 "GLib bindings for D-Bus. The package is obsolete and superseded
352by GDBus included in Glib.")
353 (license license:gpl2))) ; or Academic Free License 2.1
354
355(define libsigc++
356 (package
357 (name "libsigc++")
358 (version "2.3.1")
359 (source (origin
360 (method url-fetch)
361 (uri (string-append "mirror://gnome/sources/libsigc++/2.3/libsigc++-"
362 version ".tar.xz"))
363 (sha256
364 (base32
365 "14q3sq6d43f6wfcmwhw4v1aal4ba0h5x9v6wkxy2dnqznd95il37"))))
366 (build-system gnu-build-system)
367 (native-inputs `(("pkg-config" ,pkg-config)
368 ("m4" ,m4)))
369 (home-page "http://libsigc.sourceforge.net/")
370 (synopsis "Type-safe callback system for standard C++")
371 (description
372 "Libsigc++ implements a type-safe callback system for standard C++. It
373allows you to define signals and to connect those signals to any callback
374function, either global or a member function, regardless of whether it is
375static or virtual.
376
377It also contains adaptor classes for connection of dissimilar callbacks and
378has an ease of use unmatched by other C++ callback libraries.")
379 (license license:lgpl2.1+)))
380
381(define glibmm
382 (package
383 (name "glibmm")
384 (version "2.37.7")
385 (source (origin
386 (method url-fetch)
387 (uri (string-append "mirror://gnome/sources/glibmm/2.37/glibmm-"
388 version ".tar.xz"))
389 (sha256
390 (base32
391 "0mms4yl5izsya1135772z4jkb184ss86x0wlg6dm7yvwxvb6bjlw"))))
392 (build-system gnu-build-system)
393 (arguments
394 `(#:phases (alist-cons-before
395 'build 'pre-build
396 (lambda _
397 ;; This test uses /etc/fstab as an example file to read
398 ;; from; choose a better example.
399 (substitute* "tests/giomm_simple/main.cc"
400 (("/etc/fstab")
401 (string-append (getcwd)
402 "/tests/giomm_simple/main.cc")))
403
404 ;; This test does a DNS lookup, and then expects to be able
405 ;; to open a TLS session; just skip it.
406 (substitute* "tests/giomm_tls_client/main.cc"
407 (("Gio::init.*$")
408 "return 77;\n")))
409 %standard-phases)))
410 (native-inputs `(("pkg-config" ,pkg-config)
411 ("glib" ,glib "bin")))
412 (propagated-inputs
413 `(("libsigc++" ,libsigc++)
414 ("glib" ,glib)))
415 (home-page "http://gtkmm.org/")
416 (synopsis "C++ interface to the GLib library")
417 (description
418 "Glibmm provides a C++ programming interface to the part of GLib that are
419useful for C++.")
420 (license license:lgpl2.1+)))
421
422(define-public python2-pygobject-2
423 (package
424 (name "python2-pygobject")
425 ;; This was the last version to declare the 2.0 platform number, i.e. its
426 ;; pkg-config files were named pygobject-2.0.pc
427 (version "2.28.6")
428 (source
429 (origin
430 (method url-fetch)
431 (uri (string-append "mirror://gnome/sources/pygobject/"
432 (version-major+minor version)
433 "/pygobject-" version ".tar.xz"))
434 (sha256
435 (base32
436 "1f5dfxjnil2glfwxnqr14d2cjfbkghsbsn8n04js2c2icr7iv2pv"))
437 (patches
438 (list (search-patch
439 "python2-pygobject-2-gi-info-type-error-domain.patch")))))
440 (build-system gnu-build-system)
441 (native-inputs
442 `(("which" ,which)
443 ("glib-bin" ,glib "bin") ;for tests: glib-compile-schemas
444 ("pkg-config" ,pkg-config)
445 ("dbus" ,dbus))) ;for tests
446 (inputs
447 `(("python" ,python-2)
448 ("glib" ,glib)
449 ("python2-py2cairo" ,python2-py2cairo)
450 ("gobject-introspection" ,gobject-introspection)))
451 (propagated-inputs
452 `(("libffi" ,libffi))) ;mentioned in pygobject-2.0.pc
453 (arguments
454 `(#:tests? #f ;segfaults during tests
455 #:configure-flags '("LIBS=-lcairo-gobject")))
456 (home-page "https://pypi.python.org/pypi/PyGObject")
457 (synopsis "Python bindings for GObject")
458 (description
459 "Python bindings for GLib, GObject, and GIO.")
460 (license license:lgpl2.1+)))
461
462(define-public python-pygobject
463 (package
464 (name "python-pygobject")
465 (version "3.12.2") ;last version that works with
466 ;gobject-introspection 1.38
467 (source
468 (origin
469 (method url-fetch)
470 (uri (string-append "mirror://gnome/sources/pygobject/"
471 (version-major+minor version)
472 "/pygobject-" version ".tar.xz"))
473 (sha256
474 (base32
475 "08m5yad1hjdax4g39w6lgjk4124mcwpa8fc5iyvb8nygk8s3syky"))))
476 ;; 3.14.0: 0m1d75iwxa6k1xbkn6c6yq5r10pxnf7i5c2a5yvwsnab7ylzz7kp
477 (build-system gnu-build-system)
478 (native-inputs
479 `(("which" ,which)
480 ("glib-bin" ,glib "bin") ;for tests: glib-compile-schemas
481 ("pkg-config" ,pkg-config)))
482 (inputs
483 `(("python" ,python)
484 ("glib" ,glib)
485 ("python-pycairo" ,python-pycairo)
486 ("gobject-introspection" ,gobject-introspection)
487 ("libffi" ,libffi)))
488 (arguments
489 ;; TODO: failing tests: test_native_calls_async
490 ;; test_native_calls_async_errors test_native_calls_sync
491 ;; test_native_calls_sync_errors test_python_calls_async
492 ;; test_python_calls_async_error test_python_calls_async_error_result
493 ;; test_python_calls_sync test_python_calls_sync_errors
494 ;; test_python_calls_sync_noargs test_callback_user_data_middle_none
495 ;; test_callback_user_data_middle_single
496 ;; test_callback_user_data_middle_tuple
497 '(#:tests? #f))
498 (home-page "https://pypi.python.org/pypi/PyGObject")
499 (synopsis "Python bindings for GObject")
500 (description
501 "Python bindings for GLib, GObject, and GIO.")
502 (license license:lgpl2.1+)))