gnu: All snippets report errors using exceptions, else return #t.
[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 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 ;;;
11 ;;; This file is part of GNU Guix.
12 ;;;
13 ;;; GNU Guix is free software; you can redistribute it and/or modify it
14 ;;; under the terms of the GNU General Public License as published by
15 ;;; the Free Software Foundation; either version 3 of the License, or (at
16 ;;; your option) any later version.
17 ;;;
18 ;;; GNU Guix is distributed in the hope that it will be useful, but
19 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
20 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ;;; GNU General Public License for more details.
22 ;;;
23 ;;; You should have received a copy of the GNU General Public License
24 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
25
26 (define-module (gnu packages wxwidgets)
27 #:use-module (guix packages)
28 #:use-module (guix download)
29 #:use-module ((guix licenses) #:prefix l:)
30 #:use-module (guix build-system glib-or-gtk)
31 #:use-module (guix build-system python)
32 #:use-module (guix build utils)
33 #:use-module (guix utils)
34 #:use-module (gnu packages)
35 #:use-module (gnu packages compression)
36 #:use-module (gnu packages databases)
37 #:use-module (gnu packages gl)
38 #:use-module (gnu packages gstreamer)
39 #:use-module (gnu packages gtk)
40 #:use-module (gnu packages image)
41 #:use-module (gnu packages photo)
42 #:use-module (gnu packages video)
43 #:use-module (gnu packages pkg-config)
44 #:use-module (gnu packages python)
45 #:use-module (gnu packages sdl)
46 #:use-module (gnu packages webkit)
47 #:use-module (gnu packages xorg))
48
49 (define-public wxwidgets
50 (package
51 (name "wxwidgets")
52 (version "3.0.3")
53 (source
54 (origin
55 (method url-fetch)
56 (uri (string-append "https://github.com/wxWidgets/wxWidgets/"
57 "releases/download/v" version
58 "/wxWidgets-" version ".tar.bz2"))
59 (sha256
60 (base32 "0yrhp5cs2g33cpbdwdzicmm5m4mfnlvxwv031x9266zc90zh7j08"))))
61 (build-system glib-or-gtk-build-system)
62 (inputs
63 `(("glu" ,glu)
64 ;; XXX gstreamer-0.10 builds fail
65 ;; ("gstreamer" ,gstreamer-0.10)
66 ("gtk" ,gtk+)
67 ("libjpeg" ,libjpeg)
68 ("libmspack" ,libmspack)
69 ("libsm" ,libsm)
70 ("libtiff" ,libtiff)
71 ("mesa" ,mesa)
72 ("webkitgtk" ,webkitgtk)
73 ("sdl" ,sdl)))
74 (native-inputs
75 `(("pkg-config" ,pkg-config)))
76 (arguments
77 `(#:configure-flags
78 '("--with-regex" "--with-libmspack"
79 "--with-sdl"
80 "--enable-webview"
81 "--enable-webkit"
82 "--enable-webviewwebkit"
83 ,@(if (string=? "aarch64-linux"
84 (%current-system))
85 '("--build=aarch64-unknown-linux-gnu")
86 '()))
87 #:make-flags
88 (list (string-append "LDFLAGS=-Wl,-rpath="
89 (assoc-ref %outputs "out") "/lib"))
90 ;; No 'check' target.
91 #:tests? #f))
92 (home-page "https://www.wxwidgets.org/")
93 (synopsis "Widget toolkit for creating graphical user interfaces")
94 (description
95 "wxWidgets is a C++ library that lets developers create applications with
96 a graphical user interface. It has language bindings for Python, Perl, Ruby
97 and many other languages.")
98 (license (list l:lgpl2.0+ (l:fsf-free "file://doc/license.txt")))))
99
100 (define-public wxwidgets-2
101 (package
102 (inherit wxwidgets)
103 (version "2.8.12")
104 (source
105 (origin
106 (method url-fetch)
107 (uri (string-append "https://github.com/wxWidgets/wxWidgets/"
108 "releases/download/v" version
109 "/wxGTK-" version ".tar.gz"))
110 (sha256
111 (base32 "1gjs9vfga60mk4j4ngiwsk9h6c7j22pw26m3asxr1jwvqbr8kkqk"))))
112 (inputs
113 `(("gtk" ,gtk+-2)
114 ("libjpeg" ,libjpeg)
115 ("libtiff" ,libtiff)
116 ("libmspack" ,libmspack)
117 ("sdl" ,sdl)
118 ("unixodbc" ,unixodbc)))
119 (arguments
120 `(#:configure-flags
121 '("--enable-unicode" "--with-regex=sys" "--with-sdl")
122 #:make-flags
123 (list (string-append "LDFLAGS=-Wl,-rpath="
124 (assoc-ref %outputs "out") "/lib"))
125 ;; No 'check' target.
126 #:tests? #f))))
127
128 (define-public wxwidgets-gtk2
129 (package (inherit wxwidgets)
130 (inputs `(("gtk+" ,gtk+-2)
131 ,@(alist-delete
132 "gtk+"
133 (package-inputs wxwidgets))))
134 (name "wxwidgets-gtk2")))
135
136 ;; Development version of wxWidgets, required to build against gstreamer-1.x.
137 ;; This can be removed when wxWidgets is updated to the next stable version.
138 (define-public wxwidgets-3.1
139 (package (inherit wxwidgets)
140 (version "3.1.0")
141 (source
142 (origin
143 (method url-fetch)
144 (uri (string-append "https://github.com/wxWidgets/wxWidgets/archive/v"
145 version ".tar.gz"))
146 (file-name (string-append "wxwidgets-" version ".tar.gz"))
147 (sha256
148 (base32 "1yan5ysjwh6a7xw82sfjd1xn0nsy1dn2s0cx9ac7cw19191blc3y"))))
149 (inputs `(("gstreamer" ,gstreamer)
150 ("gst-plugins-base" ,gst-plugins-base)
151 ,@(package-inputs wxwidgets)))
152 (arguments
153 (substitute-keyword-arguments (package-arguments wxwidgets)
154 ((#:configure-flags flags)
155 `(cons "--enable-mediactrl" ,flags))))))
156
157 (define-public wxwidgets-gtk2-3.1
158 (package (inherit wxwidgets-3.1)
159 (inputs `(("gtk+" ,gtk+-2)
160 ,@(alist-delete
161 "gtk+"
162 (package-inputs wxwidgets-3.1))))
163 (name "wxwidgets-gtk2")))
164
165 (define-public python2-wxpython
166 (package
167 (name "python2-wxpython")
168 (version "3.0.2.0")
169 (source
170 (origin
171 (method url-fetch)
172 (uri (string-append "mirror://sourceforge/wxpython/wxPython/"
173 version "/wxPython-src-" version ".tar.bz2"))
174 (sha256
175 (base32
176 "0qfzx3sqx4mwxv99sfybhsij4b5pc03ricl73h4vhkzazgjjjhfm"))
177 (modules '((guix build utils)))
178 (snippet
179 '(begin
180 (lambda (folder)
181 (delete-file-recursively (string-append "src/" folder))
182 '("expat" "jpeg" "png" "tiff" "zlib" "msw" "osx" "msdos"))
183 (substitute* '("wxPython/setup.py")
184 ;; setup.py tries to keep its own license the same as wxwidget's
185 ;; license (which it expects under $WXWIN/docs).
186 (("'preamble.txt', 'licence.txt', 'licendoc.txt', 'lgpl.txt'")
187 ""))
188 #t))))
189 (build-system python-build-system)
190 (arguments
191 `(#:python ,python-2
192 #:tests? #f ; tests fail
193 ;; wxPython directly extends distutils command classes,
194 ;; we can't easily make setup.py use setuptools.
195 #:use-setuptools? #f
196 #:configure-flags (list "WXPORT=gtk2"
197 "UNICODE=1")
198 #:phases
199 (modify-phases %standard-phases
200 (add-before 'build 'chdir
201 (lambda _
202 (chdir "wxPython")
203 #t))
204 (add-after 'chdir 'set-wx-out-dir
205 (lambda* (#:key outputs #:allow-other-keys)
206 ;; By default, install phase tries to copy the wxPython headers in
207 ;; gnu/store/...-wxwidgets-3.0.2 , which it can't, so they are
208 ;; redirected to the output directory by setting WXPREFIX.
209 (substitute* "config.py"
210 (("= getWxConfigValue\\('--prefix'\\)")
211 (string-append "= '" (assoc-ref outputs "out") "'")))
212 (substitute* "wx/build/config.py"
213 (("= getWxConfigValue\\('--prefix'\\)")
214 (string-append "= '" (assoc-ref outputs "out") "'")))
215 #t))
216 (add-after 'set-wx-out-dir 'setenv
217 (lambda* (#:key inputs outputs #:allow-other-keys)
218 (setenv "WXWIN" (assoc-ref inputs "wxwidgets"))
219 (use-modules (ice-9 popen) (ice-9 rdelim))
220 (let ((port (open-pipe* OPEN_READ
221 (string-append (assoc-ref inputs "wxwidgets")
222 "/bin/wx-config") "--cppflags")))
223 (setenv "CPPFLAGS" (read-string port))
224 (close-pipe port))
225 #t)))))
226 (native-inputs
227 `(("mesa" ,mesa) ; for glcanvas
228 ("pkg-config" ,pkg-config)))
229 (inputs
230 `(("gtk+" ,gtk+-2) ; for wxPython/src/helpers.cpp
231 ("wxwidgets" ,wxwidgets-gtk2)))
232 (synopsis "Python 2 Bindings for wxWidgets")
233 (description "@code{wxpython} provides Python 2 bindings for wxWidgets.")
234 (home-page "http://wxpython.org/")
235 (license (package-license wxwidgets))))
236
237 (define-public wxsvg
238 (package
239 (name "wxsvg")
240 (version "1.5.12")
241 (source
242 (origin
243 (method url-fetch)
244 (uri (string-append "mirror://sourceforge/wxsvg/wxsvg/"
245 version "/wxsvg-" version ".tar.bz2"))
246 (sha256
247 (base32
248 "1hn3h9kzsjs4wimlpknzjfgn7q0n792hh7v3mshjgsjxdcrckzan"))))
249 (build-system glib-or-gtk-build-system)
250 (inputs
251 `(("wxwidgets" ,wxwidgets-3.1)
252 ("cairo" ,cairo)
253 ("pango" ,pango)
254 ("libexif" ,libexif)
255 ("ffmpeg" ,ffmpeg)))
256 (native-inputs
257 `(("pkg-config" ,pkg-config)))
258 (synopsis "C++ library to create, manipulate and render SVG files")
259 (description "wxSVG is a C++ library to create, manipulate and render
260 @dfn{Scalable Vector Graphics} (SVG) files with the wxWidgets toolkit.")
261 (home-page "http://wxsvg.sourceforge.net")
262
263 ;; wxSVG is licenced under the "wxWindows library licence", which is
264 ;; the LGPL2.0+, with a few extra permissions.
265 (license (list l:lgpl2.0+ (l:fsf-free "file://COPYING")))))