gnu: qt: Update to 5.5.0.
[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 gtk)
41 #:use-module (gnu packages icu4c)
42 #:use-module (gnu packages image)
43 #:use-module (gnu packages linux)
44 #:use-module (gnu packages databases)
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.5.0")
99 (source (origin
100 (method url-fetch)
101 (uri
102 (string-append
103 "http://download.qt.io/official_releases/qt/"
104 (version-major+minor version)
105 "/" version
106 "/single/qt-everywhere-opensource-src-"
107 version ".tar.xz"))
108 (sha256
109 (base32
110 "1by2l8wxbqwvs7anb5ggmqhn2cfmhyw3a23bp1yyd240rdpa38ky"))
111 (patches (list (search-patch "qt5-runpath.patch")))))
112 (build-system gnu-build-system)
113 (propagated-inputs
114 `(("mesa" ,mesa)))
115 (inputs
116 `(("alsa-lib" ,alsa-lib)
117 ("dbus" ,dbus)
118 ("cups" ,cups)
119 ("expat" ,expat)
120 ("fontconfig" ,fontconfig)
121 ("freetype" ,freetype)
122 ("glib" ,glib)
123 ("harfbuzz" ,harfbuzz)
124 ("icu4c" ,icu4c)
125 ("libjpeg" ,libjpeg)
126 ("libmng" ,libmng)
127 ("libpci" ,pciutils)
128 ("libpng" ,libpng)
129 ("libx11" ,libx11)
130 ("libxcomposite" ,libxcomposite)
131 ("libxcursor" ,libxcursor)
132 ("libxfixes" ,libxfixes)
133 ("libxi" ,libxi)
134 ("libxinerama" ,libxinerama)
135 ("libxkbcommon" ,libxkbcommon)
136 ("libxml2" ,libxml2)
137 ("libxrandr" ,libxrandr)
138 ("libxrender" ,libxrender)
139 ("libxslt" ,libxslt)
140 ("libxtst" ,libxtst)
141 ("mtdev" ,mtdev)
142 ("mysql" ,mysql)
143 ("nss" ,nss)
144 ("openssl" ,openssl)
145 ("postgresql" ,postgresql)
146 ("pulseaudio" ,pulseaudio)
147 ("pcre" ,pcre)
148 ("sqlite" ,sqlite)
149 ("udev" ,eudev)
150 ("unixodbc" ,unixodbc)
151 ("xcb-util" ,xcb-util)
152 ("xcb-util-image" ,xcb-util-image)
153 ("xcb-util-keysyms" ,xcb-util-keysyms)
154 ("xcb-util-renderutil" ,xcb-util-renderutil)
155 ("xcb-util-wm" ,xcb-util-wm)
156 ("zlib" ,zlib)))
157 (native-inputs
158 `(("bison" ,bison)
159 ("flex" ,flex)
160 ("gperf" ,gperf)
161 ;; Ninja is only needed for the disabled qtwebengine
162 ;; ("ninja" ,ninja)
163 ("perl" ,perl)
164 ("pkg-config" ,pkg-config)
165 ("python" ,python-2)
166 ("ruby" ,ruby)
167 ("which" ,(@ (gnu packages base) which))))
168 (arguments
169 `(#:phases
170 (alist-replace
171 'configure
172 (lambda* (#:key outputs #:allow-other-keys)
173 (let ((out (assoc-ref outputs "out")))
174 (substitute* '("configure" "qtbase/configure")
175 (("/bin/pwd") (which "pwd")))
176 (substitute* "qtbase/src/corelib/global/global.pri"
177 (("/bin/ls") (which "ls")))
178 ;; commented out since qtwebengine is not built, but left in
179 ;; for reference
180 ;; (substitute* "qtwebengine/src/3rdparty/chromium/build/common.gypi"
181 ;; (("/bin/echo") (which "echo")))
182 ;; (substitute* "qtwebengine/src/3rdparty/chromium/third_party/\
183 ;; WebKit/Source/build/scripts/scripts.gypi"
184 ;; (("/usr/bin/gcc") (which "gcc")))
185 ;; (setenv "NINJA_PATH" (which "ninja"))
186 ;; do not pass "--enable-fast-install", which makes the
187 ;; configure process fail
188 (zero? (system*
189 "./configure"
190 "-verbose"
191 "-prefix" out
192 "-opensource"
193 "-confirm-license"
194 "-system-sqlite"
195 ;; explicitly link with openssl instead of dlopening it
196 "-openssl-linked"
197 ;; explicitly link with dbus instead of dlopening it
198 "-dbus-linked"
199 ;; drop chromium module (qtwebengine); it fails
200 ;; compilation in qt 5.5:
201 ;; 3rdparty/chromium/ui/gfx/codec/jpeg_codec.cc:362:10:
202 ;; error: cannot convert ‘bool’ to ‘boolean’ in return
203 ;; and might pose security problems.
204 "-skip" "qtwebengine"
205 ;; drop special machine instructions not supported
206 ;; on all instances of the target
207 ,@(if (string-prefix? "x86_64"
208 (or (%current-target-system)
209 (%current-system)))
210 '()
211 '("-no-sse2"))
212 "-no-sse3"
213 "-no-ssse3"
214 "-no-sse4.1"
215 "-no-sse4.2"
216 "-no-avx"
217 "-no-avx2"
218 "-no-mips_dsp"
219 "-no-mips_dspr2"))))
220 %standard-phases)))
221 (home-page "http://qt-project.org/")
222 (synopsis "Cross-platform GUI library")
223 (description "Qt is a cross-platform application and UI framework for
224 developers using C++ or QML, a CSS & JavaScript like language.")
225 (license lgpl2.1)
226
227 ;; Qt 4: 'QBasicAtomicPointer' leads to build failures on MIPS;
228 ;; see <http://hydra.gnu.org/build/112828>.
229 ;; Qt 5: assembler error; see <http://hydra.gnu.org/build/112526>.
230 (supported-systems (delete "mips64el-linux" %supported-systems))))
231
232 (define-public qt-4
233 (package (inherit qt)
234 (version "4.8.7")
235 (source (origin
236 (method url-fetch)
237 (uri (string-append "http://download.qt-project.org/official_releases/qt/"
238 (string-copy version 0 (string-rindex version #\.))
239 "/" version
240 "/qt-everywhere-opensource-src-"
241 version ".tar.gz"))
242 (sha256
243 (base32
244 "183fca7n7439nlhxyg1z7aky0izgbyll3iwakw4gwivy16aj5272"))
245 (patches (map search-patch
246 '("qt4-ldflags.patch" "qt4-tests.patch")))))
247 (inputs `(,@(alist-delete "harfbuzz"
248 (alist-delete "libjpeg" (package-inputs qt)))
249 ("libjepg" ,libjpeg-8)
250 ("libsm" ,libsm)))
251
252 ;; Note: there are 37 MiB of examples and a '-exampledir' configure flags,
253 ;; but we can't make them a separate output because "out" and "examples"
254 ;; would refer to each other.
255 (outputs '("out" ;112MiB core + 37MiB examples
256 "doc")) ;280MiB of HTML + code
257 (arguments
258 `(#:phases
259 (modify-phases %standard-phases
260 (replace
261 'configure
262 (lambda* (#:key outputs #:allow-other-keys)
263 (let ((out (assoc-ref outputs "out"))
264 (doc (assoc-ref outputs "doc")))
265 (substitute* '("configure")
266 (("/bin/pwd") (which "pwd")))
267
268 (zero? (system*
269 "./configure"
270 "-verbose"
271 "-prefix" out
272 ;; Note: Don't pass '-docdir' since 'qmake' and
273 ;; libQtCore would record its value, thereby defeating
274 ;; the whole point of having a separate output.
275 "-datadir" (string-append out "/share/qt-" ,version
276 "/data")
277 "-importdir" (string-append out "/lib/qt-4"
278 "/imports")
279 "-plugindir" (string-append out "/lib/qt-4"
280 "/plugins")
281 "-translationdir" (string-append out "/share/qt-" ,version
282 "/translations")
283 "-demosdir" (string-append out "/share/qt-" ,version
284 "/demos")
285 "-examplesdir" (string-append out "/share/qt-" ,version
286 "/examples")
287 "-opensource"
288 "-confirm-license"
289 ;; explicitly link with dbus instead of dlopening it
290 "-dbus-linked"
291 ;; drop special machine instructions not supported
292 ;; on all instances of the target
293 ,@(if (string-prefix? "x86_64"
294 (or (%current-target-system)
295 (%current-system)))
296 '()
297 '("-no-mmx"
298 "-no-3dnow"
299 "-no-sse"
300 "-no-sse2"))
301 "-no-sse3"
302 "-no-ssse3"
303 "-no-sse4.1"
304 "-no-sse4.2"
305 "-no-avx")))))
306 (add-after
307 'install 'move-doc
308 (lambda* (#:key outputs #:allow-other-keys)
309 ;; Because of qt4-documentation-path.patch, documentation ends up
310 ;; being installed in OUT. Move it to the right place.
311 (let* ((out (assoc-ref outputs "out"))
312 (doc (assoc-ref outputs "doc"))
313 (olddoc (string-append out "/doc"))
314 (docdir (string-append doc "/share/doc/qt-" ,version)))
315 (mkdir-p (dirname docdir))
316
317 ;; Note: We can't use 'rename-file' here because OUT and DOC are
318 ;; different "devices" due to bind-mounts.
319 (copy-recursively olddoc docdir)
320 (delete-file-recursively olddoc)
321 #t))))))))
322
323 (define-public python-sip
324 (package
325 (name "python-sip")
326 (version "4.16.5")
327 (source
328 (origin
329 (method url-fetch)
330 (uri
331 (string-append "mirror://sourceforge/pyqt/sip/"
332 "sip-" version "/sip-"
333 version ".tar.gz"))
334 (sha256
335 (base32
336 "11qy1z88py2q7rz68rm7214pbd37538hpcbfj5hhzp5y616a62x0"))))
337 (build-system gnu-build-system)
338 (native-inputs
339 `(("python" ,python-wrapper)))
340 (arguments
341 `(#:tests? #f ; no check target
342 #:phases
343 (alist-replace
344 'configure
345 (lambda* (#:key inputs outputs #:allow-other-keys)
346 (let* ((out (assoc-ref outputs "out"))
347 (bin (string-append out "/bin"))
348 (include (string-append out "/include"))
349 (python-version
350 (string-take
351 (string-take-right (assoc-ref inputs "python") 5)
352 3))
353 (lib (string-append out "/lib/python"
354 python-version
355 "/site-packages")))
356 (zero?
357 (system* "python" "configure.py"
358 "--bindir" bin
359 "--destdir" lib
360 "--incdir" include))))
361 %standard-phases)))
362 (home-page "http://www.riverbankcomputing.com/software/sip/intro")
363 (synopsis "Python binding creator for C and C++ libraries")
364 (description
365 "SIP is a tool to create Python bindings for C and C++ libraries. It
366 was originally developed to create PyQt, the Python bindings for the Qt
367 toolkit, but can be used to create bindings for any C or C++ library.
368
369 SIP comprises a code generator and a Python module. The code generator
370 processes a set of specification files and generates C or C++ code, which
371 is then compiled to create the bindings extension module. The SIP Python
372 module provides support functions to the automatically generated code.")
373 ;; There is a choice between a python like license, gpl2 and gpl3.
374 ;; For compatibility with pyqt, we need gpl3.
375 (license gpl3)))
376
377 (define-public python2-sip
378 (package (inherit python-sip)
379 (name "python2-sip")
380 (native-inputs
381 `(("python" ,python-2)))))
382
383 (define-public python-pyqt
384 (package
385 (name "python-pyqt")
386 (version "5.4")
387 (source
388 (origin
389 (method url-fetch)
390 (uri
391 (string-append "mirror://sourceforge/pyqt/PyQt5/"
392 "PyQt-" version "/PyQt-gpl-"
393 version ".tar.gz"))
394 (sha256
395 (base32
396 "0cbpa63whi8a5akff4pcnfwzpzx7ycac2ynj00ly52m6zbsn80kn"))
397 (patches (list (search-patch "pyqt-configure.patch")))))
398 (build-system gnu-build-system)
399 (native-inputs
400 `(("python-sip" ,python-sip)
401 ("qt" ,qt))) ; for qmake
402 (inputs
403 `(("python" ,python-wrapper)))
404 (arguments
405 `(#:phases
406 (alist-replace
407 'configure
408 (lambda* (#:key inputs outputs #:allow-other-keys)
409 (let* ((out (assoc-ref outputs "out"))
410 (bin (string-append out "/bin"))
411 (sip (string-append out "/share/sip"))
412 (plugins (string-append out "/plugins"))
413 (designer (string-append plugins "/designer"))
414 (qml (string-append plugins "/PyQt5"))
415 (python-version
416 (string-take
417 (string-take-right (assoc-ref inputs "python") 5)
418 3))
419 (lib (string-append out "/lib/python"
420 python-version
421 "/site-packages")))
422 (zero? (system* "python" "configure.py"
423 "--confirm-license"
424 "--bindir" bin
425 "--destdir" lib
426 "--designer-plugindir" designer
427 "--qml-plugindir" qml
428 "--sipdir" sip))))
429 %standard-phases)))
430 (home-page "http://www.riverbankcomputing.com/software/pyqt/intro")
431 (synopsis "Python bindings for Qt")
432 (description
433 "PyQt is a set of Python v2 and v3 bindings for the Qt application
434 framework. The bindings are implemented as a set of Python modules and
435 contain over 620 classes.")
436 (license gpl3)))
437
438 (define-public python2-pyqt
439 (package (inherit python-pyqt)
440 (name "python2-pyqt")
441 (native-inputs
442 `(("python-sip" ,python2-sip)
443 ("qt" ,qt)))
444 (inputs
445 `(("python" ,python-2)))))
446
447 (define-public python-pyqt-4
448 (package (inherit python-pyqt)
449 (name "python-pyqt")
450 (version "4.11.3")
451 (source
452 (origin
453 (method url-fetch)
454 (uri
455 (string-append "mirror://sourceforge/pyqt/PyQt4/"
456 "PyQt-" version "/PyQt-x11-gpl-"
457 version ".tar.gz"))
458 (sha256
459 (base32
460 "11jnfjw79s0b0qdd9s6kd69w87vf16dhagbhbmwbmrp2vgf80dw5"))))
461 (native-inputs
462 `(("python-sip" ,python-sip)
463 ("qt" ,qt-4)))
464 (arguments
465 `(#:tests? #f ; no check target
466 #:phases
467 (alist-replace
468 'configure
469 (lambda* (#:key inputs outputs #:allow-other-keys)
470 (let* ((out (assoc-ref outputs "out"))
471 (bin (string-append out "/bin"))
472 (sip (string-append out "/share/sip"))
473 (python-version
474 (string-take
475 (string-take-right (assoc-ref inputs "python") 5)
476 3))
477 (lib (string-append out "/lib/python"
478 python-version
479 "/site-packages")))
480 (zero? (system* "python" "configure.py"
481 "--confirm-license"
482 "--bindir" bin
483 "--destdir" lib
484 "--sipdir" sip))))
485 %standard-phases)))
486 (license (list gpl2 gpl3)))) ; choice of either license
487
488 (define-public python2-pyqt-4
489 (package (inherit python-pyqt-4)
490 (name "python2-pyqt")
491 (native-inputs
492 `(("python-sip" ,python2-sip)
493 ("qt" ,qt-4)))
494 (inputs
495 `(("python" ,python-2)))))