gnu: Add emacs-highlight-sexp.
[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.for@openmailbox.org>
5 ;;; Copyright © 2016 Danny Milosavljevic <dannym@scratchpost.org>
6 ;;; Copyright © 2017 Rene Saavedra <rennes@openmailbox.org>
7 ;;;
8 ;;; This file is part of GNU Guix.
9 ;;;
10 ;;; GNU Guix is free software; you can redistribute it and/or modify it
11 ;;; under the terms of the GNU General Public License as published by
12 ;;; the Free Software Foundation; either version 3 of the License, or (at
13 ;;; your option) any later version.
14 ;;;
15 ;;; GNU Guix is distributed in the hope that it will be useful, but
16 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;;; GNU General Public License for more details.
19 ;;;
20 ;;; You should have received a copy of the GNU General Public License
21 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
22
23 (define-module (gnu packages wxwidgets)
24 #:use-module (guix packages)
25 #:use-module (guix download)
26 #:use-module ((guix licenses) #:prefix l:)
27 #:use-module (guix build-system glib-or-gtk)
28 #:use-module (guix build-system python)
29 #:use-module (guix build utils)
30 #:use-module (gnu packages)
31 #:use-module (gnu packages compression)
32 #:use-module (gnu packages databases)
33 #:use-module (gnu packages gl)
34 #:use-module (gnu packages gstreamer)
35 #:use-module (gnu packages gtk)
36 #:use-module (gnu packages image)
37 #:use-module (gnu packages pkg-config)
38 #:use-module (gnu packages python)
39 #:use-module (gnu packages sdl)
40 #:use-module (gnu packages webkit)
41 #:use-module (gnu packages xorg))
42
43 (define-public wxwidgets
44 (package
45 (name "wxwidgets")
46 (version "3.0.2")
47 (source
48 (origin
49 (method url-fetch)
50 (uri (string-append "https://github.com/wxWidgets/wxWidgets/"
51 "releases/download/v" version
52 "/wxWidgets-" version ".tar.bz2"))
53 (sha256
54 (base32 "0paq27brw4lv8kspxh9iklpa415mxi8zc117vbbbhfjgapf7js1l"))
55 (patches (search-patches
56 "wxwidgets-fix-windowGTK.patch"))))
57 (build-system glib-or-gtk-build-system)
58 (inputs
59 `(("glu" ,glu)
60 ;; XXX gstreamer-0.10 builds fail
61 ;; ("gstreamer" ,gstreamer-0.10)
62 ("gtk" ,gtk+)
63 ("libjpeg" ,libjpeg)
64 ("libmspack" ,libmspack)
65 ("libsm" ,libsm)
66 ("libtiff" ,libtiff)
67 ("mesa" ,mesa)
68 ("webkitgtk" ,webkitgtk)
69 ("sdl" ,sdl)))
70 (native-inputs
71 `(("pkg-config" ,pkg-config)))
72 (arguments
73 '(#:configure-flags
74 '("--with-regex" "--with-libmspack"
75 "--with-sdl"
76 "--enable-webview"
77 "--enable-webkit"
78 "--enable-webviewwebkit")
79 #:make-flags
80 (list (string-append "LDFLAGS=-Wl,-rpath="
81 (assoc-ref %outputs "out") "/lib"))
82 ;; No 'check' target.
83 #:tests? #f))
84 (home-page "https://www.wxwidgets.org/")
85 (synopsis "Widget toolkit for creating graphical user interfaces")
86 (description
87 "wxWidgets is a C++ library that lets developers create applications with
88 a graphical user interface. It has language bindings for Python, Perl, Ruby
89 and many other languages.")
90 (license (list l:lgpl2.0+ (l:fsf-free "file://doc/license.txt")))))
91
92 (define-public wxwidgets-gtk2
93 (package (inherit wxwidgets)
94 (inputs `(("gtk+" ,gtk+-2)
95 ,@(alist-delete
96 "gtk+"
97 (package-inputs wxwidgets))))
98 (name "wxwidgets-gtk2")))
99
100 (define-public python2-wxpython
101 (package
102 (name "python2-wxpython")
103 (version "3.0.2.0")
104 (source
105 (origin
106 (method url-fetch)
107 (uri (string-append "mirror://sourceforge/wxpython/wxPython/"
108 version "/wxPython-src-" version ".tar.bz2"))
109 (sha256
110 (base32
111 "0qfzx3sqx4mwxv99sfybhsij4b5pc03ricl73h4vhkzazgjjjhfm"))
112 (modules '((guix build utils)))
113 (snippet
114 '(begin
115 (lambda (folder)
116 (delete-file-recursively (string-append "src/" folder))
117 '("expat" "jpeg" "png" "tiff" "zlib" "msw" "osx" "msdos"))
118 (substitute* '("wxPython/setup.py")
119 ;; setup.py tries to keep its own license the same as wxwidget's
120 ;; license (which it expects under $WXWIN/docs).
121 (("'preamble.txt', 'licence.txt', 'licendoc.txt', 'lgpl.txt'")
122 ""))))))
123 (build-system python-build-system)
124 (arguments
125 `(#:python ,python-2
126 #:tests? #f ; tests fail
127 ;; wxPython directly extends distutils command classes,
128 ;; we can't easily make setup.py use setuptools.
129 #:use-setuptools? #f
130 #:configure-flags (list "WXPORT=gtk2"
131 "UNICODE=1")
132 #:phases
133 (modify-phases %standard-phases
134 (add-before 'build 'chdir
135 (lambda _
136 (chdir "wxPython")
137 #t))
138 (add-after 'chdir 'set-wx-out-dir
139 (lambda* (#:key outputs #:allow-other-keys)
140 ;; By default, install phase tries to copy the wxPython headers in
141 ;; gnu/store/...-wxwidgets-3.0.2 , which it can't, so they are
142 ;; redirected to the output directory by setting WXPREFIX.
143 (substitute* "config.py"
144 (("= getWxConfigValue\\('--prefix'\\)")
145 (string-append "= '" (assoc-ref outputs "out") "'")))
146 (substitute* "wx/build/config.py"
147 (("= getWxConfigValue\\('--prefix'\\)")
148 (string-append "= '" (assoc-ref outputs "out") "'")))
149 #t))
150 (add-after 'set-wx-out-dir 'setenv
151 (lambda* (#:key inputs outputs #:allow-other-keys)
152 (setenv "WXWIN" (assoc-ref inputs "wxwidgets"))
153 (use-modules (ice-9 popen) (ice-9 rdelim))
154 (let ((port (open-pipe* OPEN_READ
155 (string-append (assoc-ref inputs "wxwidgets")
156 "/bin/wx-config") "--cppflags")))
157 (setenv "CPPFLAGS" (read-string port))
158 (close-pipe port))
159 #t)))))
160 (native-inputs
161 `(("mesa" ,mesa) ; for glcanvas
162 ("pkg-config" ,pkg-config)))
163 (inputs
164 `(("gtk+" ,gtk+-2) ; for wxPython/src/helpers.cpp
165 ("wxwidgets" ,wxwidgets-gtk2)))
166 (synopsis "Python 2 Bindings for wxWidgets")
167 (description "@code{wxpython} provides Python 2 bindings for wxWidgets.")
168 (home-page "http://wxpython.org/")
169 (license (package-license wxwidgets))))