gnu: Remove unneeded uses of 'libiconv'.
[jackhill/guix/guix.git] / gnu / packages / wxwidgets.scm
CommitLineData
927b6728
TUBK
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2015 Taylan Ulrich Bayırlı/Kammer <taylanbayirli@gmail.com>
0aa0e1f8 3;;; Copyright © 2016, 2018, 2020 Ricardo Wurmus <rekado@elephly.net>
d109b1e8 4;;; Copyright © 2016 Theodoros Foradis <theodoros@foradis.org>
b353c7d2 5;;; Copyright © 2016 Danny Milosavljevic <dannym@scratchpost.org>
40c611a4 6;;; Copyright © 2017 Rene Saavedra <rennes@openmailbox.org>
59898500 7;;; Copyright © 2017 Efraim Flashner <efraim@flashner.co.il>
1d5b3f43 8;;; Copyright © 2017 Thomas Danckaert <post@thomasdanckaert.be>
70af5bf1 9;;; Copyright © 2018, 2020, 2021 Tobias Geerinckx-Rice <me@tobias.gr>
2c0552cf 10;;; Copyright © 2019 Arun Isaac <arunisaac@systemreboot.net>
927b6728
TUBK
11;;;
12;;; This file is part of GNU Guix.
13;;;
14;;; GNU Guix is free software; you can redistribute it and/or modify it
15;;; under the terms of the GNU General Public License as published by
16;;; the Free Software Foundation; either version 3 of the License, or (at
17;;; your option) any later version.
18;;;
19;;; GNU Guix is distributed in the hope that it will be useful, but
20;;; WITHOUT ANY WARRANTY; without even the implied warranty of
21;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22;;; GNU General Public License for more details.
23;;;
24;;; You should have received a copy of the GNU General Public License
25;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
26
27(define-module (gnu packages wxwidgets)
28 #:use-module (guix packages)
4ff6b340 29 #:use-module (guix gexp)
927b6728 30 #:use-module (guix download)
3962a046 31 #:use-module (guix git-download)
927b6728
TUBK
32 #:use-module ((guix licenses) #:prefix l:)
33 #:use-module (guix build-system glib-or-gtk)
b353c7d2 34 #:use-module (guix build-system python)
1d5b3f43 35 #:use-module (guix utils)
927b6728 36 #:use-module (gnu packages)
4ff6b340 37 #:use-module (gnu packages check)
927b6728
TUBK
38 #:use-module (gnu packages compression)
39 #:use-module (gnu packages databases)
94820083 40 #:use-module (gnu packages freedesktop)
927b6728 41 #:use-module (gnu packages gl)
93d9737d 42 #:use-module (gnu packages gnome)
927b6728
TUBK
43 #:use-module (gnu packages gstreamer)
44 #:use-module (gnu packages gtk)
45 #:use-module (gnu packages image)
a689185d
TD
46 #:use-module (gnu packages photo)
47 #:use-module (gnu packages video)
927b6728 48 #:use-module (gnu packages pkg-config)
b353c7d2 49 #:use-module (gnu packages python)
2c0552cf 50 #:use-module (gnu packages python-xyz)
927b6728 51 #:use-module (gnu packages sdl)
fc7c74e4 52 #:use-module (gnu packages webkit)
6fd5a80d
LC
53 #:use-module (gnu packages xorg)
54 #:use-module ((srfi srfi-1) #:select (alist-delete)))
927b6728
TUBK
55
56(define-public wxwidgets
57 (package
58 (name "wxwidgets")
3cfbeebb 59 (version "3.0.5.1")
927b6728
TUBK
60 (source
61 (origin
62 (method url-fetch)
8ebdf9af
AE
63 (uri (string-append "https://github.com/wxWidgets/wxWidgets/"
64 "releases/download/v" version
927b6728
TUBK
65 "/wxWidgets-" version ".tar.bz2"))
66 (sha256
3cfbeebb 67 (base32 "01y89999jw5q7njrhxajincx7lydls6yq37ikazjryssrxrnw3s4"))))
927b6728 68 (build-system glib-or-gtk-build-system)
927b6728
TUBK
69 (inputs
70 `(("glu" ,glu)
71 ;; XXX gstreamer-0.10 builds fail
72 ;; ("gstreamer" ,gstreamer-0.10)
73 ("gtk" ,gtk+)
4bd428a7 74 ("libjpeg" ,libjpeg-turbo)
927b6728
TUBK
75 ("libmspack" ,libmspack)
76 ("libsm" ,libsm)
77 ("libtiff" ,libtiff)
78 ("mesa" ,mesa)
afb7cd8e 79 ("webkitgtk" ,webkitgtk)
94820083 80 ("sdl" ,sdl)
93d9737d 81 ("shared-mime-info" ,shared-mime-info)
94820083 82 ("xdg-utils" ,xdg-utils)))
927b6728 83 (native-inputs
8394619b 84 (list pkg-config))
927b6728 85 (arguments
59898500 86 `(#:configure-flags
b37b854e 87 '("--with-regex" "--with-libmspack"
fc7c74e4
RW
88 "--with-sdl"
89 "--enable-webview"
90 "--enable-webkit"
59898500
EF
91 "--enable-webviewwebkit"
92 ,@(if (string=? "aarch64-linux"
93 (%current-system))
94 '("--build=aarch64-unknown-linux-gnu")
95 '()))
a0a0b716
TUBK
96 #:make-flags
97 (list (string-append "LDFLAGS=-Wl,-rpath="
98 (assoc-ref %outputs "out") "/lib"))
927b6728 99 ;; No 'check' target.
94820083
TGR
100 #:tests? #f
101 #:phases
102 (modify-phases %standard-phases
103 (add-after 'unpack 'refer-to-inputs
93d9737d 104 (lambda* (#:key inputs #:allow-other-keys)
d468a03a 105 (let* ((mime (search-input-directory inputs "/share/mime")))
93d9737d
KK
106 (substitute* "src/unix/utilsx11.cpp"
107 (("wxExecute\\(xdg_open \\+")
108 (string-append "wxExecute(\"" (which "xdg-open") "\"")))
109 (substitute* "src/unix/mimetype.cpp"
110 (("/usr(/local)?/share/mime") mime))
111 #t))))))
927b6728
TUBK
112 (home-page "https://www.wxwidgets.org/")
113 (synopsis "Widget toolkit for creating graphical user interfaces")
114 (description
115 "wxWidgets is a C++ library that lets developers create applications with
116a graphical user interface. It has language bindings for Python, Perl, Ruby
117and many other languages.")
118 (license (list l:lgpl2.0+ (l:fsf-free "file://doc/license.txt")))))
119
1aef4222
BH
120(define-public wxwidgets-2
121 (package
122 (inherit wxwidgets)
123 (version "2.8.12")
124 (source
125 (origin
126 (method url-fetch)
127 (uri (string-append "https://github.com/wxWidgets/wxWidgets/"
128 "releases/download/v" version
129 "/wxGTK-" version ".tar.gz"))
130 (sha256
131 (base32 "1gjs9vfga60mk4j4ngiwsk9h6c7j22pw26m3asxr1jwvqbr8kkqk"))))
132 (inputs
133 `(("gtk" ,gtk+-2)
4bd428a7 134 ("libjpeg" ,libjpeg-turbo)
1aef4222
BH
135 ("libtiff" ,libtiff)
136 ("libmspack" ,libmspack)
137 ("sdl" ,sdl)
138 ("unixodbc" ,unixodbc)))
139 (arguments
140 `(#:configure-flags
141 '("--enable-unicode" "--with-regex=sys" "--with-sdl")
142 #:make-flags
143 (list (string-append "LDFLAGS=-Wl,-rpath="
144 (assoc-ref %outputs "out") "/lib"))
145 ;; No 'check' target.
0aa0e1f8
RW
146 #:tests? #f
147 #:phases
148 (modify-phases %standard-phases
149 (add-after 'unpack 'ignore-narrowing-errors
150 (lambda _
151 (substitute* "configure"
152 (("-Wall") "-Wall -Wno-narrowing"))
153 #t)))))))
1aef4222 154
2cd3b6fd 155(define-public wxwidgets-gtk2
1a265842 156 (package/inherit wxwidgets
2cd3b6fd
TF
157 (inputs `(("gtk+" ,gtk+-2)
158 ,@(alist-delete
159 "gtk+"
160 (package-inputs wxwidgets))))
161 (name "wxwidgets-gtk2")))
b353c7d2 162
1d5b3f43
TD
163;; Development version of wxWidgets, required to build against gstreamer-1.x.
164;; This can be removed when wxWidgets is updated to the next stable version.
165(define-public wxwidgets-3.1
166 (package (inherit wxwidgets)
4ff6b340 167 (version "3.1.5")
1d5b3f43
TD
168 (source
169 (origin
3962a046
RW
170 (method git-fetch)
171 (uri (git-reference
b0e7b699 172 (url "https://github.com/wxWidgets/wxWidgets")
3962a046
RW
173 (commit (string-append "v" version))))
174 (file-name (git-file-name "wxwidgets" version))
1d5b3f43 175 (sha256
3962a046 176 (base32
4ff6b340 177 "0j998nzqmycafignclxmahgqm5kgs1fiqbsiyvzm7bnpnafi333y"))))
8394619b 178 (inputs (modify-inputs (package-inputs wxwidgets)
4ff6b340 179 (prepend catch-framework gstreamer gst-plugins-base)))
1d5b3f43
TD
180 (arguments
181 (substitute-keyword-arguments (package-arguments wxwidgets)
182 ((#:configure-flags flags)
4ff6b340
LMP
183 '(list "--with-regex" "--with-libmspack" "--with-sdl"
184 "--enable-mediactrl" "--enable-webviewwebkit"))
185 ((#:phases phases)
186 `(modify-phases ,phases
187 (add-after 'unpack 'add-catch
188 (lambda* (#:key inputs #:allow-other-keys)
189 (install-file
190 (search-input-file inputs "include/catch.hpp")
191 "3rdparty/catch/include/")))
192 (replace 'configure
193 (lambda* (#:key configure-flags inputs native-inputs outputs
194 #:allow-other-keys)
195 (let ((sh (search-input-file (or native-inputs inputs)
196 "bin/sh")))
197 (apply invoke "./configure"
198 (string-append "SHELL=" sh)
199 (string-append "CONFIG_SHELL=" sh)
200 (string-append "--prefix="
201 (assoc-ref outputs "out"))
202 configure-flags))))))))))
1d5b3f43 203
3fd2ecb3 204(define-public wxwidgets-gtk2-3.1
1a265842 205 (package/inherit wxwidgets-3.1
3fd2ecb3
DT
206 (inputs `(("gtk+" ,gtk+-2)
207 ,@(alist-delete
208 "gtk+"
209 (package-inputs wxwidgets-3.1))))
210 (name "wxwidgets-gtk2")))
211
2c0552cf
AI
212(define-public python-wxpython
213 (package
214 (name "python-wxpython")
215 (version "4.0.7.post1")
216 (source
217 (origin
218 (method url-fetch)
219 (uri (pypi-uri "wxPython" version))
220 (sha256
221 (base32
222 "1jppcr3n428m8pgwb9q3g0iiqydxd451ncri4njk8b53xsiflhys"))
223 (modules '((guix build utils)))
224 (snippet
225 '(begin
226 ;; Remove bundled wxwidgets
227 (delete-file-recursively "ext/wxWidgets")
228 #t))))
229 (build-system python-build-system)
230 (arguments
231 `(#:phases
232 (modify-phases %standard-phases
233 (add-before 'build 'configure
234 (lambda* (#:key inputs #:allow-other-keys)
235 (setenv "WXWIN" (assoc-ref inputs "wxwidgets"))
236 ;; Copy the waf executable to the source directory since it needs
237 ;; to be in a writable directory.
bc64d955 238 (copy-file (search-input-file inputs "/bin/waf")
2c0552cf
AI
239 "bin/waf")
240 (setenv "WAF" "bin/waf")
241 ;; The build script tries to copy license files from the
242 ;; wxwidgets source tree. Prevent it.
243 (substitute* "wscript"
244 (("updateLicenseFiles\\(cfg\\)" all)
245 (string-append "#" all)))
246 ;; The build script tries to write to demo/version.py. So, we set
247 ;; correct write permissions.
248 (chmod "demo/version.py" #o644)
249 ;; Build only the python bindings, not wxwidgets also.
250 (substitute* "setup.py"
251 (("'build']") "'build_py', '--use_syswx']"))
252 #t)))))
253 (inputs
8394619b 254 (list gtk+ wxwidgets))
2c0552cf 255 (native-inputs
8394619b 256 (list pkg-config python-waf))
2c0552cf 257 (propagated-inputs
8394619b 258 (list python-numpy python-pillow python-six))
2bc8143f 259 (home-page "https://wxpython.org/")
2c0552cf
AI
260 (synopsis "Cross platform GUI toolkit for Python")
261 (description "wxPython is a cross-platform GUI toolkit for the Python
262programming language. It is implemented as a set of Python extension modules
263that wrap the GUI components of the popular wxWidgets cross platform C++
264library. In most cases, wxPython uses the native widgets on each platform to
265provide a 100% native look and feel for the application.")
266 (license l:wxwindows3.1+)))
267
b353c7d2
TF
268(define-public python2-wxpython
269 (package
270 (name "python2-wxpython")
271 (version "3.0.2.0")
272 (source
273 (origin
274 (method url-fetch)
275 (uri (string-append "mirror://sourceforge/wxpython/wxPython/"
276 version "/wxPython-src-" version ".tar.bz2"))
277 (sha256
278 (base32
279 "0qfzx3sqx4mwxv99sfybhsij4b5pc03ricl73h4vhkzazgjjjhfm"))
280 (modules '((guix build utils)))
281 (snippet
282 '(begin
283 (lambda (folder)
284 (delete-file-recursively (string-append "src/" folder))
285 '("expat" "jpeg" "png" "tiff" "zlib" "msw" "osx" "msdos"))
286 (substitute* '("wxPython/setup.py")
287 ;; setup.py tries to keep its own license the same as wxwidget's
288 ;; license (which it expects under $WXWIN/docs).
289 (("'preamble.txt', 'licence.txt', 'licendoc.txt', 'lgpl.txt'")
6cbee49d
MW
290 ""))
291 #t))))
b353c7d2
TF
292 (build-system python-build-system)
293 (arguments
294 `(#:python ,python-2
295 #:tests? #f ; tests fail
6f1dcafd
HG
296 ;; wxPython directly extends distutils command classes,
297 ;; we can't easily make setup.py use setuptools.
298 #:use-setuptools? #f
b353c7d2
TF
299 #:configure-flags (list "WXPORT=gtk2"
300 "UNICODE=1")
301 #:phases
302 (modify-phases %standard-phases
303 (add-before 'build 'chdir
304 (lambda _
305 (chdir "wxPython")
306 #t))
307 (add-after 'chdir 'set-wx-out-dir
308 (lambda* (#:key outputs #:allow-other-keys)
309 ;; By default, install phase tries to copy the wxPython headers in
310 ;; gnu/store/...-wxwidgets-3.0.2 , which it can't, so they are
311 ;; redirected to the output directory by setting WXPREFIX.
312 (substitute* "config.py"
313 (("= getWxConfigValue\\('--prefix'\\)")
314 (string-append "= '" (assoc-ref outputs "out") "'")))
315 (substitute* "wx/build/config.py"
316 (("= getWxConfigValue\\('--prefix'\\)")
317 (string-append "= '" (assoc-ref outputs "out") "'")))
318 #t))
319 (add-after 'set-wx-out-dir 'setenv
320 (lambda* (#:key inputs outputs #:allow-other-keys)
321 (setenv "WXWIN" (assoc-ref inputs "wxwidgets"))
322 (use-modules (ice-9 popen) (ice-9 rdelim))
323 (let ((port (open-pipe* OPEN_READ
bc64d955
LC
324 (search-input-file inputs
325 "/bin/wx-config")
326 "--cppflags")))
b353c7d2
TF
327 (setenv "CPPFLAGS" (read-string port))
328 (close-pipe port))
329 #t)))))
330 (native-inputs
8394619b
LC
331 (list mesa ; for glcanvas
332 pkg-config))
b353c7d2
TF
333 (inputs
334 `(("gtk+" ,gtk+-2) ; for wxPython/src/helpers.cpp
335 ("wxwidgets" ,wxwidgets-gtk2)))
336 (synopsis "Python 2 Bindings for wxWidgets")
337 (description "@code{wxpython} provides Python 2 bindings for wxWidgets.")
414b8d9e 338 (home-page "https://wxpython.org/")
b353c7d2 339 (license (package-license wxwidgets))))
a689185d
TD
340
341(define-public wxsvg
342 (package
343 (name "wxsvg")
f2ff26f3 344 (version "1.5.23")
a689185d
TD
345 (source
346 (origin
347 (method url-fetch)
348 (uri (string-append "mirror://sourceforge/wxsvg/wxsvg/"
349 version "/wxsvg-" version ".tar.bz2"))
350 (sha256
f2ff26f3 351 (base32 "1fdbvihw1w2vm29xj54cqgpdabhlg0ydf3clkb0qrlf7mhgkc1rz"))))
a689185d
TD
352 (build-system glib-or-gtk-build-system)
353 (inputs
8394619b 354 (list wxwidgets-3.1 cairo ffmpeg))
a689185d 355 (native-inputs
8394619b 356 (list pkg-config))
70af5bf1
TGR
357 (propagated-inputs
358 ;; In Requires.private of libwxsvg.pc.
8394619b 359 (list libexif pango))
a689185d
TD
360 (synopsis "C++ library to create, manipulate and render SVG files")
361 (description "wxSVG is a C++ library to create, manipulate and render
362@dfn{Scalable Vector Graphics} (SVG) files with the wxWidgets toolkit.")
363 (home-page "http://wxsvg.sourceforge.net")
364
365 ;; wxSVG is licenced under the "wxWindows library licence", which is
366 ;; the LGPL2.0+, with a few extra permissions.
367 (license (list l:lgpl2.0+ (l:fsf-free "file://COPYING")))))