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