Merge branch 'master' into core-updates
[jackhill/guix/guix.git] / gnu / packages / qt.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2014, 2015 Andreas Enge <andreas@enge.fr>
3 ;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com>
4 ;;; Copyright © 2015 Ludovic Courtès <ludo@gnu.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 qt)
22 #:use-module ((guix licenses) #:select (gpl2 gpl3 lgpl2.1 x11-style))
23 #:use-module (guix packages)
24 #:use-module (guix download)
25 #:use-module (guix build utils)
26 #:use-module (guix build-system gnu)
27 #:use-module (guix packages)
28 #:use-module (guix utils)
29 #:use-module (gnu packages)
30 #:use-module (gnu packages bison)
31 #:use-module (gnu packages compression)
32 #:use-module (gnu packages cups)
33 #:use-module (gnu packages databases)
34 #:use-module (gnu packages fontutils)
35 #:use-module (gnu packages flex)
36 #:use-module (gnu packages gl)
37 #:use-module (gnu packages glib)
38 #:use-module (gnu packages gnuzilla)
39 #:use-module (gnu packages gperf)
40 #:use-module (gnu packages icu4c)
41 #:use-module (gnu packages image)
42 #:use-module (gnu packages linux)
43 #:use-module (gnu packages databases)
44 #:use-module (gnu packages ninja)
45 #:use-module (gnu packages pciutils)
46 #:use-module (gnu packages pcre)
47 #:use-module (gnu packages perl)
48 #:use-module (gnu packages pkg-config)
49 #:use-module (gnu packages pulseaudio)
50 #:use-module (gnu packages python)
51 #:use-module (gnu packages ruby)
52 #:use-module (gnu packages tls)
53 #:use-module (gnu packages xdisorg)
54 #:use-module (gnu packages xorg)
55 #:use-module (gnu packages xml))
56
57 (define-public libxkbcommon
58 (package
59 (name "libxkbcommon")
60 (version "0.5.0")
61 (source (origin
62 (method url-fetch)
63 (uri (string-append "http://xkbcommon.org/download/" name "-"
64 version ".tar.xz"))
65 (sha256
66 (base32
67 "176ii5dn2wh74q48sd8ac37ljlvgvp5f506glr96z6ibfhj7igch"))))
68 (build-system gnu-build-system)
69 (inputs
70 `(("libx11" ,libx11)
71 ("libxcb" ,libxcb)
72 ("xkeyboard-config" ,xkeyboard-config)))
73 (native-inputs
74 `(("bison" ,bison)
75 ("pkg-config" ,pkg-config)))
76 (arguments
77 `(#:configure-flags
78 (list (string-append "--with-xkb-config-root="
79 (assoc-ref %build-inputs "xkeyboard-config")
80 "/share/X11/xkb")
81 (string-append "--with-x-locale-root="
82 (assoc-ref %build-inputs "libx11")
83 "/share/X11/locale"))))
84 (home-page "http://xkbcommon.org/")
85 (synopsis "Library to handle keyboard descriptions")
86 (description "Xkbcommon is a library to handle keyboard descriptions,
87 including loading them from disk, parsing them and handling their
88 state. It is mainly meant for client toolkits, window systems, and other
89 system applications; currently that includes Wayland, kmscon, GTK+, Qt,
90 Clutter, and more. Despite the name, it is not currently used by anything
91 X11 (yet).")
92 (license (x11-style "file://COPYING"
93 "See 'COPYING' in the distribution."))))
94
95 (define-public qt
96 (package
97 (name "qt")
98 (version "5.4.2")
99 (source (origin
100 (method url-fetch)
101 (uri (string-append "http://download.qt-project.org/official_releases/qt/"
102 (string-copy version 0 (string-rindex version #\.))
103 "/" version
104 "/single/qt-everywhere-opensource-src-"
105 version ".tar.xz"))
106 (sha256
107 (base32
108 "09gay5cimfdb0apy60v7z4r4zkl2vjysdppzihpla8dp2c30fvcc"))
109 (patches (list (search-patch "qt5-conflicting-typedefs.patch")
110 (search-patch "qt5-runpath.patch")))
111 (snippet
112 '(begin
113 ;; Remove broken symlinks.
114 (delete-file "qtwebengine/src/3rdparty/chromium/third_party/\
115 mesa/src/src/gallium/state_trackers/d3d1x/w32api")
116 (delete-file "qtwebengine/src/3rdparty/chromium/third_party/\
117 webrtc/tools/e2e_quality/audio/perf")))))
118 (build-system gnu-build-system)
119 (propagated-inputs
120 `(("mesa" ,mesa)))
121 (inputs
122 `(("alsa-lib" ,alsa-lib)
123 ("dbus" ,dbus)
124 ("cups" ,cups)
125 ("expat" ,expat)
126 ("fontconfig" ,fontconfig)
127 ("freetype" ,freetype)
128 ("glib" ,glib)
129 ("icu4c" ,icu4c)
130 ("libjpeg" ,libjpeg)
131 ("libmng" ,libmng)
132 ("libpci" ,pciutils)
133 ("libpng" ,libpng)
134 ("libx11" ,libx11)
135 ("libxcomposite" ,libxcomposite)
136 ("libxcursor" ,libxcursor)
137 ("libxfixes" ,libxfixes)
138 ("libxi" ,libxi)
139 ("libxinerama" ,libxinerama)
140 ("libxkbcommon" ,libxkbcommon)
141 ("libxml2" ,libxml2)
142 ("libxrandr" ,libxrandr)
143 ("libxrender" ,libxrender)
144 ("libxslt" ,libxslt)
145 ("libxtst" ,libxtst)
146 ("mtdev" ,mtdev)
147 ("mysql" ,mysql)
148 ("nss" ,nss)
149 ("openssl" ,openssl)
150 ("postgresql" ,postgresql)
151 ("pulseaudio" ,pulseaudio)
152 ("pcre" ,pcre)
153 ("sqlite" ,sqlite)
154 ("udev" ,eudev)
155 ("unixodbc" ,unixodbc)
156 ("xcb-util" ,xcb-util)
157 ("xcb-util-image" ,xcb-util-image)
158 ("xcb-util-keysyms" ,xcb-util-keysyms)
159 ("xcb-util-renderutil" ,xcb-util-renderutil)
160 ("xcb-util-wm" ,xcb-util-wm)
161 ("zlib" ,zlib)))
162 (native-inputs
163 `(("bison" ,bison)
164 ("flex" ,flex)
165 ("gperf" ,gperf)
166 ("ninja" ,ninja)
167 ("perl" ,perl)
168 ("pkg-config" ,pkg-config)
169 ("python" ,python-2)
170 ("ruby" ,ruby)
171 ("which" ,(@ (gnu packages base) which))))
172 (arguments
173 `(#:phases
174 (alist-replace
175 'configure
176 (lambda* (#:key outputs #:allow-other-keys)
177 (let ((out (assoc-ref outputs "out")))
178 (substitute* '("configure" "qtbase/configure")
179 (("/bin/pwd") (which "pwd")))
180 (substitute* "qtbase/src/corelib/global/global.pri"
181 (("/bin/ls") (which "ls")))
182 (substitute* "qtwebengine/src/3rdparty/chromium/build/common.gypi"
183 (("/bin/echo") (which "echo")))
184 (substitute* "qtwebengine/src/3rdparty/chromium/third_party/\
185 WebKit/Source/build/scripts/scripts.gypi"
186 (("/usr/bin/gcc") (which "gcc")))
187 (setenv "NINJA_PATH" (which "ninja"))
188 ;; do not pass "--enable-fast-install", which makes the
189 ;; configure process fail
190 (zero? (system*
191 "./configure"
192 "-verbose"
193 "-prefix" out
194 "-opensource"
195 "-confirm-license"
196 "-system-sqlite"
197 ;; explicitly link with openssl instead of dlopening it
198 "-openssl-linked"
199 ;; explicitly link with dbus instead of dlopening it
200 "-dbus-linked"
201 ;; drop special machine instructions not supported
202 ;; on all instances of the target
203 ,@(if (string-prefix? "x86_64"
204 (or (%current-target-system)
205 (%current-system)))
206 '()
207 '("-no-sse2"))
208 "-no-sse3"
209 "-no-ssse3"
210 "-no-sse4.1"
211 "-no-sse4.2"
212 "-no-avx"
213 "-no-avx2"
214 "-no-mips_dsp"
215 "-no-mips_dspr2"))))
216 %standard-phases)))
217 (home-page "http://qt-project.org/")
218 (synopsis "Cross-platform GUI library")
219 (description "Qt is a cross-platform application and UI framework for
220 developers using C++ or QML, a CSS & JavaScript like language.")
221 (license lgpl2.1)
222
223 ;; Qt 4: 'QBasicAtomicPointer' leads to build failures on MIPS;
224 ;; see <http://hydra.gnu.org/build/112828>.
225 ;; Qt 5: assembler error; see <http://hydra.gnu.org/build/112526>.
226 (supported-systems (delete "mips64el-linux" %supported-systems))))
227
228 (define-public qt-4
229 (package (inherit qt)
230 (version "4.8.7")
231 (source (origin
232 (method url-fetch)
233 (uri (string-append "http://download.qt-project.org/official_releases/qt/"
234 (string-copy version 0 (string-rindex version #\.))
235 "/" version
236 "/qt-everywhere-opensource-src-"
237 version ".tar.gz"))
238 (sha256
239 (base32
240 "183fca7n7439nlhxyg1z7aky0izgbyll3iwakw4gwivy16aj5272"))
241 (patches (map search-patch
242 '("qt4-ldflags.patch" "qt4-tests.patch")))))
243 (inputs `(,@(alist-delete "libjpeg" (package-inputs qt))
244 ("libjepg" ,libjpeg-8)
245 ("libsm" ,libsm)))
246
247 ;; Note: there are 37 MiB of examples and a '-exampledir' configure flags,
248 ;; but we can't make them a separate output because "out" and "examples"
249 ;; would refer to each other.
250 (outputs '("out" ;112MiB core + 37MiB examples
251 "doc")) ;280MiB of HTML + code
252 (arguments
253 `(#:phases
254 (modify-phases %standard-phases
255 (replace
256 'configure
257 (lambda* (#:key outputs #:allow-other-keys)
258 (let ((out (assoc-ref outputs "out"))
259 (doc (assoc-ref outputs "doc")))
260 (substitute* '("configure")
261 (("/bin/pwd") (which "pwd")))
262
263 (zero? (system*
264 "./configure"
265 "-verbose"
266 "-prefix" out
267 ;; Note: Don't pass '-docdir' since 'qmake' and
268 ;; libQtCore would record its value, thereby defeating
269 ;; the whole point of having a separate output.
270 "-datadir" (string-append out "/share/qt-" ,version
271 "/data")
272 "-importdir" (string-append out "/lib/qt-4"
273 "/imports")
274 "-plugindir" (string-append out "/lib/qt-4"
275 "/plugins")
276 "-translationdir" (string-append out "/share/qt-" ,version
277 "/translations")
278 "-demosdir" (string-append out "/share/qt-" ,version
279 "/demos")
280 "-examplesdir" (string-append out "/share/qt-" ,version
281 "/examples")
282 "-opensource"
283 "-confirm-license"
284 ;; explicitly link with dbus instead of dlopening it
285 "-dbus-linked"
286 ;; drop special machine instructions not supported
287 ;; on all instances of the target
288 ,@(if (string-prefix? "x86_64"
289 (or (%current-target-system)
290 (%current-system)))
291 '()
292 '("-no-mmx"
293 "-no-3dnow"
294 "-no-sse"
295 "-no-sse2"))
296 "-no-sse3"
297 "-no-ssse3"
298 "-no-sse4.1"
299 "-no-sse4.2"
300 "-no-avx")))))
301 (add-after
302 'install 'move-doc
303 (lambda* (#:key outputs #:allow-other-keys)
304 ;; Because of qt4-documentation-path.patch, documentation ends up
305 ;; being installed in OUT. Move it to the right place.
306 (let* ((out (assoc-ref outputs "out"))
307 (doc (assoc-ref outputs "doc"))
308 (olddoc (string-append out "/doc"))
309 (docdir (string-append doc "/share/doc/qt-" ,version)))
310 (mkdir-p (dirname docdir))
311
312 ;; Note: We can't use 'rename-file' here because OUT and DOC are
313 ;; different "devices" due to bind-mounts.
314 (copy-recursively olddoc docdir)
315 (delete-file-recursively olddoc)
316 #t))))))))
317
318 (define-public python-sip
319 (package
320 (name "python-sip")
321 (version "4.16.5")
322 (source
323 (origin
324 (method url-fetch)
325 (uri
326 (string-append "mirror://sourceforge/pyqt/sip/"
327 "sip-" version "/sip-"
328 version ".tar.gz"))
329 (sha256
330 (base32
331 "11qy1z88py2q7rz68rm7214pbd37538hpcbfj5hhzp5y616a62x0"))))
332 (build-system gnu-build-system)
333 (native-inputs
334 `(("python" ,python-wrapper)))
335 (arguments
336 `(#:tests? #f ; no check target
337 #:phases
338 (alist-replace
339 'configure
340 (lambda* (#:key inputs outputs #:allow-other-keys)
341 (let* ((out (assoc-ref outputs "out"))
342 (bin (string-append out "/bin"))
343 (include (string-append out "/include"))
344 (python-version
345 (string-take
346 (string-take-right (assoc-ref inputs "python") 5)
347 3))
348 (lib (string-append out "/lib/python"
349 python-version
350 "/site-packages")))
351 (zero?
352 (system* "python" "configure.py"
353 "--bindir" bin
354 "--destdir" lib
355 "--incdir" include))))
356 %standard-phases)))
357 (home-page "http://www.riverbankcomputing.com/software/sip/intro")
358 (synopsis "Python binding creator for C and C++ libraries")
359 (description
360 "SIP is a tool to create Python bindings for C and C++ libraries. It
361 was originally developed to create PyQt, the Python bindings for the Qt
362 toolkit, but can be used to create bindings for any C or C++ library.
363
364 SIP comprises a code generator and a Python module. The code generator
365 processes a set of specification files and generates C or C++ code, which
366 is then compiled to create the bindings extension module. The SIP Python
367 module provides support functions to the automatically generated code.")
368 ;; There is a choice between a python like license, gpl2 and gpl3.
369 ;; For compatibility with pyqt, we need gpl3.
370 (license gpl3)))
371
372 (define-public python2-sip
373 (package (inherit python-sip)
374 (name "python2-sip")
375 (native-inputs
376 `(("python" ,python-2)))))
377
378 (define-public python-pyqt
379 (package
380 (name "python-pyqt")
381 (version "5.4")
382 (source
383 (origin
384 (method url-fetch)
385 (uri
386 (string-append "mirror://sourceforge/pyqt/PyQt5/"
387 "PyQt-" version "/PyQt-gpl-"
388 version ".tar.gz"))
389 (sha256
390 (base32
391 "0cbpa63whi8a5akff4pcnfwzpzx7ycac2ynj00ly52m6zbsn80kn"))
392 (patches (list (search-patch "pyqt-configure.patch")))))
393 (build-system gnu-build-system)
394 (native-inputs
395 `(("python-sip" ,python-sip)
396 ("qt" ,qt))) ; for qmake
397 (inputs
398 `(("python" ,python-wrapper)))
399 (arguments
400 `(#:phases
401 (alist-replace
402 'configure
403 (lambda* (#:key inputs outputs #:allow-other-keys)
404 (let* ((out (assoc-ref outputs "out"))
405 (bin (string-append out "/bin"))
406 (sip (string-append out "/share/sip"))
407 (plugins (string-append out "/plugins"))
408 (designer (string-append plugins "/designer"))
409 (qml (string-append plugins "/PyQt5"))
410 (python-version
411 (string-take
412 (string-take-right (assoc-ref inputs "python") 5)
413 3))
414 (lib (string-append out "/lib/python"
415 python-version
416 "/site-packages")))
417 (zero? (system* "python" "configure.py"
418 "--confirm-license"
419 "--bindir" bin
420 "--destdir" lib
421 "--designer-plugindir" designer
422 "--qml-plugindir" qml
423 "--sipdir" sip))))
424 %standard-phases)))
425 (home-page "http://www.riverbankcomputing.com/software/pyqt/intro")
426 (synopsis "Python bindings for Qt")
427 (description
428 "PyQt is a set of Python v2 and v3 bindings for the Qt application
429 framework. The bindings are implemented as a set of Python modules and
430 contain over 620 classes.")
431 (license gpl3)))
432
433 (define-public python2-pyqt
434 (package (inherit python-pyqt)
435 (name "python2-pyqt")
436 (native-inputs
437 `(("python-sip" ,python2-sip)
438 ("qt" ,qt)))
439 (inputs
440 `(("python" ,python-2)))))
441
442 (define-public python-pyqt-4
443 (package (inherit python-pyqt)
444 (name "python-pyqt")
445 (version "4.11.3")
446 (source
447 (origin
448 (method url-fetch)
449 (uri
450 (string-append "mirror://sourceforge/pyqt/PyQt4/"
451 "PyQt-" version "/PyQt-x11-gpl-"
452 version ".tar.gz"))
453 (sha256
454 (base32
455 "11jnfjw79s0b0qdd9s6kd69w87vf16dhagbhbmwbmrp2vgf80dw5"))))
456 (native-inputs
457 `(("python-sip" ,python-sip)
458 ("qt" ,qt-4)))
459 (arguments
460 `(#:tests? #f ; no check target
461 #:phases
462 (alist-replace
463 'configure
464 (lambda* (#:key inputs outputs #:allow-other-keys)
465 (let* ((out (assoc-ref outputs "out"))
466 (bin (string-append out "/bin"))
467 (sip (string-append out "/share/sip"))
468 (python-version
469 (string-take
470 (string-take-right (assoc-ref inputs "python") 5)
471 3))
472 (lib (string-append out "/lib/python"
473 python-version
474 "/site-packages")))
475 (zero? (system* "python" "configure.py"
476 "--confirm-license"
477 "--bindir" bin
478 "--destdir" lib
479 "--sipdir" sip))))
480 %standard-phases)))
481 (license (list gpl2 gpl3)))) ; choice of either license
482
483 (define-public python2-pyqt-4
484 (package (inherit python-pyqt-4)
485 (name "python2-pyqt")
486 (native-inputs
487 `(("python-sip" ,python2-sip)
488 ("qt" ,qt-4)))
489 (inputs
490 `(("python" ,python-2)))))