gnu: qt-4: Use a more standard directory layout.
[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)
b332e366 45 #:use-module (gnu packages openssl)
0009ed71
SB
46 #:use-module (gnu packages pciutils)
47 #:use-module (gnu packages pcre)
b332e366
AE
48 #:use-module (gnu packages perl)
49 #:use-module (gnu packages pkg-config)
39fa8f6c 50 #:use-module (gnu packages pulseaudio)
b332e366 51 #:use-module (gnu packages python)
8b6a5e0f 52 #:use-module (gnu packages ruby)
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
31580979 267 "-docdir" (string-append doc "/share/doc/qt-" ,version)
ff1989a5
LC
268 "-datadir" (string-append out "/share/qt-" ,version
269 "/data")
270 "-importdir" (string-append out "/lib/qt-4"
271 "/imports")
272 "-plugindir" (string-append out "/lib/qt-4"
273 "/plugins")
274 "-translationdir" (string-append out "/share/qt-" ,version
275 "/translations")
31580979
LC
276 "-demosdir" (string-append out "/share/qt-" ,version
277 "/demos")
278 "-examplesdir" (string-append out "/share/qt-" ,version
279 "/examples")
206a5208
AE
280 "-opensource"
281 "-confirm-license"
ff0a8c59
AE
282 ;; explicitly link with dbus instead of dlopening it
283 "-dbus-linked"
206a5208
AE
284 ;; drop special machine instructions not supported
285 ;; on all instances of the target
286 ,@(if (string-prefix? "x86_64"
287 (or (%current-target-system)
288 (%current-system)))
289 '()
290 '("-no-mmx"
1e9ed0e3
AE
291 "-no-3dnow"
292 "-no-sse"
206a5208
AE
293 "-no-sse2"))
294 "-no-sse3"
295 "-no-ssse3"
296 "-no-sse4.1"
297 "-no-sse4.2"
298 "-no-avx"
cba632c4 299 "-no-neon"))))))))))
84ef83dd
AE
300
301(define-public python-sip
302 (package
303 (name "python-sip")
304 (version "4.16.5")
305 (source
306 (origin
307 (method url-fetch)
308 (uri
309 (string-append "mirror://sourceforge/pyqt/sip/"
310 "sip-" version "/sip-"
311 version ".tar.gz"))
312 (sha256
313 (base32
314 "11qy1z88py2q7rz68rm7214pbd37538hpcbfj5hhzp5y616a62x0"))))
315 (build-system gnu-build-system)
316 (native-inputs
317 `(("python" ,python-wrapper)))
318 (arguments
319 `(#:tests? #f ; no check target
320 #:phases
321 (alist-replace
322 'configure
323 (lambda* (#:key inputs outputs #:allow-other-keys)
324 (let* ((out (assoc-ref outputs "out"))
325 (bin (string-append out "/bin"))
326 (include (string-append out "/include"))
327 (python-version
328 (string-take
329 (string-take-right (assoc-ref inputs "python") 5)
330 3))
331 (lib (string-append out "/lib/python"
332 python-version
333 "/site-packages")))
334 (zero?
335 (system* "python" "configure.py"
336 "--bindir" bin
337 "--destdir" lib
338 "--incdir" include))))
339 %standard-phases)))
340 (home-page "http://www.riverbankcomputing.com/software/sip/intro")
341 (synopsis "Python binding creator for C and C++ libraries")
342 (description
343 "SIP is a tool to create Python bindings for C and C++ libraries. It
344was originally developed to create PyQt, the Python bindings for the Qt
345toolkit, but can be used to create bindings for any C or C++ library.
346
347SIP comprises a code generator and a Python module. The code generator
348processes a set of specification files and generates C or C++ code, which
349is then compiled to create the bindings extension module. The SIP Python
350module provides support functions to the automatically generated code.")
351 ;; There is a choice between a python like license, gpl2 and gpl3.
352 ;; For compatibility with pyqt, we need gpl3.
353 (license gpl3)))
354
355(define-public python2-sip
356 (package (inherit python-sip)
357 (name "python2-sip")
358 (native-inputs
359 `(("python" ,python-2)))))
014e7dd8
AE
360
361(define-public python-pyqt
362 (package
363 (name "python-pyqt")
364 (version "5.4")
365 (source
366 (origin
367 (method url-fetch)
368 (uri
369 (string-append "mirror://sourceforge/pyqt/PyQt5/"
370 "PyQt-" version "/PyQt-gpl-"
371 version ".tar.gz"))
372 (sha256
373 (base32
374 "0cbpa63whi8a5akff4pcnfwzpzx7ycac2ynj00ly52m6zbsn80kn"))
375 (patches (list (search-patch "pyqt-configure.patch")))))
376 (build-system gnu-build-system)
377 (native-inputs
378 `(("python-sip" ,python-sip)
379 ("qt" ,qt))) ; for qmake
380 (inputs
381 `(("python" ,python-wrapper)))
382 (arguments
383 `(#:phases
384 (alist-replace
385 'configure
386 (lambda* (#:key inputs outputs #:allow-other-keys)
387 (let* ((out (assoc-ref outputs "out"))
388 (bin (string-append out "/bin"))
389 (sip (string-append out "/share/sip"))
390 (plugins (string-append out "/plugins"))
391 (designer (string-append plugins "/designer"))
392 (qml (string-append plugins "/PyQt5"))
393 (python-version
394 (string-take
395 (string-take-right (assoc-ref inputs "python") 5)
396 3))
397 (lib (string-append out "/lib/python"
398 python-version
399 "/site-packages")))
400 (zero? (system* "python" "configure.py"
401 "--confirm-license"
402 "--bindir" bin
403 "--destdir" lib
404 "--designer-plugindir" designer
405 "--qml-plugindir" qml
406 "--sipdir" sip))))
407 %standard-phases)))
408 (home-page "http://www.riverbankcomputing.com/software/pyqt/intro")
409 (synopsis "Python bindings for Qt")
410 (description
411 "PyQt is a set of Python v2 and v3 bindings for the Qt application
412framework. The bindings are implemented as a set of Python modules and
413contain over 620 classes.")
414 (license gpl3)))
415
416(define-public python2-pyqt
417 (package (inherit python-pyqt)
418 (name "python2-pyqt")
419 (native-inputs
420 `(("python-sip" ,python2-sip)
421 ("qt" ,qt)))
422 (inputs
423 `(("python" ,python-2)))))
3e291958
AE
424
425(define-public python-pyqt-4
426 (package (inherit python-pyqt)
427 (name "python-pyqt")
428 (version "4.11.3")
429 (source
430 (origin
431 (method url-fetch)
432 (uri
433 (string-append "mirror://sourceforge/pyqt/PyQt4/"
434 "PyQt-" version "/PyQt-x11-gpl-"
435 version ".tar.gz"))
436 (sha256
437 (base32
438 "11jnfjw79s0b0qdd9s6kd69w87vf16dhagbhbmwbmrp2vgf80dw5"))))
439 (native-inputs
440 `(("python-sip" ,python-sip)
441 ("qt" ,qt-4)))
442 (arguments
443 `(#:tests? #f ; no check target
444 #:phases
445 (alist-replace
446 'configure
447 (lambda* (#:key inputs outputs #:allow-other-keys)
448 (let* ((out (assoc-ref outputs "out"))
449 (bin (string-append out "/bin"))
450 (sip (string-append out "/share/sip"))
451 (python-version
452 (string-take
453 (string-take-right (assoc-ref inputs "python") 5)
454 3))
455 (lib (string-append out "/lib/python"
456 python-version
457 "/site-packages")))
458 (zero? (system* "python" "configure.py"
459 "--confirm-license"
460 "--bindir" bin
461 "--destdir" lib
462 "--sipdir" sip))))
463 %standard-phases)))
464 (license (list gpl2 gpl3)))) ; choice of either license
465
466(define-public python2-pyqt-4
467 (package (inherit python-pyqt-4)
468 (name "python2-pyqt")
469 (native-inputs
470 `(("python-sip" ,python2-sip)
471 ("qt" ,qt-4)))
472 (inputs
473 `(("python" ,python-2)))))