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 gnome)
41 #:use-module (gnu packages gstreamer)
42 #:use-module (gnu packages gtk)
43 #:use-module (gnu packages image)
44 #:use-module (gnu packages photo)
45 #:use-module (gnu packages video)
46 #:use-module (gnu packages pkg-config)
47 #:use-module (gnu packages python)
48 #:use-module (gnu packages python-xyz)
49 #:use-module (gnu packages sdl)
50 #:use-module (gnu packages webkit)
51 #:use-module (gnu packages xorg)
52 #:use-module ((srfi srfi-1) #:select (alist-delete)))
54 (define-public wxwidgets
61 (uri (string-append "https://github.com/wxWidgets/wxWidgets/"
62 "releases/download/v" version
63 "/wxWidgets-" version ".tar.bz2"))
65 (base32 "01y89999jw5q7njrhxajincx7lydls6yq37ikazjryssrxrnw3s4"))))
66 (build-system glib-or-gtk-build-system)
69 ;; XXX gstreamer-0.10 builds fail
70 ;; ("gstreamer" ,gstreamer-0.10)
72 ("libjpeg" ,libjpeg-turbo)
73 ("libmspack" ,libmspack)
77 ("webkitgtk" ,webkitgtk)
79 ("shared-mime-info" ,shared-mime-info)
80 ("xdg-utils" ,xdg-utils)))
82 `(("pkg-config" ,pkg-config)))
85 '("--with-regex" "--with-libmspack"
89 "--enable-webviewwebkit"
90 ,@(if (string=? "aarch64-linux"
92 '("--build=aarch64-unknown-linux-gnu")
95 (list (string-append "LDFLAGS=-Wl,-rpath="
96 (assoc-ref %outputs "out") "/lib"))
100 (modify-phases %standard-phases
101 (add-after 'unpack 'refer-to-inputs
102 (lambda* (#:key inputs #:allow-other-keys)
103 (let* ((mime (string-append (assoc-ref inputs "shared-mime-info")
105 (substitute* "src/unix/utilsx11.cpp"
106 (("wxExecute\\(xdg_open \\+")
107 (string-append "wxExecute(\"" (which "xdg-open") "\"")))
108 (substitute* "src/unix/mimetype.cpp"
109 (("/usr(/local)?/share/mime") mime))
111 (home-page "https://www.wxwidgets.org/")
112 (synopsis "Widget toolkit for creating graphical user interfaces")
114 "wxWidgets is a C++ library that lets developers create applications with
115 a graphical user interface. It has language bindings for Python, Perl, Ruby
116 and many other languages.")
117 (license (list l:lgpl2.0+ (l:fsf-free "file://doc/license.txt")))))
119 (define-public wxwidgets-2
126 (uri (string-append "https://github.com/wxWidgets/wxWidgets/"
127 "releases/download/v" version
128 "/wxGTK-" version ".tar.gz"))
130 (base32 "1gjs9vfga60mk4j4ngiwsk9h6c7j22pw26m3asxr1jwvqbr8kkqk"))))
133 ("libjpeg" ,libjpeg-turbo)
135 ("libmspack" ,libmspack)
137 ("unixodbc" ,unixodbc)))
140 '("--enable-unicode" "--with-regex=sys" "--with-sdl")
142 (list (string-append "LDFLAGS=-Wl,-rpath="
143 (assoc-ref %outputs "out") "/lib"))
144 ;; No 'check' target.
147 (modify-phases %standard-phases
148 (add-after 'unpack 'ignore-narrowing-errors
150 (substitute* "configure"
151 (("-Wall") "-Wall -Wno-narrowing"))
154 (define-public wxwidgets-gtk2
155 (package/inherit wxwidgets
156 (inputs `(("gtk+" ,gtk+-2)
159 (package-inputs wxwidgets))))
160 (name "wxwidgets-gtk2")))
162 ;; Development version of wxWidgets, required to build against gstreamer-1.x.
163 ;; This can be removed when wxWidgets is updated to the next stable version.
164 (define-public wxwidgets-3.1
165 (package (inherit wxwidgets)
171 (url "https://github.com/wxWidgets/wxWidgets")
172 (commit (string-append "v" version))))
173 (file-name (git-file-name "wxwidgets" version))
176 "14kl1rsngm70v3mbyv1mal15iz2b18k97avjx8jn7s81znha1c7f"))))
177 (inputs `(("gstreamer" ,gstreamer)
178 ("gst-plugins-base" ,gst-plugins-base)
179 ,@(package-inputs wxwidgets)))
181 (substitute-keyword-arguments (package-arguments wxwidgets)
182 ((#:configure-flags flags)
183 `(cons "--enable-mediactrl" ,flags))))))
185 (define-public wxwidgets-gtk2-3.1
186 (package/inherit wxwidgets-3.1
187 (inputs `(("gtk+" ,gtk+-2)
190 (package-inputs wxwidgets-3.1))))
191 (name "wxwidgets-gtk2")))
193 (define-public python-wxpython
195 (name "python-wxpython")
196 (version "4.0.7.post1")
200 (uri (pypi-uri "wxPython" version))
203 "1jppcr3n428m8pgwb9q3g0iiqydxd451ncri4njk8b53xsiflhys"))
204 (modules '((guix build utils)))
207 ;; Remove bundled wxwidgets
208 (delete-file-recursively "ext/wxWidgets")
210 (build-system python-build-system)
213 (modify-phases %standard-phases
214 (add-before 'build 'configure
215 (lambda* (#:key inputs #:allow-other-keys)
216 (setenv "WXWIN" (assoc-ref inputs "wxwidgets"))
217 ;; Copy the waf executable to the source directory since it needs
218 ;; to be in a writable directory.
219 (copy-file (string-append (assoc-ref inputs "python-waf") "/bin/waf")
221 (setenv "WAF" "bin/waf")
222 ;; The build script tries to copy license files from the
223 ;; wxwidgets source tree. Prevent it.
224 (substitute* "wscript"
225 (("updateLicenseFiles\\(cfg\\)" all)
226 (string-append "#" all)))
227 ;; The build script tries to write to demo/version.py. So, we set
228 ;; correct write permissions.
229 (chmod "demo/version.py" #o644)
230 ;; Build only the python bindings, not wxwidgets also.
231 (substitute* "setup.py"
232 (("'build']") "'build_py', '--use_syswx']"))
236 ("wxwidgets" ,wxwidgets)))
238 `(("pkg-config" ,pkg-config)
239 ("python-waf" ,python-waf)))
241 `(("python-numpy" ,python-numpy)
242 ("python-pillow" ,python-pillow)
243 ("python-six" ,python-six)))
244 (home-page "https://wxpython.org/")
245 (synopsis "Cross platform GUI toolkit for Python")
246 (description "wxPython is a cross-platform GUI toolkit for the Python
247 programming language. It is implemented as a set of Python extension modules
248 that wrap the GUI components of the popular wxWidgets cross platform C++
249 library. In most cases, wxPython uses the native widgets on each platform to
250 provide a 100% native look and feel for the application.")
251 (license l:wxwindows3.1+)))
253 (define-public python2-wxpython
255 (name "python2-wxpython")
260 (uri (string-append "mirror://sourceforge/wxpython/wxPython/"
261 version "/wxPython-src-" version ".tar.bz2"))
264 "0qfzx3sqx4mwxv99sfybhsij4b5pc03ricl73h4vhkzazgjjjhfm"))
265 (modules '((guix build utils)))
269 (delete-file-recursively (string-append "src/" folder))
270 '("expat" "jpeg" "png" "tiff" "zlib" "msw" "osx" "msdos"))
271 (substitute* '("wxPython/setup.py")
272 ;; setup.py tries to keep its own license the same as wxwidget's
273 ;; license (which it expects under $WXWIN/docs).
274 (("'preamble.txt', 'licence.txt', 'licendoc.txt', 'lgpl.txt'")
277 (build-system python-build-system)
280 #:tests? #f ; tests fail
281 ;; wxPython directly extends distutils command classes,
282 ;; we can't easily make setup.py use setuptools.
284 #:configure-flags (list "WXPORT=gtk2"
287 (modify-phases %standard-phases
288 (add-before 'build 'chdir
292 (add-after 'chdir 'set-wx-out-dir
293 (lambda* (#:key outputs #:allow-other-keys)
294 ;; By default, install phase tries to copy the wxPython headers in
295 ;; gnu/store/...-wxwidgets-3.0.2 , which it can't, so they are
296 ;; redirected to the output directory by setting WXPREFIX.
297 (substitute* "config.py"
298 (("= getWxConfigValue\\('--prefix'\\)")
299 (string-append "= '" (assoc-ref outputs "out") "'")))
300 (substitute* "wx/build/config.py"
301 (("= getWxConfigValue\\('--prefix'\\)")
302 (string-append "= '" (assoc-ref outputs "out") "'")))
304 (add-after 'set-wx-out-dir 'setenv
305 (lambda* (#:key inputs outputs #:allow-other-keys)
306 (setenv "WXWIN" (assoc-ref inputs "wxwidgets"))
307 (use-modules (ice-9 popen) (ice-9 rdelim))
308 (let ((port (open-pipe* OPEN_READ
309 (string-append (assoc-ref inputs "wxwidgets")
310 "/bin/wx-config") "--cppflags")))
311 (setenv "CPPFLAGS" (read-string port))
315 `(("mesa" ,mesa) ; for glcanvas
316 ("pkg-config" ,pkg-config)))
318 `(("gtk+" ,gtk+-2) ; for wxPython/src/helpers.cpp
319 ("wxwidgets" ,wxwidgets-gtk2)))
320 (synopsis "Python 2 Bindings for wxWidgets")
321 (description "@code{wxpython} provides Python 2 bindings for wxWidgets.")
322 (home-page "https://wxpython.org/")
323 (license (package-license wxwidgets))))
332 (uri (string-append "mirror://sourceforge/wxsvg/wxsvg/"
333 version "/wxsvg-" version ".tar.bz2"))
336 "1hn3h9kzsjs4wimlpknzjfgn7q0n792hh7v3mshjgsjxdcrckzan"))))
337 (build-system glib-or-gtk-build-system)
339 `(("wxwidgets" ,wxwidgets-3.1)
345 `(("pkg-config" ,pkg-config)))
346 (synopsis "C++ library to create, manipulate and render SVG files")
347 (description "wxSVG is a C++ library to create, manipulate and render
348 @dfn{Scalable Vector Graphics} (SVG) files with the wxWidgets toolkit.")
349 (home-page "http://wxsvg.sourceforge.net")
351 ;; wxSVG is licenced under the "wxWindows library licence", which is
352 ;; the LGPL2.0+, with a few extra permissions.
353 (license (list l:lgpl2.0+ (l:fsf-free "file://COPYING")))))