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