gnu: glib: Work around unreliable GIO test.
[jackhill/guix/guix.git] / gnu / packages / glib.scm
CommitLineData
3889a82e 1;;; GNU Guix --- Functional package management for GNU
00585a55 2;;; Copyright © 2013, 2014 Ludovic Courtès <ludo@gnu.org>
d6b8cb5c
AE
3;;; Copyright © 2013 Andreas Enge <andreas@enge.fr>
4;;; Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org>
3889a82e
NK
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
943f33a3 21(define-module (gnu packages glib)
b5b73a82 22 #:use-module ((guix licenses) #:prefix license:)
3889a82e
NK
23 #:use-module (guix packages)
24 #:use-module (guix download)
a1de06b6 25 #:use-module (guix utils)
3889a82e 26 #:use-module (guix build-system gnu)
943f33a3
LC
27 #:use-module (gnu packages)
28 #:use-module (gnu packages base)
9ceb630c 29 #:use-module (gnu packages bison)
943f33a3 30 #:use-module (gnu packages compression)
9ceb630c 31 #:use-module (gnu packages flex)
1dba6407 32 #:use-module (gnu packages gettext)
9ceb630c 33 #:use-module (gnu packages gtk)
943f33a3 34 #:use-module (gnu packages libffi)
d6b8cb5c 35 #:use-module (gnu packages perl)
943f33a3
LC
36 #:use-module (gnu packages pkg-config)
37 #:use-module (gnu packages python)
7bc5cc2b 38 #:use-module (gnu packages xml)
5aa601a3 39 #:use-module (gnu packages bash)
80370441 40 #:use-module (gnu packages file)
a1de06b6 41 #:use-module (gnu packages which)
80370441 42 #:use-module (gnu packages xorg)
a5a7d374 43 #:use-module (gnu packages m4)
943f33a3 44
80370441
LC
45 ;; Export variables up-front to allow circular dependency with the 'xorg'
46 ;; module.
47 #:export (dbus
48 glib
6ac6a6b9 49 gobject-introspection
80370441
LC
50 dbus-glib
51 intltool
a5a7d374
LC
52 itstool
53 libsigc++
54 glibmm))
80370441
LC
55
56(define dbus
943f33a3
LC
57 (package
58 (name "dbus")
f2122ed1 59 (version "1.8.10")
943f33a3
LC
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
f2122ed1 67 "13mgvwigm931r8n9363imnn0vn6dvc0m322k3p8fs5c8nvyqggqh"))
01eafd38 68 (patches (list (search-patch "dbus-localstatedir.patch")))))
943f33a3 69 (build-system gnu-build-system)
8eaa8a3b
LC
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
8fa9ff20
LC
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)))
708be46b
LC
89 (native-inputs
90 `(("pkg-config" ,pkg-config)))
943f33a3 91 (inputs
d6b8cb5c 92 `(("expat" ,expat)
80370441
LC
93
94 ;; Add a dependency on libx11 so that 'dbus-launch' has support for
95 ;; '--autolaunch'.
96 ("libx11" ,libx11)))
97
943f33a3
LC
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
35b9e423 102talk to one another. In addition to interprocess communication, D-Bus
943f33a3
LC
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
35b9e423 110applications). Also, the message bus is built on top of a general
943f33a3
LC
111one-to-one message passing framework, which can be used by any two apps
112to communicate directly (without going through the message bus
35b9e423 113daemon). Currently the communicating applications are on one computer,
943f33a3
LC
114or through unencrypted TCP/IP suitable for use behind a firewall with
115shared NFS home directories.")
d6b8cb5c 116 (license license:gpl2+))) ; or Academic Free License 2.1
3889a82e 117
80370441 118(define glib
3889a82e
NK
119 (package
120 (name "glib")
59bad04f 121 (version "2.40.0")
3889a82e
NK
122 (source (origin
123 (method url-fetch)
785db4d8 124 (uri (string-append "mirror://gnome/sources/"
d274f499 125 name "/" (string-take version 4) "/"
943f33a3 126 name "-" version ".tar.xz"))
3889a82e 127 (sha256
59bad04f 128 (base32 "1d98mbqjmc34s8095lkw1j1bwvnnkw9581yfvjaikjvfjsaz29qd"))
01eafd38
LC
129 (patches (list (search-patch "glib-tests-homedir.patch")
130 (search-patch "glib-tests-desktop.patch")
ca9ea1a8 131 (search-patch "glib-tests-prlimit.patch")
36d2a3af
LC
132 (search-patch "glib-tests-timer.patch")
133 (search-patch "glib-tests-gapplication.patch")))))
3889a82e 134 (build-system gnu-build-system)
426adbe8
LC
135 (outputs '("out" ; everything
136 "bin" ; glib-mkenums, gtester, etc.; depends on Python
137 "doc")) ; 20 MiB of GTK-Doc reference
3889a82e
NK
138 (inputs
139 `(("coreutils" ,coreutils)
3889a82e 140 ("libffi" ,libffi)
c4c4cc05
JD
141 ("zlib" ,zlib)
142 ("tzdata" ,tzdata))) ; for tests/gdatetime.c
143 (native-inputs
59bad04f 144 `(("gettext" ,gnu-gettext)
c4c4cc05 145 ("dbus" ,dbus) ; for GDBus tests
3889a82e 146 ("pkg-config" ,pkg-config)
ee3e314b 147 ("python" ,python-wrapper)
943f33a3 148 ("perl" ,perl) ; needed by GIO tests
c4c4cc05 149 ("bash" ,bash)))
943f33a3 150 (arguments
01eafd38 151 '(#:phases (alist-cons-before
943f33a3
LC
152 'build 'pre-build
153 (lambda* (#:key inputs outputs #:allow-other-keys)
7bc5cc2b
LC
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
943f33a3
LC
162 (substitute* '("glib/gspawn.c"
163 "glib/tests/utils.c"
164 "tests/spawn-test.c")
7bc5cc2b 165 (("/bin/sh")
d274f499 166 (string-append (assoc-ref inputs "bash") "/bin/sh"))))
943f33a3
LC
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")
00585a55
LC
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))
ce2df078
LC
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
f50d2669 188 (synopsis "Thread-safe general utility library; basis of GTK+ and GNOME")
3889a82e
NK
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/")
d6b8cb5c 194 (license license:lgpl2.0+))) ; some files are under lgpl2.1+
71eb5c10 195
6ac6a6b9 196(define gobject-introspection
9ceb630c
CR
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
503c5f6d
CR
208 (base32 "0wvxyvgajmms2bb6k3pf1rdpnd79xdxamykzvxzmcyn1ag9yax9m"))
209 (patches (list (search-patch "gobject-introspection-cc.patch")))))
9ceb630c
CR
210 (build-system gnu-build-system)
211 (inputs
212 `(("bison" ,bison)
213 ("cairo" ,cairo)
214 ("flex" ,flex)
215 ("glib" ,glib)
9ceb630c
CR
216 ("pkg-config" ,pkg-config)
217 ("python-2" ,python-2)))
426adbe8
LC
218 (native-inputs
219 `(("glib" ,glib "bin")))
af949e8e
CR
220 (propagated-inputs
221 `(;; In practice, GIR users will need libffi when using
222 ;; gobject-introspection.
223 ("libffi" ,libffi)))
9ceb630c
CR
224 (arguments
225 `(#:phases
d4bf49b1
EB
226 (alist-cons-before
227 'configure 'patch-paths
228 (lambda _
503c5f6d 229 (substitute* "giscanner/sourcescanner.py"
d4bf49b1 230 (("GUIX_GCC_PATH") (which "gcc"))))
9ceb630c
CR
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
80370441 243(define intltool
71eb5c10
LC
244 (package
245 (name "intltool")
d6b8cb5c 246 (version "0.50.2")
71eb5c10
LC
247 (source (origin
248 (method url-fetch)
d6b8cb5c
AE
249 (uri (string-append "https://launchpad.net/intltool/trunk/"
250 version "/+download/intltool-"
251 version ".tar.gz"))
71eb5c10
LC
252 (sha256
253 (base32
d6b8cb5c 254 "01j4yd7i84n9nk4ccs6yifg84pp68nr9by57jdbhj7dpdxf5rwk7"))))
71eb5c10 255 (build-system gnu-build-system)
93882f0e
EB
256 (inputs
257 `(("file" ,file)))
71eb5c10 258 (propagated-inputs
107b415e
LC
259 `(;; Propagate gettext because users expect it to be there, and so does
260 ;; the `intltool-update' script.
1dba6407 261 ("gettext" ,gnu-gettext)
107b415e 262
e33d9d6f 263 ("perl-xml-parser" ,perl-xml-parser)
107b415e 264 ("perl" ,perl)))
93882f0e
EB
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)))
d6b8cb5c
AE
273 (home-page "https://launchpad.net/intltool/+download")
274 (synopsis "Tools to centralise translations of different file formats")
71eb5c10 275 (description
35b9e423 276 "Intltool is a set of tools to centralise translations of many different
71eb5c10
LC
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
35b9e423 288 oaf files. This merge step will happen at build resp. installation time.")
d6b8cb5c 289 (license license:gpl2+)))
24b5c463 290
80370441 291(define itstool
20a26ff5
CR
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)
f922fc42
AE
303 (propagated-inputs
304 `(("libxml2" ,libxml2)
305 ("python-2" ,python-2)))
20a26ff5
CR
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.")
a129e0d8 326 (license license:gpl3+)))
20a26ff5 327
80370441 328(define dbus-glib
24b5c463
AE
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)
44add1ce
LC
344 ("glib" ,glib)))
345 (native-inputs
346 `(("glib" ,glib "bin")
24b5c463
AE
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
a5a7d374
LC
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)
41eb1198
LC
367 (native-inputs `(("pkg-config" ,pkg-config)
368 ("m4" ,m4)))
a5a7d374
LC
369 (home-page "http://libsigc.sourceforge.net/")
370 (synopsis "Type-safe callback system for standard C++")
371 (description
35b9e423 372 "Libsigc++ implements a type-safe callback system for standard C++. It
a5a7d374
LC
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)))
41eb1198
LC
410 (native-inputs `(("pkg-config" ,pkg-config)
411 ("glib" ,glib "bin")))
a5a7d374
LC
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
35b9e423 418 "Glibmm provides a C++ programming interface to the part of GLib that are
a5a7d374
LC
419useful for C++.")
420 (license license:lgpl2.1+)))
a1de06b6
EB
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+)))