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>
12 ;;; This file is part of GNU Guix.
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.
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.
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/>.
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)))
53 (define-public wxwidgets
60 (uri (string-append "https://github.com/wxWidgets/wxWidgets/"
61 "releases/download/v" version
62 "/wxWidgets-" version ".tar.bz2"))
64 (base32 "01y89999jw5q7njrhxajincx7lydls6yq37ikazjryssrxrnw3s4"))))
65 (build-system glib-or-gtk-build-system)
68 ;; XXX gstreamer-0.10 builds fail
69 ;; ("gstreamer" ,gstreamer-0.10)
71 ("libjpeg" ,libjpeg-turbo)
72 ("libmspack" ,libmspack)
76 ("webkitgtk" ,webkitgtk)
78 ("xdg-utils" ,xdg-utils)))
80 `(("pkg-config" ,pkg-config)))
83 '("--with-regex" "--with-libmspack"
87 "--enable-webviewwebkit"
88 ,@(if (string=? "aarch64-linux"
90 '("--build=aarch64-unknown-linux-gnu")
93 (list (string-append "LDFLAGS=-Wl,-rpath="
94 (assoc-ref %outputs "out") "/lib"))
98 (modify-phases %standard-phases
99 (add-after 'unpack 'refer-to-inputs
101 (substitute* "src/unix/utilsx11.cpp"
102 (("wxExecute\\(xdg_open \\+")
103 (string-append "wxExecute(\"" (which "xdg-open") "\"")))
105 (home-page "https://www.wxwidgets.org/")
106 (synopsis "Widget toolkit for creating graphical user interfaces")
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")))))
113 (define-public wxwidgets-2
120 (uri (string-append "https://github.com/wxWidgets/wxWidgets/"
121 "releases/download/v" version
122 "/wxGTK-" version ".tar.gz"))
124 (base32 "1gjs9vfga60mk4j4ngiwsk9h6c7j22pw26m3asxr1jwvqbr8kkqk"))))
127 ("libjpeg" ,libjpeg-turbo)
129 ("libmspack" ,libmspack)
131 ("unixodbc" ,unixodbc)))
134 '("--enable-unicode" "--with-regex=sys" "--with-sdl")
136 (list (string-append "LDFLAGS=-Wl,-rpath="
137 (assoc-ref %outputs "out") "/lib"))
138 ;; No 'check' target.
141 (modify-phases %standard-phases
142 (add-after 'unpack 'ignore-narrowing-errors
144 (substitute* "configure"
145 (("-Wall") "-Wall -Wno-narrowing"))
148 (define-public wxwidgets-gtk2
149 (package (inherit wxwidgets)
150 (inputs `(("gtk+" ,gtk+-2)
153 (package-inputs wxwidgets))))
154 (name "wxwidgets-gtk2")))
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)
165 (url "https://github.com/wxWidgets/wxWidgets")
166 (commit (string-append "v" version))))
167 (file-name (git-file-name "wxwidgets" version))
170 "14kl1rsngm70v3mbyv1mal15iz2b18k97avjx8jn7s81znha1c7f"))))
171 (inputs `(("gstreamer" ,gstreamer)
172 ("gst-plugins-base" ,gst-plugins-base)
173 ,@(package-inputs wxwidgets)))
175 (substitute-keyword-arguments (package-arguments wxwidgets)
176 ((#:configure-flags flags)
177 `(cons "--enable-mediactrl" ,flags))))))
179 (define-public wxwidgets-gtk2-3.1
180 (package (inherit wxwidgets-3.1)
181 (inputs `(("gtk+" ,gtk+-2)
184 (package-inputs wxwidgets-3.1))))
185 (name "wxwidgets-gtk2")))
187 (define-public python-wxpython
189 (name "python-wxpython")
190 (version "4.0.7.post1")
194 (uri (pypi-uri "wxPython" version))
197 "1jppcr3n428m8pgwb9q3g0iiqydxd451ncri4njk8b53xsiflhys"))
198 (modules '((guix build utils)))
201 ;; Remove bundled wxwidgets
202 (delete-file-recursively "ext/wxWidgets")
204 (build-system python-build-system)
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")
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']"))
230 ("wxwidgets" ,wxwidgets)))
232 `(("pkg-config" ,pkg-config)
233 ("python-waf" ,python-waf)))
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+)))
247 (define-public python2-wxpython
249 (name "python2-wxpython")
254 (uri (string-append "mirror://sourceforge/wxpython/wxPython/"
255 version "/wxPython-src-" version ".tar.bz2"))
258 "0qfzx3sqx4mwxv99sfybhsij4b5pc03ricl73h4vhkzazgjjjhfm"))
259 (modules '((guix build utils)))
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'")
271 (build-system python-build-system)
274 #:tests? #f ; tests fail
275 ;; wxPython directly extends distutils command classes,
276 ;; we can't easily make setup.py use setuptools.
278 #:configure-flags (list "WXPORT=gtk2"
281 (modify-phases %standard-phases
282 (add-before 'build 'chdir
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") "'")))
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))
309 `(("mesa" ,mesa) ; for glcanvas
310 ("pkg-config" ,pkg-config)))
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))))
326 (uri (string-append "mirror://sourceforge/wxsvg/wxsvg/"
327 version "/wxsvg-" version ".tar.bz2"))
330 "1hn3h9kzsjs4wimlpknzjfgn7q0n792hh7v3mshjgsjxdcrckzan"))))
331 (build-system glib-or-gtk-build-system)
333 `(("wxwidgets" ,wxwidgets-3.1)
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")
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")))))