gnu: qt: On armhf, enable use of NEON.
[jackhill/guix/guix.git] / gnu / packages / qt.scm
CommitLineData
bd677c2d 1;;; GNU Guix --- Functional package management for GNU
84ef83dd 2;;; Copyright © 2013, 2014, 2015 Andreas Enge <andreas@enge.fr>
5b490ab5 3;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com>
31580979 4;;; Copyright © 2015 Ludovic Courtès <ludo@gnu.org>
bd677c2d
AE
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)
3e291958 22 #:use-module ((guix licenses) #:select (gpl2 gpl3 lgpl2.1 x11-style))
bd677c2d
AE
23 #:use-module (guix packages)
24 #:use-module (guix download)
f198ffd0 25 #:use-module (guix build utils)
bd677c2d 26 #:use-module (guix build-system gnu)
84ef83dd
AE
27 #:use-module (guix packages)
28 #:use-module (guix utils)
1e9ed0e3 29 #:use-module (gnu packages)
b332e366
AE
30 #:use-module (gnu packages bison)
31 #:use-module (gnu packages compression)
2cba3d6f
SB
32 #:use-module (gnu packages cups)
33 #:use-module (gnu packages databases)
b332e366 34 #:use-module (gnu packages fontutils)
0009ed71 35 #:use-module (gnu packages flex)
8b6a5e0f 36 #:use-module (gnu packages gl)
b332e366 37 #:use-module (gnu packages glib)
0009ed71
SB
38 #:use-module (gnu packages gnuzilla)
39 #:use-module (gnu packages gperf)
b332e366 40 #:use-module (gnu packages icu4c)
e55354b8 41 #:use-module (gnu packages image)
b332e366 42 #:use-module (gnu packages linux)
5f96f303 43 #:use-module (gnu packages databases)
0009ed71 44 #:use-module (gnu packages ninja)
0009ed71
SB
45 #:use-module (gnu packages pciutils)
46 #:use-module (gnu packages pcre)
b332e366
AE
47 #:use-module (gnu packages perl)
48 #:use-module (gnu packages pkg-config)
39fa8f6c 49 #:use-module (gnu packages pulseaudio)
b332e366 50 #:use-module (gnu packages python)
8b6a5e0f 51 #:use-module (gnu packages ruby)
cc2b77df 52 #:use-module (gnu packages tls)
0009ed71
SB
53 #:use-module (gnu packages xdisorg)
54 #:use-module (gnu packages xorg)
55 #:use-module (gnu packages xml))
bd677c2d
AE
56
57(define-public libxkbcommon
58 (package
59 (name "libxkbcommon")
ff53457d 60 (version "0.5.0")
bd677c2d
AE
61 (source (origin
62 (method url-fetch)
63 (uri (string-append "http://xkbcommon.org/download/" name "-"
64 version ".tar.xz"))
65 (sha256
66 (base32
ff53457d 67 "176ii5dn2wh74q48sd8ac37ljlvgvp5f506glr96z6ibfhj7igch"))))
bd677c2d 68 (build-system gnu-build-system)
ff53457d 69 (inputs
5dee80dd
AE
70 `(("libx11" ,libx11)
71 ("libxcb" ,libxcb)
72 ("xkeyboard-config" ,xkeyboard-config)))
c4c4cc05 73 (native-inputs
ff53457d
AE
74 `(("bison" ,bison)
75 ("pkg-config" ,pkg-config)))
5dee80dd
AE
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"))))
bd677c2d 84 (home-page "http://xkbcommon.org/")
35b9e423 85 (synopsis "Library to handle keyboard descriptions")
bd677c2d
AE
86 (description "Xkbcommon is a library to handle keyboard descriptions,
87including loading them from disk, parsing them and handling their
88state. It is mainly meant for client toolkits, window systems, and other
89system applications; currently that includes Wayland, kmscon, GTK+, Qt,
90Clutter, and more. Despite the name, it is not currently used by anything
91X11 (yet).")
92 (license (x11-style "file://COPYING"
93 "See 'COPYING' in the distribution."))))
b332e366
AE
94
95(define-public qt
96 (package
97 (name "qt")
a33b8449 98 (version "5.4.2")
b332e366
AE
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-"
f198ffd0 105 version ".tar.xz"))
b332e366
AE
106 (sha256
107 (base32
a33b8449 108 "09gay5cimfdb0apy60v7z4r4zkl2vjysdppzihpla8dp2c30fvcc"))
9e63a388
TUBK
109 (patches (list (search-patch "qt5-conflicting-typedefs.patch")
110 (search-patch "qt5-runpath.patch")))
5b490ab5
SB
111 (snippet
112 '(begin
113 ;; Remove broken symlinks.
114 (delete-file "qtwebengine/src/3rdparty/chromium/third_party/\
115mesa/src/src/gallium/state_trackers/d3d1x/w32api")
116 (delete-file "qtwebengine/src/3rdparty/chromium/third_party/\
117webrtc/tools/e2e_quality/audio/perf")))))
b332e366 118 (build-system gnu-build-system)
ef0cf53e
AE
119 (propagated-inputs
120 `(("mesa" ,mesa)))
b332e366 121 (inputs
b332e366
AE
122 `(("alsa-lib" ,alsa-lib)
123 ("dbus" ,dbus)
2cba3d6f 124 ("cups" ,cups)
0009ed71 125 ("expat" ,expat)
b332e366
AE
126 ("fontconfig" ,fontconfig)
127 ("freetype" ,freetype)
128 ("glib" ,glib)
129 ("icu4c" ,icu4c)
f198ffd0 130 ("libjpeg" ,libjpeg)
2cba3d6f 131 ("libmng" ,libmng)
0009ed71 132 ("libpci" ,pciutils)
b332e366
AE
133 ("libpng" ,libpng)
134 ("libx11" ,libx11)
0009ed71
SB
135 ("libxcomposite" ,libxcomposite)
136 ("libxcursor" ,libxcursor)
137 ("libxfixes" ,libxfixes)
b332e366 138 ("libxi" ,libxi)
0009ed71 139 ("libxinerama" ,libxinerama)
b332e366 140 ("libxkbcommon" ,libxkbcommon)
0009ed71
SB
141 ("libxml2" ,libxml2)
142 ("libxrandr" ,libxrandr)
b332e366 143 ("libxrender" ,libxrender)
0009ed71
SB
144 ("libxslt" ,libxslt)
145 ("libxtst" ,libxtst)
146 ("mtdev" ,mtdev)
b332e366 147 ("mysql" ,mysql)
0009ed71 148 ("nss" ,nss)
b332e366 149 ("openssl" ,openssl)
2cba3d6f 150 ("postgresql" ,postgresql)
39fa8f6c 151 ("pulseaudio" ,pulseaudio)
0009ed71
SB
152 ("pcre" ,pcre)
153 ("sqlite" ,sqlite)
154 ("udev" ,eudev)
2cba3d6f 155 ("unixodbc" ,unixodbc)
b332e366
AE
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)))
c4c4cc05 162 (native-inputs
0009ed71
SB
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)
ce0614dd 171 ("which" ,(@ (gnu packages base) which))))
b332e366
AE
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")
5b490ab5
SB
179 (("/bin/pwd") (which "pwd")))
180 (substitute* "qtbase/src/corelib/global/global.pri"
181 (("/bin/ls") (which "ls")))
0009ed71
SB
182 (substitute* "qtwebengine/src/3rdparty/chromium/build/common.gypi"
183 (("/bin/echo") (which "echo")))
184 (substitute* "qtwebengine/src/3rdparty/chromium/third_party/\
185WebKit/Source/build/scripts/scripts.gypi"
186 (("/usr/bin/gcc") (which "gcc")))
187 (setenv "NINJA_PATH" (which "ninja"))
b332e366
AE
188 ;; do not pass "--enable-fast-install", which makes the
189 ;; configure process fail
206a5208
AE
190 (zero? (system*
191 "./configure"
192 "-verbose"
193 "-prefix" out
194 "-opensource"
195 "-confirm-license"
0009ed71
SB
196 "-system-sqlite"
197 ;; explicitly link with openssl instead of dlopening it
198 "-openssl-linked"
ff0a8c59
AE
199 ;; explicitly link with dbus instead of dlopening it
200 "-dbus-linked"
206a5208
AE
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"
206a5208
AE
214 "-no-mips_dsp"
215 "-no-mips_dspr2"))))
b332e366
AE
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
220developers using C++ or QML, a CSS & JavaScript like language.")
f47638a3
LC
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))))
1e9ed0e3
AE
227
228(define-public qt-4
229 (package (inherit qt)
d22b9397 230 (version "4.8.7")
1e9ed0e3
AE
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
89059aa1 236 "/qt-everywhere-opensource-src-"
1e9ed0e3
AE
237 version ".tar.gz"))
238 (sha256
239 (base32
d22b9397 240 "183fca7n7439nlhxyg1z7aky0izgbyll3iwakw4gwivy16aj5272"))
d2984346
LC
241 (patches (map search-patch
242 '("qt4-ldflags.patch" "qt4-tests.patch")))))
f198ffd0 243 (inputs `(,@(alist-delete "libjpeg" (package-inputs qt))
e7e5a4f8
AE
244 ("libjepg" ,libjpeg-8)
245 ("libsm" ,libsm)))
31580979
LC
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
1e9ed0e3
AE
252 (arguments
253 `(#:phases
cba632c4
LC
254 (modify-phases %standard-phases
255 (replace
1e9ed0e3
AE
256 'configure
257 (lambda* (#:key outputs #:allow-other-keys)
31580979
LC
258 (let ((out (assoc-ref outputs "out"))
259 (doc (assoc-ref outputs "doc")))
1e9ed0e3 260 (substitute* '("configure")
d2984346
LC
261 (("/bin/pwd") (which "pwd")))
262
206a5208
AE
263 (zero? (system*
264 "./configure"
265 "-verbose"
266 "-prefix" out
4b0f2ef7
LC
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.
ff1989a5
LC
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")
31580979
LC
278 "-demosdir" (string-append out "/share/qt-" ,version
279 "/demos")
280 "-examplesdir" (string-append out "/share/qt-" ,version
281 "/examples")
206a5208
AE
282 "-opensource"
283 "-confirm-license"
ff0a8c59
AE
284 ;; explicitly link with dbus instead of dlopening it
285 "-dbus-linked"
206a5208
AE
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"
1e9ed0e3
AE
293 "-no-3dnow"
294 "-no-sse"
206a5208
AE
295 "-no-sse2"))
296 "-no-sse3"
297 "-no-ssse3"
298 "-no-sse4.1"
299 "-no-sse4.2"
84811c22 300 "-no-avx")))))
4b0f2ef7
LC
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))))))))
84ef83dd
AE
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
361was originally developed to create PyQt, the Python bindings for the Qt
362toolkit, but can be used to create bindings for any C or C++ library.
363
364SIP comprises a code generator and a Python module. The code generator
365processes a set of specification files and generates C or C++ code, which
366is then compiled to create the bindings extension module. The SIP Python
367module 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)))))
014e7dd8
AE
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
429framework. The bindings are implemented as a set of Python modules and
430contain 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)))))
3e291958
AE
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)))))