| 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> |
| 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 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))) |
| 53 | |
| 54 | (define-public wxwidgets |
| 55 | (package |
| 56 | (name "wxwidgets") |
| 57 | (version "3.0.5.1") |
| 58 | (source |
| 59 | (origin |
| 60 | (method url-fetch) |
| 61 | (uri (string-append "https://github.com/wxWidgets/wxWidgets/" |
| 62 | "releases/download/v" version |
| 63 | "/wxWidgets-" version ".tar.bz2")) |
| 64 | (sha256 |
| 65 | (base32 "01y89999jw5q7njrhxajincx7lydls6yq37ikazjryssrxrnw3s4")))) |
| 66 | (build-system glib-or-gtk-build-system) |
| 67 | (inputs |
| 68 | `(("glu" ,glu) |
| 69 | ;; XXX gstreamer-0.10 builds fail |
| 70 | ;; ("gstreamer" ,gstreamer-0.10) |
| 71 | ("gtk" ,gtk+) |
| 72 | ("libjpeg" ,libjpeg-turbo) |
| 73 | ("libmspack" ,libmspack) |
| 74 | ("libsm" ,libsm) |
| 75 | ("libtiff" ,libtiff) |
| 76 | ("mesa" ,mesa) |
| 77 | ("webkitgtk" ,webkitgtk) |
| 78 | ("sdl" ,sdl) |
| 79 | ("shared-mime-info" ,shared-mime-info) |
| 80 | ("xdg-utils" ,xdg-utils))) |
| 81 | (native-inputs |
| 82 | `(("pkg-config" ,pkg-config))) |
| 83 | (arguments |
| 84 | `(#:configure-flags |
| 85 | '("--with-regex" "--with-libmspack" |
| 86 | "--with-sdl" |
| 87 | "--enable-webview" |
| 88 | "--enable-webkit" |
| 89 | "--enable-webviewwebkit" |
| 90 | ,@(if (string=? "aarch64-linux" |
| 91 | (%current-system)) |
| 92 | '("--build=aarch64-unknown-linux-gnu") |
| 93 | '())) |
| 94 | #:make-flags |
| 95 | (list (string-append "LDFLAGS=-Wl,-rpath=" |
| 96 | (assoc-ref %outputs "out") "/lib")) |
| 97 | ;; No 'check' target. |
| 98 | #:tests? #f |
| 99 | #:phases |
| 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") |
| 104 | "/share/mime"))) |
| 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)) |
| 110 | #t)))))) |
| 111 | (home-page "https://www.wxwidgets.org/") |
| 112 | (synopsis "Widget toolkit for creating graphical user interfaces") |
| 113 | (description |
| 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"))))) |
| 118 | |
| 119 | (define-public wxwidgets-2 |
| 120 | (package |
| 121 | (inherit wxwidgets) |
| 122 | (version "2.8.12") |
| 123 | (source |
| 124 | (origin |
| 125 | (method url-fetch) |
| 126 | (uri (string-append "https://github.com/wxWidgets/wxWidgets/" |
| 127 | "releases/download/v" version |
| 128 | "/wxGTK-" version ".tar.gz")) |
| 129 | (sha256 |
| 130 | (base32 "1gjs9vfga60mk4j4ngiwsk9h6c7j22pw26m3asxr1jwvqbr8kkqk")))) |
| 131 | (inputs |
| 132 | `(("gtk" ,gtk+-2) |
| 133 | ("libjpeg" ,libjpeg-turbo) |
| 134 | ("libtiff" ,libtiff) |
| 135 | ("libmspack" ,libmspack) |
| 136 | ("sdl" ,sdl) |
| 137 | ("unixodbc" ,unixodbc))) |
| 138 | (arguments |
| 139 | `(#:configure-flags |
| 140 | '("--enable-unicode" "--with-regex=sys" "--with-sdl") |
| 141 | #:make-flags |
| 142 | (list (string-append "LDFLAGS=-Wl,-rpath=" |
| 143 | (assoc-ref %outputs "out") "/lib")) |
| 144 | ;; No 'check' target. |
| 145 | #:tests? #f |
| 146 | #:phases |
| 147 | (modify-phases %standard-phases |
| 148 | (add-after 'unpack 'ignore-narrowing-errors |
| 149 | (lambda _ |
| 150 | (substitute* "configure" |
| 151 | (("-Wall") "-Wall -Wno-narrowing")) |
| 152 | #t))))))) |
| 153 | |
| 154 | (define-public wxwidgets-gtk2 |
| 155 | (package/inherit wxwidgets |
| 156 | (inputs `(("gtk+" ,gtk+-2) |
| 157 | ,@(alist-delete |
| 158 | "gtk+" |
| 159 | (package-inputs wxwidgets)))) |
| 160 | (name "wxwidgets-gtk2"))) |
| 161 | |
| 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) |
| 166 | (version "3.1.0") |
| 167 | (source |
| 168 | (origin |
| 169 | (method git-fetch) |
| 170 | (uri (git-reference |
| 171 | (url "https://github.com/wxWidgets/wxWidgets") |
| 172 | (commit (string-append "v" version)))) |
| 173 | (file-name (git-file-name "wxwidgets" version)) |
| 174 | (sha256 |
| 175 | (base32 |
| 176 | "14kl1rsngm70v3mbyv1mal15iz2b18k97avjx8jn7s81znha1c7f")))) |
| 177 | (inputs `(("gstreamer" ,gstreamer) |
| 178 | ("gst-plugins-base" ,gst-plugins-base) |
| 179 | ,@(package-inputs wxwidgets))) |
| 180 | (arguments |
| 181 | (substitute-keyword-arguments (package-arguments wxwidgets) |
| 182 | ((#:configure-flags flags) |
| 183 | `(cons "--enable-mediactrl" ,flags)))))) |
| 184 | |
| 185 | (define-public wxwidgets-gtk2-3.1 |
| 186 | (package/inherit wxwidgets-3.1 |
| 187 | (inputs `(("gtk+" ,gtk+-2) |
| 188 | ,@(alist-delete |
| 189 | "gtk+" |
| 190 | (package-inputs wxwidgets-3.1)))) |
| 191 | (name "wxwidgets-gtk2"))) |
| 192 | |
| 193 | (define-public python-wxpython |
| 194 | (package |
| 195 | (name "python-wxpython") |
| 196 | (version "4.0.7.post1") |
| 197 | (source |
| 198 | (origin |
| 199 | (method url-fetch) |
| 200 | (uri (pypi-uri "wxPython" version)) |
| 201 | (sha256 |
| 202 | (base32 |
| 203 | "1jppcr3n428m8pgwb9q3g0iiqydxd451ncri4njk8b53xsiflhys")) |
| 204 | (modules '((guix build utils))) |
| 205 | (snippet |
| 206 | '(begin |
| 207 | ;; Remove bundled wxwidgets |
| 208 | (delete-file-recursively "ext/wxWidgets") |
| 209 | #t)))) |
| 210 | (build-system python-build-system) |
| 211 | (arguments |
| 212 | `(#:phases |
| 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") |
| 220 | "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']")) |
| 233 | #t))))) |
| 234 | (inputs |
| 235 | `(("gtk+" ,gtk+) |
| 236 | ("wxwidgets" ,wxwidgets))) |
| 237 | (native-inputs |
| 238 | `(("pkg-config" ,pkg-config) |
| 239 | ("python-waf" ,python-waf))) |
| 240 | (propagated-inputs |
| 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+))) |
| 252 | |
| 253 | (define-public python2-wxpython |
| 254 | (package |
| 255 | (name "python2-wxpython") |
| 256 | (version "3.0.2.0") |
| 257 | (source |
| 258 | (origin |
| 259 | (method url-fetch) |
| 260 | (uri (string-append "mirror://sourceforge/wxpython/wxPython/" |
| 261 | version "/wxPython-src-" version ".tar.bz2")) |
| 262 | (sha256 |
| 263 | (base32 |
| 264 | "0qfzx3sqx4mwxv99sfybhsij4b5pc03ricl73h4vhkzazgjjjhfm")) |
| 265 | (modules '((guix build utils))) |
| 266 | (snippet |
| 267 | '(begin |
| 268 | (lambda (folder) |
| 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'") |
| 275 | "")) |
| 276 | #t)))) |
| 277 | (build-system python-build-system) |
| 278 | (arguments |
| 279 | `(#:python ,python-2 |
| 280 | #:tests? #f ; tests fail |
| 281 | ;; wxPython directly extends distutils command classes, |
| 282 | ;; we can't easily make setup.py use setuptools. |
| 283 | #:use-setuptools? #f |
| 284 | #:configure-flags (list "WXPORT=gtk2" |
| 285 | "UNICODE=1") |
| 286 | #:phases |
| 287 | (modify-phases %standard-phases |
| 288 | (add-before 'build 'chdir |
| 289 | (lambda _ |
| 290 | (chdir "wxPython") |
| 291 | #t)) |
| 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") "'"))) |
| 303 | #t)) |
| 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)) |
| 312 | (close-pipe port)) |
| 313 | #t))))) |
| 314 | (native-inputs |
| 315 | `(("mesa" ,mesa) ; for glcanvas |
| 316 | ("pkg-config" ,pkg-config))) |
| 317 | (inputs |
| 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)))) |
| 324 | |
| 325 | (define-public wxsvg |
| 326 | (package |
| 327 | (name "wxsvg") |
| 328 | (version "1.5.12") |
| 329 | (source |
| 330 | (origin |
| 331 | (method url-fetch) |
| 332 | (uri (string-append "mirror://sourceforge/wxsvg/wxsvg/" |
| 333 | version "/wxsvg-" version ".tar.bz2")) |
| 334 | (sha256 |
| 335 | (base32 |
| 336 | "1hn3h9kzsjs4wimlpknzjfgn7q0n792hh7v3mshjgsjxdcrckzan")))) |
| 337 | (build-system glib-or-gtk-build-system) |
| 338 | (inputs |
| 339 | `(("wxwidgets" ,wxwidgets-3.1) |
| 340 | ("cairo" ,cairo) |
| 341 | ("pango" ,pango) |
| 342 | ("libexif" ,libexif) |
| 343 | ("ffmpeg" ,ffmpeg))) |
| 344 | (native-inputs |
| 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") |
| 350 | |
| 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"))))) |