projects/guix·blob java-team · refs

372 lines · 15.0 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2015 Taylan Ulrich Bayırlı/Kammer <[email protected]>
3;;; Copyright © 2016, 2018, 2020 Ricardo Wurmus <[email protected]>
4;;; Copyright © 2016 Theodoros Foradis <[email protected]>
5;;; Copyright © 2016 Danny Milosavljevic <[email protected]>
6;;; Copyright © 2017 Rene Saavedra <[email protected]>
7;;; Copyright © 2017 Efraim Flashner <[email protected]>
8;;; Copyright © 2017 Thomas Danckaert <[email protected]>
9;;; Copyright © 2018, 2020, 2021 Tobias Geerinckx-Rice <[email protected]>
10;;; Copyright © 2019 Arun Isaac <[email protected]>
11;;; Copyright © 2022 Marius Bakke <[email protected]>
12;;; Copyright © 2023, 2025 Andreas Enge <[email protected]>
13;;; Copyright © 2023 Malte Frank Gerdes <[email protected]>
14;;; Copyright © 2023 Maxim Cournoyer <[email protected]>
15;;; Copyright © 2025 Ekaitz Zarraga <[email protected]>
16;;; Copyright © 2025 Nicolas Graves <[email protected]>
17;;;
18;;; This file is part of GNU Guix.
19;;;
20;;; GNU Guix is free software; you can redistribute it and/or modify it
21;;; under the terms of the GNU General Public License as published by
22;;; the Free Software Foundation; either version 3 of the License, or (at
23;;; your option) any later version.
24;;;
25;;; GNU Guix is distributed in the hope that it will be useful, but
26;;; WITHOUT ANY WARRANTY; without even the implied warranty of
27;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28;;; GNU General Public License for more details.
29;;;
30;;; You should have received a copy of the GNU General Public License
31;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
32
33(define-module (gnu packages wxwidgets)
34 #:use-module (guix packages)
35 #:use-module (guix gexp)
36 #:use-module (guix download)
37 #:use-module (guix git-download)
38 #:use-module ((guix licenses) #:prefix l:)
39 #:use-module (guix build-system glib-or-gtk)
40 #:use-module (guix build-system perl)
41 #:use-module (guix build-system pyproject)
42 #:use-module (guix utils)
43 #:use-module (gnu packages)
44 #:use-module (gnu packages build-tools)
45 #:use-module (gnu packages check)
46 #:use-module (gnu packages curl)
47 #:use-module (gnu packages compression)
48 #:use-module (gnu packages databases)
49 #:use-module (gnu packages freedesktop)
50 #:use-module (gnu packages gl)
51 #:use-module (gnu packages gnome)
52 #:use-module (gnu packages graphics)
53 #:use-module (gnu packages gstreamer)
54 #:use-module (gnu packages gtk)
55 #:use-module (gnu packages image)
56 #:use-module (gnu packages pcre)
57 #:use-module (gnu packages perl)
58 #:use-module (gnu packages perl-check)
59 #:use-module (gnu packages photo)
60 #:use-module (gnu packages pkg-config)
61 #:use-module (gnu packages python)
62 #:use-module (gnu packages python-build)
63 #:use-module (gnu packages python-xyz)
64 #:use-module (gnu packages qt)
65 #:use-module (gnu packages sdl)
66 #:use-module (gnu packages video)
67 #:use-module (gnu packages web)
68 #:use-module (gnu packages webkit)
69 #:use-module (gnu packages xml)
70 #:use-module (gnu packages xorg))
71
72(define-public wxwidgets
73 (package
74 (name "wxwidgets")
75 ;; There is a newer versions 3.3, but this is tagged "development".
76 (version "3.2.11")
77 (source
78 (origin
79 (method url-fetch)
80 (uri (string-append "https://github.com/wxWidgets/wxWidgets/"
81 "releases/download/v" version
82 "/wxWidgets-" version ".tar.bz2"))
83 (sha256
84 (base32 "025gj1mdn2ilp0p2zsa73n065naahl8l9v31pzj19sg2phar04ka"))
85 (modules '((guix build utils)
86 (ice-9 ftw)
87 (srfi srfi-26)))
88 (snippet
89 '(begin
90 ;; wxWidgets bundles third-party code in the "3rdparty" directory as
91 ;; well as the "src" directory. Remove external components that are
92 ;; not required.
93 (let ((preserved-3rdparty '("nanosvg"))
94 ;; The src directory contains a mixture of third party libraries
95 ;; and similarly-named integration code. Cautiously use a
96 ;; blacklist approach here.
97 (bundled-src '("expat" "jpeg" "png" "tiff" "zlib")))
98 (with-directory-excursion "3rdparty"
99 (for-each delete-file-recursively
100 (scandir "." (negate (cut member <>
101 (append '("." "..")
102 preserved-3rdparty))))))
103 (with-directory-excursion "src"
104 (for-each delete-file-recursively bundled-src)))))))
105 (outputs '("out" "debug"))
106 (build-system glib-or-gtk-build-system)
107 (inputs
108 (list catch-framework
109 curl
110 expat
111 glu
112 gstreamer
113 gst-plugins-base
114 gtk+
115 libjpeg-turbo
116 libmspack
117 libnotify
118 libpng
119 libsecret
120 libsm
121 libtiff
122 libxtst ;for wxUIActionSimulator
123 mesa
124 pcre2
125 sdl2
126 shared-mime-info
127 webkitgtk-for-gtk3
128 xdg-utils
129 zlib))
130 (native-inputs
131 (list pkg-config))
132 (arguments
133 (list
134 #:configure-flags #~'("--with-libmspack"
135 "--with-regex"
136 "--with-sdl"
137 "--enable-debug_info"
138 "--enable-gui"
139 "--enable-mediactrl"
140 "--enable-webview")
141 #:make-flags
142 #~(list (string-append "LDFLAGS=-Wl,-rpath=" #$output "/lib"))
143 #:tests? #f ;TODO
144 #:phases
145 #~(modify-phases %standard-phases
146 (add-after 'unpack 'refer-to-inputs
147 (lambda* (#:key inputs #:allow-other-keys)
148 (let ((catch (search-input-file inputs "include/catch.hpp"))
149 (mime (search-input-directory inputs "share/mime"))
150 (xdg-open (search-input-file inputs "bin/xdg-open")))
151 (install-file catch "3rdparty/catch/include/")
152 (substitute* "src/unix/utilsx11.cpp"
153 (("wxExecute\\(xdg_open \\+")
154 (string-append "wxExecute(\"" xdg-open "\"")))
155 (substitute* "src/unix/mimetype.cpp"
156 (("/usr(/local)?/share/mime")
157 mime)))))
158 (replace 'configure
159 (lambda* (#:key native-inputs inputs configure-flags
160 #:allow-other-keys)
161 (let ((sh (search-input-file (or native-inputs inputs)
162 "bin/sh")))
163 ;; The configure script does not understand some of the default
164 ;; options of gnu-build-system, so run it "by hand".
165 (apply invoke "./configure"
166 (string-append "SHELL=" sh)
167 (string-append "CONFIG_SHELL=" sh)
168 (string-append "--prefix=" #$output)
169 configure-flags)))))))
170 (home-page "https://wxwidgets.org/")
171 (synopsis "Widget toolkit for creating graphical user interfaces")
172 (description
173 "wxWidgets is a C++ library that lets developers create applications with
174a graphical user interface. It has language bindings for Python, Perl, Ruby
175and many other languages.")
176 (license (list l:lgpl2.0+ (l:fsf-free "file://doc/license.txt")))))
177
178(define-public wxwidgets-sans-egl
179 ;; This is needed for prusaslicer:
180 ;; <https://github.com/NixOS/nixpkgs/issues/193135>.)
181 ;; and KiCAD:
182 ;; <https://forum.kicad.info/t/kicad-8-0-x-could-not-use-opengl-debian-guix/53203/7>
183 ;; Relevant debian bug report:
184 ;; <https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1024147;msg=5>
185 ;; Tl;dr; wxWidgets uses EGL but Glew 2.2 doesn't. Leading to errors.
186 (package/inherit wxwidgets
187 (name "wxwidgets-sans-egl")
188 (arguments
189 (substitute-keyword-arguments arguments
190 ((#:configure-flags flags)
191 #~(cons "--disable-glcanvasegl" #$flags))))))
192
193(define-public wxwidgets-3.0
194 (package
195 (inherit wxwidgets)
196 (version "3.0.5.1")
197 (source (origin
198 (method url-fetch)
199 (uri (string-append "https://github.com/wxWidgets/wxWidgets/"
200 "releases/download/v" version
201 "/wxWidgets-" version ".tar.bz2"))
202 (sha256
203 (base32
204 "01y89999jw5q7njrhxajincx7lydls6yq37ikazjryssrxrnw3s4"))))
205 (arguments
206 `(#:configure-flags
207 '("--with-regex" "--with-libmspack"
208 "--with-sdl"
209 "--enable-webview"
210 "--enable-webkit"
211 "--enable-webviewwebkit"
212 ,@(if (string=? "aarch64-linux"
213 (%current-system))
214 '("--build=aarch64-unknown-linux-gnu")
215 '()))
216 #:make-flags
217 (list (string-append "LDFLAGS=-Wl,-rpath="
218 (assoc-ref %outputs "out") "/lib"))
219 ;; No 'check' target.
220 #:tests? #f
221 #:phases
222 (modify-phases %standard-phases
223 (add-after 'unpack 'refer-to-inputs
224 (lambda* (#:key inputs #:allow-other-keys)
225 (let ((mime (search-input-directory inputs "share/mime"))
226 (xdg-open (search-input-file inputs "bin/xdg-open")))
227 (substitute* "src/unix/utilsx11.cpp"
228 (("wxExecute\\(xdg_open \\+")
229 (string-append "wxExecute(\"" xdg-open "\"")))
230 (substitute* "src/unix/mimetype.cpp"
231 (("/usr(/local)?/share/mime") mime))))))))))
232
233(define-public python-wxpython
234 (package
235 (name "python-wxpython")
236 (version "4.2.2")
237 (source
238 (origin
239 (method url-fetch)
240 (uri (pypi-uri "wxPython" version))
241 (sha256
242 (base32 "1fp2717a96hd5pdai6hlzc4pngdazxas55apjv2w5zb71xjv1g2x"))
243 (modules '((guix build utils)))
244 (snippet #~(begin
245 ;; Remove bundled wxWidgets
246 (delete-file-recursively "ext/wxWidgets")))))
247 (build-system pyproject-build-system)
248 (outputs '("out" "debug"))
249 (arguments
250 (list
251 #:test-backend #~'custom
252 #:test-flags #~(list "build.py" "-v" "test")
253 #:modules '((guix build pyproject-build-system)
254 (guix build utils)
255 (ice-9 ftw)
256 (ice-9 match)
257 (srfi srfi-26))
258 #:phases
259 #~(modify-phases %standard-phases
260 (add-after 'unpack 'patch-avoid-circular-import
261 (lambda _
262 (substitute* "wx/__init__.py"
263 (("^import wx\\.__version__.*$") "\
264try:
265 import wx.__version__
266except ImportError:
267 pass\n")
268 (("^__version__ = .*")
269 (format #f "__version__ = ~s~%" #$version)))))
270 (add-before 'build 'configure
271 (lambda* (#:key inputs #:allow-other-keys)
272 ;; Configure the build options provided to the 'build.py' build
273 ;; script.
274 (setenv "WXPYTHON_BUILD_ARGS"
275 (string-join '("--debug" ;include debug symbols
276 "--use_syswx"))) ;use system wxwidgets
277 (setenv "WXWIN" #$(this-package-input "wxwidgets"))
278 ;; Copy the waf executable to the source directory since it needs
279 ;; to be in a writable directory.
280 (copy-file (search-input-file inputs "/bin/waf") "bin/waf")
281 (setenv "WAF" "bin/waf")
282 ;; The build script tries to copy license files from the
283 ;; wxwidgets source tree. Prevent it.
284 (substitute* "wscript"
285 (("updateLicenseFiles\\(cfg\\)" all)
286 (string-append "#" all)))
287 ;; The build script tries to write to demo/version.py. So, we set
288 ;; correct write permissions.
289 (chmod "demo/version.py" #o644)))
290 (add-before 'sanity-check 'add-missing-.so
291 (lambda* (#:key inputs outputs #:allow-other-keys)
292 (let ((site (site-packages inputs outputs)))
293 (with-directory-excursion (string-append site "/wx")
294 (for-each
295 (match-lambda
296 ("siplib"
297 (rename-file "siplib" "siplib.so"))
298 ((? (cut string-prefix? "_" <>) file)
299 (unless (string-prefix? "__" file)
300 (rename-file file (string-append file ".so"))))
301 (_ #t))
302 (scandir ".")))))))))
303 (inputs
304 (list gtk+ wxwidgets))
305 (native-inputs
306 (list pkg-config python-setuptools waf))
307 (propagated-inputs
308 (list python-numpy python-pillow python-six))
309 (home-page "https://wxpython.org/")
310 (synopsis "Cross platform GUI toolkit for Python")
311 (description "wxPython is a cross-platform GUI toolkit for the Python
312programming language. It is implemented as a set of Python extension modules
313that wrap the GUI components of the popular wxWidgets cross platform C++
314library. In most cases, wxPython uses the native widgets on each platform to
315provide a 100% native look and feel for the application.")
316 (license l:wxwindows3.1+)))
317
318(define-public wxsvg
319 (package
320 (name "wxsvg")
321 (version "1.5.25")
322 (source
323 (origin
324 (method url-fetch)
325 (uri (string-append "mirror://sourceforge/wxsvg/wxsvg/"
326 version "/wxsvg-" version ".tar.bz2"))
327 (sha256
328 (base32 "0jsk4vrv7rkb7wrdbsdf60zvdnvj0pxfika8xydd2jxm65larxjv"))))
329 (build-system glib-or-gtk-build-system)
330 (inputs
331 (list wxwidgets cairo ffmpeg))
332 (native-inputs
333 (list pkg-config))
334 (propagated-inputs
335 ;; In Requires.private of libwxsvg.pc.
336 (list libexif pango))
337 (synopsis "C++ library to create, manipulate and render SVG files")
338 (description "wxSVG is a C++ library to create, manipulate and render
339@dfn{Scalable Vector Graphics} (SVG) files with the wxWidgets toolkit.")
340 (home-page "https://wxsvg.sourceforge.net")
341
342 ;; wxSVG is licenced under the "wxWindows library licence", which is
343 ;; the LGPL2.0+, with a few extra permissions.
344 (license (list l:lgpl2.0+ (l:fsf-free "file://COPYING")))))
345
346(define-public perl-alien-wxwidgets
347 (package
348 (name "perl-alien-wxwidgets")
349 (version "0.69")
350 (source
351 (origin
352 (method url-fetch)
353 (uri (string-append
354 "mirror://cpan/authors/id/M/MD/MDOOTSON/Alien-wxWidgets-"
355 version
356 ".tar.gz"))
357 (sha256
358 (base32
359 "0jg2dmkzhj03f6b0vmv597yryfw9cclsdn9ynvvlrzzgpd5lw8jk"))))
360 (build-system perl-build-system)
361 (native-inputs
362 (list perl-lwp-protocol-https
363 perl-module-build
364 perl-test-pod
365 perl-test-pod-coverage
366 wxwidgets))
367 (propagated-inputs (list perl-module-pluggable))
368 (home-page "https://metacpan.org/release/Alien-wxWidgets")
369 (synopsis "Perl module for wxWidgets binaries")
370 (description "Alien::wxWidgets is a Perl module for detecting and
371getting configuration settings from an installed wxWidgets package.")
372 (license l:perl-license)))