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