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