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 ;;; Copyright © 2015, 2016 Efraim Flashner <efraim@flashner.co.il>
7 ;;; This file is part of GNU Guix.
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.
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.
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/>.
22 (define-module (gnu packages qt)
23 #:use-module ((guix licenses) #:select (bsd-3 gpl2 gpl3 lgpl2.1 lgpl2.1+ lgpl3 x11-style))
24 #:use-module (guix packages)
25 #:use-module (guix download)
26 #:use-module (guix build utils)
27 #:use-module (guix build-system cmake)
28 #:use-module (guix build-system gnu)
29 #:use-module (guix packages)
30 #:use-module (guix utils)
31 #:use-module (gnu packages)
32 #:use-module (gnu packages bison)
33 #:use-module (gnu packages compression)
34 #:use-module (gnu packages cups)
35 #:use-module (gnu packages databases)
36 #:use-module (gnu packages fontutils)
37 #:use-module (gnu packages flex)
38 #:use-module (gnu packages gl)
39 #:use-module (gnu packages glib)
40 #:use-module (gnu packages gnuzilla)
41 #:use-module (gnu packages gperf)
42 #:use-module (gnu packages gtk)
43 #:use-module (gnu packages icu4c)
44 #:use-module (gnu packages image)
45 #:use-module (gnu packages linux)
46 #:use-module (gnu packages databases)
47 #:use-module (gnu packages pciutils)
48 #:use-module (gnu packages pcre)
49 #:use-module (gnu packages perl)
50 #:use-module (gnu packages pkg-config)
51 #:use-module (gnu packages pulseaudio)
52 #:use-module (gnu packages python)
53 #:use-module (gnu packages ruby)
54 #:use-module (gnu packages tls)
55 #:use-module (gnu packages xdisorg)
56 #:use-module (gnu packages xorg)
57 #:use-module (gnu packages xml))
67 "http://download.qt.io/official_releases/qt/"
68 (version-major+minor version)
70 "/single/qt-everywhere-opensource-src-"
74 "0615cn4n3n78v48lnmapqz2jizm2pzrjwvsjlnsf4awrsiiqw0kg"))
75 (modules '((guix build utils)))
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".
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")))))
92 (build-system gnu-build-system)
96 `(("alsa-lib" ,alsa-lib)
100 ("fontconfig" ,fontconfig)
101 ("freetype" ,freetype)
103 ("harfbuzz" ,harfbuzz)
110 ("libxcomposite" ,libxcomposite)
111 ("libxcursor" ,libxcursor)
112 ("libxfixes" ,libxfixes)
114 ("libxinerama" ,libxinerama)
115 ("libxkbcommon" ,libxkbcommon)
117 ("libxrandr" ,libxrandr)
118 ("libxrender" ,libxrender)
125 ("postgresql" ,postgresql)
126 ("pulseaudio" ,pulseaudio)
130 ("unixodbc" ,unixodbc)
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)
142 ("pkg-config" ,pkg-config)
145 ("which" ,(@ (gnu packages base) which))))
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.
155 (lambda* (#:key outputs #:allow-other-keys)
156 (let ((out (assoc-ref outputs "out")))
157 (substitute* '("configure" "qtbase/configure")
158 (("/bin/pwd") (which "pwd")))
159 (substitute* "qtbase/src/corelib/global/global.pri"
160 (("/bin/ls") (which "ls")))
161 ;; do not pass "--enable-fast-install", which makes the
162 ;; configure process fail
169 ;; Most "-system-..." are automatic, but some use
170 ;; the bundled copy by default.
173 ;; explicitly link with openssl instead of dlopening it
175 ;; explicitly link with dbus instead of dlopening it
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)
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
196 developers using C++ or QML, a CSS & JavaScript like language.")
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))))
205 (package (inherit qt)
209 (uri (string-append "http://download.qt-project.org/official_releases/qt/"
210 (string-copy version 0 (string-rindex version #\.))
212 "/qt-everywhere-opensource-src-"
216 "183fca7n7439nlhxyg1z7aky0izgbyll3iwakw4gwivy16aj5272"))
217 (patches (search-patches "qt4-ldflags.patch"))
218 (modules '((guix build utils)))
220 ;; Remove webkit module, which is not built.
221 '(delete-file-recursively "src/3rdparty/webkit"))))
222 (inputs `(,@(alist-delete "harfbuzz"
223 (alist-delete "libjpeg" (package-inputs qt)))
224 ("libjepg" ,libjpeg-8)
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
234 (modify-phases %standard-phases
237 (lambda* (#:key outputs #:allow-other-keys)
238 (let ((out (assoc-ref outputs "out"))
239 (doc (assoc-ref outputs "doc")))
240 (substitute* '("configure")
241 (("/bin/pwd") (which "pwd")))
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.
250 "-datadir" (string-append out "/share/qt-" ,version
252 "-importdir" (string-append out "/lib/qt-4"
254 "-plugindir" (string-append out "/lib/qt-4"
256 "-translationdir" (string-append out "/share/qt-" ,version
258 "-demosdir" (string-append out "/share/qt-" ,version
260 "-examplesdir" (string-append out "/share/qt-" ,version
264 ;; explicitly link with dbus instead of dlopening it
266 ;; Skip the webkit module; it fails to build on armhf
267 ;; and, apart from that, may pose security risks.
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)
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))
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)
301 (define-public qtbase
307 (uri (string-append "https://download.qt.io/official_releases/qt/"
308 (version-major+minor version) "/" version
309 "/submodules/" name "-opensource-src-"
313 "0ynnvcs5idivzldsq5ciqg9myg82b3l3906l4vjv54lyamf8mykf"))
314 (modules '((guix build utils)))
317 ;; Remove one of the two bundled harfbuzz copies in addition
318 ;; to passing "-system-harfbuzz".
319 (delete-file-recursively "src/3rdparty/harfbuzz-ng")
320 ;; Remove the bundled sqlite copy in addition to
321 ;; passing "-system-sqlite".
322 (delete-file-recursively "src/3rdparty/sqlite")))))
323 (build-system gnu-build-system)
327 `(("alsa-lib" ,alsa-lib)
331 ("fontconfig" ,fontconfig)
332 ("freetype" ,freetype)
334 ("harfbuzz" ,harfbuzz)
340 ("libxcomposite" ,libxcomposite)
341 ("libxcursor" ,libxcursor)
342 ("libxfixes" ,libxfixes)
344 ("libxinerama" ,libxinerama)
345 ("libxkbcommon" ,libxkbcommon)
347 ("libxrandr" ,libxrandr)
348 ("libxrender" ,libxrender)
356 ("postgresql" ,postgresql)
357 ("pulseaudio" ,pulseaudio)
359 ("unixodbc" ,unixodbc)
360 ("xcb-util" ,xcb-util)
361 ("xcb-util-image" ,xcb-util-image)
362 ("xcb-util-keysyms" ,xcb-util-keysyms)
363 ("xcb-util-renderutil" ,xcb-util-renderutil)
364 ("xcb-util-wm" ,xcb-util-wm)
371 ("pkg-config" ,pkg-config)
374 ("which" ,(@ (gnu packages base) which))))
377 (modify-phases %standard-phases
378 (add-after 'configure 'patch-bin-sh
380 (substitute* '("config.status"
382 "mkspecs/features/qt_functions.prf"
383 "qmake/library/qmakebuiltins.cpp")
384 (("/bin/sh") (which "sh")))
387 (lambda* (#:key outputs #:allow-other-keys)
388 (let ((out (assoc-ref outputs "out")))
389 (substitute* "configure"
390 (("/bin/pwd") (which "pwd")))
391 (substitute* "src/corelib/global/global.pri"
392 (("/bin/ls") (which "ls")))
393 ;; do not pass "--enable-fast-install", which makes the
394 ;; configure process fail
401 ;; Do not build examples; if desired, these could go
402 ;; into a separate output, but for the time being, we
403 ;; prefer to save the space and build time.
405 ;; Most "-system-..." are automatic, but some use
406 ;; the bundled copy by default.
409 ;; explicitly link with openssl instead of dlopening it
411 ;; explicitly link with dbus instead of dlopening it
413 ;; drop special machine instructions not supported
414 ;; on all instances of the target
415 ,@(if (string-prefix? "x86_64"
416 (or (%current-target-system)
427 "-no-mips_dspr2"))))))))
428 (home-page "https://www.qt.io/")
429 (synopsis "Cross-platform GUI library")
430 (description "Qt is a cross-platform application and UI framework for
431 developers using C++ or QML, a CSS & JavaScript like language.")
432 (license (list lgpl2.1 lgpl3))))
440 (uri (string-append "https://github.com/flavio/qjson/archive/"
442 (file-name (string-append name "-" version ".tar.gz"))
445 "163fspi0xc705irv79qw861fmh68pjyla9vx3kqiq6xrdhb9834j"))))
446 (build-system cmake-build-system)
450 `(#:tests? #f)) ; no test target
451 (home-page "http://qjson.sourceforge.net/")
452 (synopsis "Qt-based library for handling JSON")
453 (description "QJson is a Qt-based library that maps JSON data to QVariant
454 objects and vice versa. JSON arrays are mapped to QVariantList instances,
455 while JSON objects are mapped to QVariantMap.")
458 (define-public python-sip
466 (string-append "mirror://sourceforge/pyqt/sip/"
467 "sip-" version "/sip-" version ".tar.gz"))
470 "1dlw4kyiwd9bzmd1djm79c121r219abaz86lvizdk6ksq20mrp7i"))))
471 (build-system gnu-build-system)
473 `(("python" ,python-wrapper)))
475 `(#:tests? #f ; no check target
476 #:modules ((srfi srfi-1)
477 ,@%gnu-build-system-modules)
481 (lambda* (#:key inputs outputs #:allow-other-keys)
482 (let* ((out (assoc-ref outputs "out"))
483 (bin (string-append out "/bin"))
484 (include (string-append out "/include"))
485 (python (assoc-ref inputs "python"))
487 (last (string-split python #\-)))
490 (take (string-split python-version #\.) 2)
492 (lib (string-append out "/lib/python"
496 (system* "python" "configure.py"
499 "--incdir" include))))
501 (home-page "http://www.riverbankcomputing.com/software/sip/intro")
502 (synopsis "Python binding creator for C and C++ libraries")
504 "SIP is a tool to create Python bindings for C and C++ libraries. It
505 was originally developed to create PyQt, the Python bindings for the Qt
506 toolkit, but can be used to create bindings for any C or C++ library.
508 SIP comprises a code generator and a Python module. The code generator
509 processes a set of specification files and generates C or C++ code, which
510 is then compiled to create the bindings extension module. The SIP Python
511 module provides support functions to the automatically generated code.")
512 ;; There is a choice between a python like license, gpl2 and gpl3.
513 ;; For compatibility with pyqt, we need gpl3.
516 (define-public python2-sip
517 (package (inherit python-sip)
520 `(("python" ,python-2)))))
522 (define-public python-pyqt
530 (string-append "mirror://sourceforge/pyqt/PyQt5/"
531 "PyQt-" version "/PyQt-gpl-"
535 "056qmkv02wdcfblqdaxiswrgn4wa88sz22i1x58dpb1iniavplfd"))
536 (patches (search-patches "pyqt-configure.patch"))))
537 (build-system gnu-build-system)
539 `(("python-sip" ,python-sip)
540 ("qt" ,qt))) ; for qmake
542 `(("python" ,python-wrapper)))
544 `(#:modules ((srfi srfi-1)
545 ,@%gnu-build-system-modules)
549 (lambda* (#:key inputs outputs #:allow-other-keys)
550 (let* ((out (assoc-ref outputs "out"))
551 (bin (string-append out "/bin"))
552 (sip (string-append out "/share/sip"))
553 (plugins (string-append out "/plugins"))
554 (designer (string-append plugins "/designer"))
555 (qml (string-append plugins "/PyQt5"))
556 (python (assoc-ref inputs "python"))
558 (last (string-split python #\-)))
561 (take (string-split python-version #\.) 2)
563 (lib (string-append out "/lib/python"
566 (zero? (system* "python" "configure.py"
570 "--designer-plugindir" designer
571 "--qml-plugindir" qml
574 (home-page "http://www.riverbankcomputing.com/software/pyqt/intro")
575 (synopsis "Python bindings for Qt")
577 "PyQt is a set of Python v2 and v3 bindings for the Qt application
578 framework. The bindings are implemented as a set of Python modules and
579 contain over 620 classes.")
582 (define-public python2-pyqt
583 (package (inherit python-pyqt)
584 (name "python2-pyqt")
586 `(("python-sip" ,python2-sip)
589 `(("python" ,python-2)))))
591 (define-public python-pyqt-4
592 (package (inherit python-pyqt)
599 (string-append "mirror://sourceforge/pyqt/PyQt4/"
600 "PyQt-" version "/PyQt-x11-gpl-"
604 "01zlviy5lq8g6db84wnvvpsrfnip9lbcpxagsyqa6as3jmsff7zw"))))
606 `(("python-sip" ,python-sip)
609 `(#:tests? #f ; no check target
610 #:modules ((srfi srfi-1)
611 ,@%gnu-build-system-modules)
615 (lambda* (#:key inputs outputs #:allow-other-keys)
616 (let* ((out (assoc-ref outputs "out"))
617 (bin (string-append out "/bin"))
618 (sip (string-append out "/share/sip"))
619 (python (assoc-ref inputs "python"))
621 (last (string-split python #\-)))
624 (take (string-split python-version #\.) 2)
626 (lib (string-append out "/lib/python"
629 (zero? (system* "python" "configure.py"
635 (license (list gpl2 gpl3)))) ; choice of either license
637 (define-public qtkeychain
644 (uri (string-append "https://github.com/frankosterfeld/qtkeychain/"
645 "archive/v" version ".tar.gz"))
646 (file-name (string-append name "-" version ".tar.gz"))
648 (base32 "0g76pa786mg0fxy52hrljw09dvi6kffk2ms42lxapvpy6j94a4xf"))))
649 (build-system cmake-build-system)
653 `(#:tests? #f ; No tests included
655 (modify-phases %standard-phases
657 'configure 'set-qt-trans-dir
659 (substitute* "CMakeLists.txt"
660 (("\\$\\{qt_translations_dir\\}")
661 "${CMAKE_INSTALL_PREFIX}/share/qt/translations")))))))
662 (home-page "https://github.com/frankosterfeld/qtkeychain")
663 (synopsis "Qt API to store passwords")
665 "QtKeychain is a Qt library to store passwords and other secret data
666 securely. It will not store any data unencrypted unless explicitly requested.")