gnu: Add libsigc++ and glibmm.
[jackhill/guix/guix.git] / gnu / packages / glib.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013 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)
23 #:renamer (symbol-prefix-proc 'license:))
24 #:use-module (guix packages)
25 #:use-module (guix download)
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 #:renamer (symbol-prefix-proc 'guix:))
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)
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.6.4")
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 "1wacqyfkcpayg7f8rvx9awqg275n5pksxq5q7y21lxjx85x6pfjz"))))
68 (build-system gnu-build-system)
69 (arguments
70 '(#:configure-flags (list ;; Install the system bus socket under /var.
71 "--localstatedir=/var"
72
73 ;; XXX: Fix the following to allow system-wide
74 ;; config.
75 ;; "--sysconfdir=/etc"
76
77 "--with-session-socket-dir=/tmp")
78 #:patches (list (assoc-ref %build-inputs "patch/localstatedir"))))
79 (inputs
80 `(("expat" ,expat)
81 ("pkg-config" ,pkg-config)
82 ("patch/localstatedir"
83 ,(search-patch "dbus-localstatedir.patch"))
84
85 ;; Add a dependency on libx11 so that 'dbus-launch' has support for
86 ;; '--autolaunch'.
87 ("libx11" ,libx11)))
88
89 (home-page "http://dbus.freedesktop.org/")
90 (synopsis "Message bus for inter-process communication (IPC)")
91 (description
92 "D-Bus is a message bus system, a simple way for applications to
93 talk to one another. In addition to interprocess communication, D-Bus
94 helps coordinate process lifecycle; it makes it simple and reliable to
95 code a \"single instance\" application or daemon, and to launch
96 applications and daemons on demand when their services are needed.
97
98 D-Bus supplies both a system daemon (for events such as \"new hardware
99 device added\" or \"printer queue changed\") and a
100 per-user-login-session daemon (for general IPC needs among user
101 applications). Also, the message bus is built on top of a general
102 one-to-one message passing framework, which can be used by any two apps
103 to communicate directly (without going through the message bus
104 daemon). Currently the communicating applications are on one computer,
105 or through unencrypted TCP/IP suitable for use behind a firewall with
106 shared NFS home directories.")
107 (license license:gpl2+))) ; or Academic Free License 2.1
108
109 (define glib
110 (package
111 (name "glib")
112 (version "2.38.0")
113 (source (origin
114 (method url-fetch)
115 (uri (string-append "mirror://gnome/sources/"
116 name "/" (string-take version 4) "/"
117 name "-" version ".tar.xz"))
118 (sha256
119 (base32 "0cpzqadqk6z6bmb79p04pykxc8x57rvshh33414cnk41bvgaf4vm"))))
120 (build-system gnu-build-system)
121 (outputs '("out" ; everything
122 "doc")) ; 20 MiB of GTK-Doc reference
123 (inputs
124 `(("coreutils" ,coreutils)
125 ("gettext" ,guix:gettext)
126 ("libffi" ,libffi)
127 ("pkg-config" ,pkg-config)
128 ("python" ,python-wrapper)
129 ("zlib" ,zlib)
130 ("perl" ,perl) ; needed by GIO tests
131 ("dbus" ,dbus) ; for GDBus tests
132 ("bash" ,bash)
133 ("tzdata" ,tzdata) ; for tests/gdatetime.c
134
135 ("patch/tests-homedir"
136 ,(search-patch "glib-tests-homedir.patch"))
137 ("patch/tests-desktop"
138 ,(search-patch "glib-tests-desktop.patch"))
139 ("patch/tests-prlimit"
140 ,(search-patch "glib-tests-prlimit.patch"))))
141 (arguments
142 '(#:patches (list (assoc-ref %build-inputs "patch/tests-homedir")
143 (assoc-ref %build-inputs "patch/tests-desktop")
144 (assoc-ref %build-inputs "patch/tests-prlimit"))
145 #:phases (alist-cons-before
146 'build 'pre-build
147 (lambda* (#:key inputs outputs #:allow-other-keys)
148 ;; For tests/gdatetime.c.
149 (setenv "TZDIR"
150 (string-append (assoc-ref inputs "tzdata")
151 "/share/zoneinfo"))
152
153 ;; Some tests want write access there.
154 (setenv "XDG_CACHE_HOME" (getcwd))
155
156 (substitute* '("glib/gspawn.c"
157 "glib/tests/utils.c"
158 "tests/spawn-test.c")
159 (("/bin/sh")
160 (string-append (assoc-ref inputs "bash") "/bin/sh"))))
161 %standard-phases)
162
163 ;; Note: `--docdir' and `--htmldir' are not honored, so work around it.
164 #:configure-flags (list (string-append "--with-html-dir="
165 (assoc-ref %outputs "doc")
166 "/share/gtk-doc"))))
167 (synopsis "Thread-safe general utility library; basis of GTK+ and GNOME")
168 (description
169 "GLib provides data structure handling for C, portability wrappers,
170 and interfaces for such runtime functionality as an event loop, threads,
171 dynamic loading, and an object system.")
172 (home-page "http://developer.gnome.org/glib/")
173 (license license:lgpl2.0+))) ; some files are under lgpl2.1+
174
175 (define gobject-introspection
176 (package
177 (name "gobject-introspection")
178 (version "1.38.0")
179 (source (origin
180 (method url-fetch)
181 (uri (string-append "http://ftp.gnome.org/pub/GNOME/sources/"
182 "gobject-introspection/"
183 (substring version 0 (string-rindex version #\.))
184 "/gobject-introspection-"
185 version ".tar.xz"))
186 (sha256
187 (base32 "0wvxyvgajmms2bb6k3pf1rdpnd79xdxamykzvxzmcyn1ag9yax9m"))))
188 (build-system gnu-build-system)
189 (inputs
190 `(("bison" ,bison)
191 ("cairo" ,cairo)
192 ("flex" ,flex)
193 ("glib" ,glib)
194 ("libffi" ,libffi)
195 ("pkg-config" ,pkg-config)
196 ("python-2" ,python-2)))
197 (arguments
198 `(#:phases
199 (alist-replace
200 'configure
201 (lambda* (#:key #:allow-other-keys #:rest args)
202 (let ((configure (assoc-ref %standard-phases 'configure)))
203 ;; giscanner/sourcescanner.py looks for 'CC', let's set it here.
204 (setenv "CC" "gcc")
205 (apply configure args)))
206 %standard-phases)))
207 (home-page "https://wiki.gnome.org/GObjectIntrospection")
208 (synopsis "Generate interface introspection data for GObject libraries")
209 (description
210 "GObject introspection is a middleware layer between C libraries (using
211 GObject) and language bindings. The C library can be scanned at compile time
212 and generate a metadata file, in addition to the actual native C library. Then
213 at runtime, language bindings can read this metadata and automatically provide
214 bindings to call into the C library.")
215 ; Some bits are distributed under the LGPL2+, others under the GPL2+
216 (license license:gpl2+)))
217
218 (define intltool
219 (package
220 (name "intltool")
221 (version "0.50.2")
222 (source (origin
223 (method url-fetch)
224 (uri (string-append "https://launchpad.net/intltool/trunk/"
225 version "/+download/intltool-"
226 version ".tar.gz"))
227 (sha256
228 (base32
229 "01j4yd7i84n9nk4ccs6yifg84pp68nr9by57jdbhj7dpdxf5rwk7"))))
230 (build-system gnu-build-system)
231 (propagated-inputs
232 `(;; Propagate gettext because users expect it to be there, and so does
233 ;; the `intltool-update' script.
234 ("gettext" ,guix:gettext)
235
236 ;; `file' is used by `intltool-update' too.
237 ("file" ,file)
238
239 ("perl-xml-parser" ,perl-xml-parser)
240 ("perl" ,perl)))
241 (home-page "https://launchpad.net/intltool/+download")
242 (synopsis "Tools to centralise translations of different file formats")
243 (description
244 "intltool is a set of tools to centralise translations of many different
245 file formats using GNU gettext-compatible PO files.
246
247 The intltool collection can be used to do these things:
248
249 Extract translatable strings from various source files (.xml.in,
250 glade, .desktop.in, .server.in, .oaf.in).
251
252 Collect the extracted strings together with messages from traditional
253 source files (.c, .h) in po/$(PACKAGE).pot.
254
255 Merge back the translations from .po files into .xml, .desktop and
256 oaf files. This merge step will happen at build resp. installation time.")
257 (license license:gpl2+)))
258
259 (define itstool
260 (package
261 (name "itstool")
262 (version "1.2.0")
263 (source (origin
264 (method url-fetch)
265 (uri (string-append "http://files.itstool.org/itstool/itstool-"
266 version ".tar.bz2"))
267 (sha256
268 (base32
269 "1akq75aflihm3y7js8biy7b5mw2g11vl8yq90gydnwlwp0zxdzj6"))))
270 (build-system gnu-build-system)
271 (propagated-inputs
272 `(("libxml2" ,libxml2)
273 ("python-2" ,python-2)))
274 (home-page "http://www.itstool.org")
275 (synopsis "Tool to translate XML documents with PO files")
276 (description
277 "ITS Tool allows you to translate your XML documents with PO files, using
278 rules from the W3C Internationalization Tag Set (ITS) to determine what to
279 translate and how to separate it into PO file messages.
280
281 PO files are the standard translation format for GNU and other Unix-like
282 systems. They present translatable information as discrete messages, allowing
283 each message to be translated independently. In contrast to whole-page
284 translation, translating with a message-based format like PO means you can
285 easily track changes to the source document down to the paragraph. When new
286 strings are added or existing strings are modified, you only need to update the
287 corresponding messages.
288
289 ITS Tool is designed to make XML documents translatable through PO files by
290 applying standard ITS rules, as well as extension rules specific to ITS Tool.
291 ITS also provides an industry standard way for authors to override translation
292 information in their documents, such as whether a particular element should be
293 translated.")
294 (license license:gpl3+)))
295
296 (define dbus-glib
297 (package
298 (name "dbus-glib")
299 (version "0.100.2")
300 (source (origin
301 (method url-fetch)
302 (uri
303 (string-append "http://dbus.freedesktop.org/releases/dbus-glib/dbus-glib-"
304 version ".tar.gz"))
305 (sha256
306 (base32
307 "1ibav91yg70f2l3l18cr0hf4mna1h9d4mrg0c60w4l8zjbd45fx5"))))
308 (build-system gnu-build-system)
309 (inputs
310 `(("dbus" ,dbus)
311 ("expat" ,expat)
312 ("glib" ,glib)
313 ("pkg-config" ,pkg-config)))
314 (home-page "http://dbus.freedesktop.org/doc/dbus-glib/")
315 (synopsis "D-Bus GLib bindings")
316 (description
317 "GLib bindings for D-Bus. The package is obsolete and superseded
318 by GDBus included in Glib.")
319 (license license:gpl2))) ; or Academic Free License 2.1
320
321 (define libsigc++
322 (package
323 (name "libsigc++")
324 (version "2.3.1")
325 (source (origin
326 (method url-fetch)
327 (uri (string-append "mirror://gnome/sources/libsigc++/2.3/libsigc++-"
328 version ".tar.xz"))
329 (sha256
330 (base32
331 "14q3sq6d43f6wfcmwhw4v1aal4ba0h5x9v6wkxy2dnqznd95il37"))))
332 (build-system gnu-build-system)
333 (inputs `(("pkg-config" ,pkg-config)))
334 (native-inputs `(("m4" ,m4)))
335 (home-page "http://libsigc.sourceforge.net/")
336 (synopsis "Type-safe callback system for standard C++")
337 (description
338 "libsigc++ implements a type-safe callback system for standard C++. It
339 allows you to define signals and to connect those signals to any callback
340 function, either global or a member function, regardless of whether it is
341 static or virtual.
342
343 It also contains adaptor classes for connection of dissimilar callbacks and
344 has an ease of use unmatched by other C++ callback libraries.")
345 (license license:lgpl2.1+)))
346
347 (define glibmm
348 (package
349 (name "glibmm")
350 (version "2.37.7")
351 (source (origin
352 (method url-fetch)
353 (uri (string-append "mirror://gnome/sources/glibmm/2.37/glibmm-"
354 version ".tar.xz"))
355 (sha256
356 (base32
357 "0mms4yl5izsya1135772z4jkb184ss86x0wlg6dm7yvwxvb6bjlw"))))
358 (build-system gnu-build-system)
359 (arguments
360 `(#:phases (alist-cons-before
361 'build 'pre-build
362 (lambda _
363 ;; This test uses /etc/fstab as an example file to read
364 ;; from; choose a better example.
365 (substitute* "tests/giomm_simple/main.cc"
366 (("/etc/fstab")
367 (string-append (getcwd)
368 "/tests/giomm_simple/main.cc")))
369
370 ;; This test does a DNS lookup, and then expects to be able
371 ;; to open a TLS session; just skip it.
372 (substitute* "tests/giomm_tls_client/main.cc"
373 (("Gio::init.*$")
374 "return 77;\n")))
375 %standard-phases)))
376 (inputs `(("pkg-config" ,pkg-config)))
377 (propagated-inputs
378 `(("libsigc++" ,libsigc++)
379 ("glib" ,glib)))
380 (home-page "http://gtkmm.org/")
381 (synopsis "C++ interface to the GLib library")
382 (description
383 "glibmm provides a C++ programming interface to the part of GLib that are
384 useful for C++.")
385 (license license:lgpl2.1+)))