gnu: python-pandas: Fix build on 32-bit.
[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-2.4)
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-2
93 (package
94 (inherit wxwidgets)
95 (version "2.8.12")
96 (source
97 (origin
98 (method url-fetch)
99 (uri (string-append "https://github.com/wxWidgets/wxWidgets/"
100 "releases/download/v" version
101 "/wxGTK-" version ".tar.gz"))
102 (sha256
103 (base32 "1gjs9vfga60mk4j4ngiwsk9h6c7j22pw26m3asxr1jwvqbr8kkqk"))))
104 (inputs
105 `(("gtk" ,gtk+-2)
106 ("libjpeg" ,libjpeg)
107 ("libtiff" ,libtiff)
108 ("libmspack" ,libmspack)
109 ("sdl" ,sdl)
110 ("unixodbc" ,unixodbc)))
111 (arguments
112 `(#:configure-flags
113 '("--enable-unicode" "--with-regex=sys" "--with-sdl")
114 #:make-flags
115 (list (string-append "LDFLAGS=-Wl,-rpath="
116 (assoc-ref %outputs "out") "/lib"))
117 ;; No 'check' target.
118 #:tests? #f))))
119
120 (define-public wxwidgets-gtk2
121 (package (inherit wxwidgets)
122 (inputs `(("gtk+" ,gtk+-2)
123 ,@(alist-delete
124 "gtk+"
125 (package-inputs wxwidgets))))
126 (name "wxwidgets-gtk2")))
127
128 (define-public python2-wxpython
129 (package
130 (name "python2-wxpython")
131 (version "3.0.2.0")
132 (source
133 (origin
134 (method url-fetch)
135 (uri (string-append "mirror://sourceforge/wxpython/wxPython/"
136 version "/wxPython-src-" version ".tar.bz2"))
137 (sha256
138 (base32
139 "0qfzx3sqx4mwxv99sfybhsij4b5pc03ricl73h4vhkzazgjjjhfm"))
140 (modules '((guix build utils)))
141 (snippet
142 '(begin
143 (lambda (folder)
144 (delete-file-recursively (string-append "src/" folder))
145 '("expat" "jpeg" "png" "tiff" "zlib" "msw" "osx" "msdos"))
146 (substitute* '("wxPython/setup.py")
147 ;; setup.py tries to keep its own license the same as wxwidget's
148 ;; license (which it expects under $WXWIN/docs).
149 (("'preamble.txt', 'licence.txt', 'licendoc.txt', 'lgpl.txt'")
150 ""))))))
151 (build-system python-build-system)
152 (arguments
153 `(#:python ,python-2
154 #:tests? #f ; tests fail
155 ;; wxPython directly extends distutils command classes,
156 ;; we can't easily make setup.py use setuptools.
157 #:use-setuptools? #f
158 #:configure-flags (list "WXPORT=gtk2"
159 "UNICODE=1")
160 #:phases
161 (modify-phases %standard-phases
162 (add-before 'build 'chdir
163 (lambda _
164 (chdir "wxPython")
165 #t))
166 (add-after 'chdir 'set-wx-out-dir
167 (lambda* (#:key outputs #:allow-other-keys)
168 ;; By default, install phase tries to copy the wxPython headers in
169 ;; gnu/store/...-wxwidgets-3.0.2 , which it can't, so they are
170 ;; redirected to the output directory by setting WXPREFIX.
171 (substitute* "config.py"
172 (("= getWxConfigValue\\('--prefix'\\)")
173 (string-append "= '" (assoc-ref outputs "out") "'")))
174 (substitute* "wx/build/config.py"
175 (("= getWxConfigValue\\('--prefix'\\)")
176 (string-append "= '" (assoc-ref outputs "out") "'")))
177 #t))
178 (add-after 'set-wx-out-dir 'setenv
179 (lambda* (#:key inputs outputs #:allow-other-keys)
180 (setenv "WXWIN" (assoc-ref inputs "wxwidgets"))
181 (use-modules (ice-9 popen) (ice-9 rdelim))
182 (let ((port (open-pipe* OPEN_READ
183 (string-append (assoc-ref inputs "wxwidgets")
184 "/bin/wx-config") "--cppflags")))
185 (setenv "CPPFLAGS" (read-string port))
186 (close-pipe port))
187 #t)))))
188 (native-inputs
189 `(("mesa" ,mesa) ; for glcanvas
190 ("pkg-config" ,pkg-config)))
191 (inputs
192 `(("gtk+" ,gtk+-2) ; for wxPython/src/helpers.cpp
193 ("wxwidgets" ,wxwidgets-gtk2)))
194 (synopsis "Python 2 Bindings for wxWidgets")
195 (description "@code{wxpython} provides Python 2 bindings for wxWidgets.")
196 (home-page "http://wxpython.org/")
197 (license (package-license wxwidgets))))