gnu: Add emacs-helm.
[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>
65e46ca0 5;;; Copyright © 2015, 2016 Efraim Flashner <efraim@flashner.co.il>
bd677c2d
AE
6;;;
7;;; This file is part of GNU Guix.
8;;;
9;;; GNU Guix is free software; you can redistribute it and/or modify it
10;;; under the terms of the GNU General Public License as published by
11;;; the Free Software Foundation; either version 3 of the License, or (at
12;;; your option) any later version.
13;;;
14;;; GNU Guix is distributed in the hope that it will be useful, but
15;;; WITHOUT ANY WARRANTY; without even the implied warranty of
16;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17;;; GNU General Public License for more details.
18;;;
19;;; You should have received a copy of the GNU General Public License
20;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
21
22(define-module (gnu packages qt)
dbbb45dd 23 #:use-module ((guix licenses) #:select (bsd-3 gpl2 gpl3 lgpl2.1 lgpl2.1+ x11-style))
bd677c2d
AE
24 #:use-module (guix packages)
25 #:use-module (guix download)
f198ffd0 26 #:use-module (guix build utils)
9e81af9e 27 #:use-module (guix build-system cmake)
bd677c2d 28 #:use-module (guix build-system gnu)
84ef83dd
AE
29 #:use-module (guix packages)
30 #:use-module (guix utils)
1e9ed0e3 31 #:use-module (gnu packages)
b332e366
AE
32 #:use-module (gnu packages bison)
33 #:use-module (gnu packages compression)
2cba3d6f
SB
34 #:use-module (gnu packages cups)
35 #:use-module (gnu packages databases)
b332e366 36 #:use-module (gnu packages fontutils)
0009ed71 37 #:use-module (gnu packages flex)
8b6a5e0f 38 #:use-module (gnu packages gl)
b332e366 39 #:use-module (gnu packages glib)
0009ed71
SB
40 #:use-module (gnu packages gnuzilla)
41 #:use-module (gnu packages gperf)
f7fb0ccb 42 #:use-module (gnu packages gtk)
b332e366 43 #:use-module (gnu packages icu4c)
e55354b8 44 #:use-module (gnu packages image)
b332e366 45 #:use-module (gnu packages linux)
5f96f303 46 #:use-module (gnu packages databases)
0009ed71
SB
47 #:use-module (gnu packages pciutils)
48 #:use-module (gnu packages pcre)
b332e366
AE
49 #:use-module (gnu packages perl)
50 #:use-module (gnu packages pkg-config)
39fa8f6c 51 #:use-module (gnu packages pulseaudio)
b332e366 52 #:use-module (gnu packages python)
8b6a5e0f 53 #:use-module (gnu packages ruby)
cc2b77df 54 #:use-module (gnu packages tls)
0009ed71
SB
55 #:use-module (gnu packages xdisorg)
56 #:use-module (gnu packages xorg)
57 #:use-module (gnu packages xml))
bd677c2d 58
b332e366
AE
59(define-public qt
60 (package
61 (name "qt")
a10d3a68 62 (version "5.5.1")
b332e366
AE
63 (source (origin
64 (method url-fetch)
f7fb0ccb
AE
65 (uri
66 (string-append
67 "http://download.qt.io/official_releases/qt/"
68 (version-major+minor version)
69 "/" version
70 "/single/qt-everywhere-opensource-src-"
71 version ".tar.xz"))
b332e366 72 (sha256
f7fb0ccb 73 (base32
a10d3a68 74 "0615cn4n3n78v48lnmapqz2jizm2pzrjwvsjlnsf4awrsiiqw0kg"))
14bcc1e1
AE
75 (modules '((guix build utils)))
76 (snippet
bc554b43
AE
77 '(begin
78 ;; Remove qtwebengine, which relies on a bundled copy of
79 ;; chromium. Not only does it fail compilation in qt 5.5:
80 ;; 3rdparty/chromium/ui/gfx/codec/jpeg_codec.cc:362:10:
81 ;; error: cannot convert ‘bool’ to ‘boolean’ in return
82 ;; it might also pose security problems.
83 ;; Alternatively, we could use the "-skip qtwebengine"
84 ;; configuration option.
85 (delete-file-recursively "qtwebengine")
86 ;; Remove one of the two bundled harfbuzz copies in addition
87 ;; to passing "-system-harfbuzz".
9c32e1fe
AE
88 (delete-file-recursively "qtbase/src/3rdparty/harfbuzz-ng")
89 ;; Remove the bundled sqlite copy in addition to
90 ;; passing "-system-sqlite".
91 (delete-file-recursively "qtbase/src/3rdparty/sqlite")))))
b332e366 92 (build-system gnu-build-system)
ef0cf53e
AE
93 (propagated-inputs
94 `(("mesa" ,mesa)))
b332e366 95 (inputs
b332e366
AE
96 `(("alsa-lib" ,alsa-lib)
97 ("dbus" ,dbus)
2cba3d6f 98 ("cups" ,cups)
0009ed71 99 ("expat" ,expat)
b332e366
AE
100 ("fontconfig" ,fontconfig)
101 ("freetype" ,freetype)
102 ("glib" ,glib)
f7fb0ccb 103 ("harfbuzz" ,harfbuzz)
b332e366 104 ("icu4c" ,icu4c)
f198ffd0 105 ("libjpeg" ,libjpeg)
2cba3d6f 106 ("libmng" ,libmng)
0009ed71 107 ("libpci" ,pciutils)
b332e366
AE
108 ("libpng" ,libpng)
109 ("libx11" ,libx11)
0009ed71
SB
110 ("libxcomposite" ,libxcomposite)
111 ("libxcursor" ,libxcursor)
112 ("libxfixes" ,libxfixes)
b332e366 113 ("libxi" ,libxi)
0009ed71 114 ("libxinerama" ,libxinerama)
b332e366 115 ("libxkbcommon" ,libxkbcommon)
0009ed71
SB
116 ("libxml2" ,libxml2)
117 ("libxrandr" ,libxrandr)
b332e366 118 ("libxrender" ,libxrender)
0009ed71
SB
119 ("libxslt" ,libxslt)
120 ("libxtst" ,libxtst)
121 ("mtdev" ,mtdev)
b332e366 122 ("mysql" ,mysql)
0009ed71 123 ("nss" ,nss)
b332e366 124 ("openssl" ,openssl)
2cba3d6f 125 ("postgresql" ,postgresql)
39fa8f6c 126 ("pulseaudio" ,pulseaudio)
0009ed71
SB
127 ("pcre" ,pcre)
128 ("sqlite" ,sqlite)
129 ("udev" ,eudev)
2cba3d6f 130 ("unixodbc" ,unixodbc)
b332e366
AE
131 ("xcb-util" ,xcb-util)
132 ("xcb-util-image" ,xcb-util-image)
133 ("xcb-util-keysyms" ,xcb-util-keysyms)
134 ("xcb-util-renderutil" ,xcb-util-renderutil)
135 ("xcb-util-wm" ,xcb-util-wm)
136 ("zlib" ,zlib)))
c4c4cc05 137 (native-inputs
0009ed71
SB
138 `(("bison" ,bison)
139 ("flex" ,flex)
140 ("gperf" ,gperf)
0009ed71
SB
141 ("perl" ,perl)
142 ("pkg-config" ,pkg-config)
143 ("python" ,python-2)
144 ("ruby" ,ruby)
ce0614dd 145 ("which" ,(@ (gnu packages base) which))))
b332e366 146 (arguments
46854e99
AE
147 `(;; FIXME: Disabling parallel building is a quick hack to avoid the
148 ;; failure described in
149 ;; https://lists.gnu.org/archive/html/guix-devel/2016-01/msg00837.html
150 ;; A more structural fix is needed.
151 #:parallel-build? #f
152 #:phases
b332e366
AE
153 (alist-replace
154 'configure
155 (lambda* (#:key outputs #:allow-other-keys)
156 (let ((out (assoc-ref outputs "out")))
157 (substitute* '("configure" "qtbase/configure")
5b490ab5
SB
158 (("/bin/pwd") (which "pwd")))
159 (substitute* "qtbase/src/corelib/global/global.pri"
160 (("/bin/ls") (which "ls")))
b332e366
AE
161 ;; do not pass "--enable-fast-install", which makes the
162 ;; configure process fail
206a5208
AE
163 (zero? (system*
164 "./configure"
165 "-verbose"
166 "-prefix" out
167 "-opensource"
168 "-confirm-license"
bc554b43
AE
169 ;; Most "-system-..." are automatic, but some use
170 ;; the bundled copy by default.
0009ed71 171 "-system-sqlite"
bc554b43 172 "-system-harfbuzz"
0009ed71
SB
173 ;; explicitly link with openssl instead of dlopening it
174 "-openssl-linked"
ff0a8c59
AE
175 ;; explicitly link with dbus instead of dlopening it
176 "-dbus-linked"
206a5208
AE
177 ;; drop special machine instructions not supported
178 ;; on all instances of the target
179 ,@(if (string-prefix? "x86_64"
180 (or (%current-target-system)
181 (%current-system)))
182 '()
183 '("-no-sse2"))
184 "-no-sse3"
185 "-no-ssse3"
186 "-no-sse4.1"
187 "-no-sse4.2"
188 "-no-avx"
189 "-no-avx2"
206a5208
AE
190 "-no-mips_dsp"
191 "-no-mips_dspr2"))))
b332e366
AE
192 %standard-phases)))
193 (home-page "http://qt-project.org/")
194 (synopsis "Cross-platform GUI library")
195 (description "Qt is a cross-platform application and UI framework for
196developers using C++ or QML, a CSS & JavaScript like language.")
f47638a3
LC
197 (license lgpl2.1)
198
199 ;; Qt 4: 'QBasicAtomicPointer' leads to build failures on MIPS;
200 ;; see <http://hydra.gnu.org/build/112828>.
201 ;; Qt 5: assembler error; see <http://hydra.gnu.org/build/112526>.
202 (supported-systems (delete "mips64el-linux" %supported-systems))))
1e9ed0e3
AE
203
204(define-public qt-4
205 (package (inherit qt)
d22b9397 206 (version "4.8.7")
1e9ed0e3
AE
207 (source (origin
208 (method url-fetch)
209 (uri (string-append "http://download.qt-project.org/official_releases/qt/"
210 (string-copy version 0 (string-rindex version #\.))
211 "/" version
89059aa1 212 "/qt-everywhere-opensource-src-"
1e9ed0e3
AE
213 version ".tar.gz"))
214 (sha256
215 (base32
d22b9397 216 "183fca7n7439nlhxyg1z7aky0izgbyll3iwakw4gwivy16aj5272"))
fc1adab1 217 (patches (search-patches "qt4-ldflags.patch"))
7431edea
AE
218 (modules '((guix build utils)))
219 (snippet
220 ;; Remove webkit module, which is not built.
221 '(delete-file-recursively "src/3rdparty/webkit"))))
f7fb0ccb
AE
222 (inputs `(,@(alist-delete "harfbuzz"
223 (alist-delete "libjpeg" (package-inputs qt)))
e7e5a4f8
AE
224 ("libjepg" ,libjpeg-8)
225 ("libsm" ,libsm)))
31580979
LC
226
227 ;; Note: there are 37 MiB of examples and a '-exampledir' configure flags,
228 ;; but we can't make them a separate output because "out" and "examples"
229 ;; would refer to each other.
230 (outputs '("out" ;112MiB core + 37MiB examples
231 "doc")) ;280MiB of HTML + code
1e9ed0e3
AE
232 (arguments
233 `(#:phases
cba632c4
LC
234 (modify-phases %standard-phases
235 (replace
1e9ed0e3
AE
236 'configure
237 (lambda* (#:key outputs #:allow-other-keys)
31580979
LC
238 (let ((out (assoc-ref outputs "out"))
239 (doc (assoc-ref outputs "doc")))
1e9ed0e3 240 (substitute* '("configure")
d2984346
LC
241 (("/bin/pwd") (which "pwd")))
242
206a5208
AE
243 (zero? (system*
244 "./configure"
245 "-verbose"
246 "-prefix" out
4b0f2ef7
LC
247 ;; Note: Don't pass '-docdir' since 'qmake' and
248 ;; libQtCore would record its value, thereby defeating
249 ;; the whole point of having a separate output.
ff1989a5
LC
250 "-datadir" (string-append out "/share/qt-" ,version
251 "/data")
252 "-importdir" (string-append out "/lib/qt-4"
253 "/imports")
254 "-plugindir" (string-append out "/lib/qt-4"
255 "/plugins")
256 "-translationdir" (string-append out "/share/qt-" ,version
257 "/translations")
31580979
LC
258 "-demosdir" (string-append out "/share/qt-" ,version
259 "/demos")
260 "-examplesdir" (string-append out "/share/qt-" ,version
261 "/examples")
206a5208
AE
262 "-opensource"
263 "-confirm-license"
ff0a8c59
AE
264 ;; explicitly link with dbus instead of dlopening it
265 "-dbus-linked"
7431edea
AE
266 ;; Skip the webkit module; it fails to build on armhf
267 ;; and, apart from that, may pose security risks.
268 "-no-webkit"
206a5208
AE
269 ;; drop special machine instructions not supported
270 ;; on all instances of the target
271 ,@(if (string-prefix? "x86_64"
272 (or (%current-target-system)
273 (%current-system)))
274 '()
275 '("-no-mmx"
1e9ed0e3
AE
276 "-no-3dnow"
277 "-no-sse"
206a5208
AE
278 "-no-sse2"))
279 "-no-sse3"
280 "-no-ssse3"
281 "-no-sse4.1"
282 "-no-sse4.2"
84811c22 283 "-no-avx")))))
4b0f2ef7
LC
284 (add-after
285 'install 'move-doc
286 (lambda* (#:key outputs #:allow-other-keys)
287 ;; Because of qt4-documentation-path.patch, documentation ends up
288 ;; being installed in OUT. Move it to the right place.
289 (let* ((out (assoc-ref outputs "out"))
290 (doc (assoc-ref outputs "doc"))
291 (olddoc (string-append out "/doc"))
292 (docdir (string-append doc "/share/doc/qt-" ,version)))
293 (mkdir-p (dirname docdir))
294
295 ;; Note: We can't use 'rename-file' here because OUT and DOC are
296 ;; different "devices" due to bind-mounts.
297 (copy-recursively olddoc docdir)
298 (delete-file-recursively olddoc)
299 #t))))))))
84ef83dd 300
dbbb45dd
AE
301(define-public qjson
302 (package
303 (name "qjson")
304 (version "0.8.1")
305 (source (origin
306 (method url-fetch)
307 (uri (string-append "https://github.com/flavio/qjson/archive/"
308 version ".tar.gz"))
309 (file-name (string-append name "-" version ".tar.gz"))
310 (sha256
311 (base32
312 "163fspi0xc705irv79qw861fmh68pjyla9vx3kqiq6xrdhb9834j"))))
313 (build-system cmake-build-system)
314 (inputs
315 `(("qt" ,qt-4)))
316 (arguments
317 `(#:tests? #f)) ; no test target
318 (home-page "http://qjson.sourceforge.net/")
319 (synopsis "Qt-based library for handling JSON")
320 (description "QJson is a Qt-based library that maps JSON data to QVariant
321objects and vice versa. JSON arrays are mapped to QVariantList instances,
322while JSON objects are mapped to QVariantMap.")
323 (license lgpl2.1+)))
324
84ef83dd
AE
325(define-public python-sip
326 (package
327 (name "python-sip")
d032bb74 328 (version "4.16.9")
84ef83dd
AE
329 (source
330 (origin
331 (method url-fetch)
332 (uri
333 (string-append "mirror://sourceforge/pyqt/sip/"
334 "sip-" version "/sip-"
335 version ".tar.gz"))
336 (sha256
337 (base32
d032bb74 338 "0m85dgm3g9s9h7s5sfxvcxi423vqxwq1vg5wnl5wl9kfasm77qfv"))))
84ef83dd
AE
339 (build-system gnu-build-system)
340 (native-inputs
341 `(("python" ,python-wrapper)))
342 (arguments
343 `(#:tests? #f ; no check target
e8bdd73a
AE
344 #:modules ((srfi srfi-1)
345 ,@%gnu-build-system-modules)
84ef83dd
AE
346 #:phases
347 (alist-replace
348 'configure
349 (lambda* (#:key inputs outputs #:allow-other-keys)
350 (let* ((out (assoc-ref outputs "out"))
351 (bin (string-append out "/bin"))
352 (include (string-append out "/include"))
e8bdd73a 353 (python (assoc-ref inputs "python"))
84ef83dd 354 (python-version
e8bdd73a
AE
355 (last (string-split python #\-)))
356 (python-major+minor
357 (string-join
358 (take (string-split python-version #\.) 2)
359 "."))
84ef83dd 360 (lib (string-append out "/lib/python"
e8bdd73a 361 python-major+minor
84ef83dd
AE
362 "/site-packages")))
363 (zero?
364 (system* "python" "configure.py"
365 "--bindir" bin
366 "--destdir" lib
367 "--incdir" include))))
368 %standard-phases)))
369 (home-page "http://www.riverbankcomputing.com/software/sip/intro")
370 (synopsis "Python binding creator for C and C++ libraries")
371 (description
372 "SIP is a tool to create Python bindings for C and C++ libraries. It
373was originally developed to create PyQt, the Python bindings for the Qt
374toolkit, but can be used to create bindings for any C or C++ library.
375
376SIP comprises a code generator and a Python module. The code generator
377processes a set of specification files and generates C or C++ code, which
378is then compiled to create the bindings extension module. The SIP Python
379module provides support functions to the automatically generated code.")
380 ;; There is a choice between a python like license, gpl2 and gpl3.
381 ;; For compatibility with pyqt, we need gpl3.
382 (license gpl3)))
383
384(define-public python2-sip
385 (package (inherit python-sip)
386 (name "python2-sip")
387 (native-inputs
388 `(("python" ,python-2)))))
014e7dd8
AE
389
390(define-public python-pyqt
391 (package
392 (name "python-pyqt")
0c84e33e 393 (version "5.5")
014e7dd8
AE
394 (source
395 (origin
396 (method url-fetch)
397 (uri
398 (string-append "mirror://sourceforge/pyqt/PyQt5/"
399 "PyQt-" version "/PyQt-gpl-"
400 version ".tar.gz"))
401 (sha256
402 (base32
0c84e33e 403 "056qmkv02wdcfblqdaxiswrgn4wa88sz22i1x58dpb1iniavplfd"))
fc1adab1 404 (patches (search-patches "pyqt-configure.patch"))))
014e7dd8
AE
405 (build-system gnu-build-system)
406 (native-inputs
407 `(("python-sip" ,python-sip)
408 ("qt" ,qt))) ; for qmake
409 (inputs
410 `(("python" ,python-wrapper)))
411 (arguments
e8bdd73a
AE
412 `(#:modules ((srfi srfi-1)
413 ,@%gnu-build-system-modules)
414 #:phases
014e7dd8
AE
415 (alist-replace
416 'configure
417 (lambda* (#:key inputs outputs #:allow-other-keys)
418 (let* ((out (assoc-ref outputs "out"))
419 (bin (string-append out "/bin"))
420 (sip (string-append out "/share/sip"))
421 (plugins (string-append out "/plugins"))
422 (designer (string-append plugins "/designer"))
423 (qml (string-append plugins "/PyQt5"))
e8bdd73a 424 (python (assoc-ref inputs "python"))
014e7dd8 425 (python-version
e8bdd73a
AE
426 (last (string-split python #\-)))
427 (python-major+minor
428 (string-join
429 (take (string-split python-version #\.) 2)
430 "."))
014e7dd8 431 (lib (string-append out "/lib/python"
e8bdd73a 432 python-major+minor
014e7dd8
AE
433 "/site-packages")))
434 (zero? (system* "python" "configure.py"
435 "--confirm-license"
436 "--bindir" bin
437 "--destdir" lib
438 "--designer-plugindir" designer
439 "--qml-plugindir" qml
440 "--sipdir" sip))))
441 %standard-phases)))
442 (home-page "http://www.riverbankcomputing.com/software/pyqt/intro")
443 (synopsis "Python bindings for Qt")
444 (description
445 "PyQt is a set of Python v2 and v3 bindings for the Qt application
446framework. The bindings are implemented as a set of Python modules and
447contain over 620 classes.")
448 (license gpl3)))
449
450(define-public python2-pyqt
451 (package (inherit python-pyqt)
452 (name "python2-pyqt")
453 (native-inputs
454 `(("python-sip" ,python2-sip)
455 ("qt" ,qt)))
456 (inputs
457 `(("python" ,python-2)))))
3e291958
AE
458
459(define-public python-pyqt-4
460 (package (inherit python-pyqt)
461 (name "python-pyqt")
99755491 462 (version "4.11.4")
3e291958
AE
463 (source
464 (origin
465 (method url-fetch)
466 (uri
467 (string-append "mirror://sourceforge/pyqt/PyQt4/"
468 "PyQt-" version "/PyQt-x11-gpl-"
469 version ".tar.gz"))
470 (sha256
471 (base32
99755491 472 "01zlviy5lq8g6db84wnvvpsrfnip9lbcpxagsyqa6as3jmsff7zw"))))
3e291958
AE
473 (native-inputs
474 `(("python-sip" ,python-sip)
475 ("qt" ,qt-4)))
476 (arguments
477 `(#:tests? #f ; no check target
e8bdd73a
AE
478 #:modules ((srfi srfi-1)
479 ,@%gnu-build-system-modules)
3e291958
AE
480 #:phases
481 (alist-replace
482 'configure
483 (lambda* (#:key inputs outputs #:allow-other-keys)
484 (let* ((out (assoc-ref outputs "out"))
485 (bin (string-append out "/bin"))
486 (sip (string-append out "/share/sip"))
e8bdd73a 487 (python (assoc-ref inputs "python"))
3e291958 488 (python-version
e8bdd73a
AE
489 (last (string-split python #\-)))
490 (python-major+minor
491 (string-join
492 (take (string-split python-version #\.) 2)
493 "."))
3e291958 494 (lib (string-append out "/lib/python"
e8bdd73a 495 python-major+minor
3e291958
AE
496 "/site-packages")))
497 (zero? (system* "python" "configure.py"
498 "--confirm-license"
499 "--bindir" bin
500 "--destdir" lib
501 "--sipdir" sip))))
502 %standard-phases)))
503 (license (list gpl2 gpl3)))) ; choice of either license
504
9e81af9e
EF
505(define-public qtkeychain
506 (package
507 (name "qtkeychain")
65e46ca0 508 (version "0.6.2")
9e81af9e
EF
509 (source
510 (origin
511 (method url-fetch)
512 (uri (string-append "https://github.com/frankosterfeld/qtkeychain/"
513 "archive/v" version ".tar.gz"))
514 (file-name (string-append name "-" version ".tar.gz"))
515 (sha256
65e46ca0 516 (base32 "0g76pa786mg0fxy52hrljw09dvi6kffk2ms42lxapvpy6j94a4xf"))))
9e81af9e
EF
517 (build-system cmake-build-system)
518 (inputs
b3546174 519 `(("qt" ,qt)))
9e81af9e
EF
520 (arguments
521 `(#:tests? #f ; No tests included
522 #:phases
523 (modify-phases %standard-phases
524 (add-before
525 'configure 'set-qt-trans-dir
526 (lambda _
527 (substitute* "CMakeLists.txt"
528 (("\\$\\{qt_translations_dir\\}")
529 "${CMAKE_INSTALL_PREFIX}/share/qt/translations")))))))
530 (home-page "https://github.com/frankosterfeld/qtkeychain")
531 (synopsis "Qt API to store passwords")
532 (description
533 "QtKeychain is a Qt library to store passwords and other secret data
534securely. It will not store any data unencrypted unless explicitly requested.")
535 (license bsd-3)))