projects/guix·blob wip-node-riscv64 · refs

364 lines · 14.6 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2021 Adam Kandur <[email protected]>
3;;; Copyright © 2021 Morgan Smith <[email protected]>
4;;; Copyright © 2021, 2023 Daniel Meißner <[email protected]>
5;;; Copyright © 2023 Adam Faiz <[email protected]>
6;;; Copyright © 2023 Simon Tournier <[email protected]>
7;;; Copyright © 2024 Sharlatan Hellseher <[email protected]>
8;;;
9;;; This file is part of GNU Guix.
10;;;
11;;; GNU Guix is free software; you can redistribute it and/or modify it
12;;; under the terms of the GNU General Public License as published by
13;;; the Free Software Foundation; either version 3 of the License, or (at
14;;; your option) any later version.
15;;;
16;;; GNU Guix is distributed in the hope that it will be useful, but
17;;; WITHOUT ANY WARRANTY; without even the implied warranty of
18;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19;;; GNU General Public License for more details.
20;;;
21;;; You should have received a copy of the GNU General Public License
22;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
23
24(define-module (gnu packages python-graphics)
25 #:use-module ((guix licenses) #:prefix license:)
26 #:use-module ((guix build-system python) #:select (pypi-uri))
27 #:use-module (guix build-system pyproject)
28 #:use-module (guix download)
29 #:use-module (guix gexp)
30 #:use-module (guix git-download)
31 #:use-module (guix packages)
32 #:use-module (gnu packages)
33 #:use-module (gnu packages audio)
34 #:use-module (gnu packages base)
35 #:use-module (gnu packages check)
36 #:use-module (gnu packages compression)
37 #:use-module (gnu packages fontutils)
38 #:use-module (gnu packages gl)
39 #:use-module (gnu packages gtk)
40 #:use-module (gnu packages maths)
41 #:use-module (gnu packages pulseaudio)
42 #:use-module (gnu packages python-build)
43 #:use-module (gnu packages python-xyz)
44 #:use-module (gnu packages simulation)
45 #:use-module (gnu packages video)
46 #:use-module (gnu packages xorg))
47
48;;; Commentary:
49;;;
50;;; Python modules which are meant to be used in GUI creation or mainly are
51;;; bindings to low level libraries such as Glue, Mesa, OpenGL, Xorg etc.
52;;;
53;;; Please: Try to add new module packages in alphabetic order.
54;;;
55;;; Code:
56
57(define-public python-glcontext
58 (let (;; Upstream is known for abusing mutable tag, hence pinpoint the
59 ;; relevant commit.
60 (revision "2")
61 (commit "f2875abdb18b24e785c3958cc22845c81725d5cd"))
62 (package
63 (name "python-glcontext")
64 (version (git-version "3.0.0" revision commit))
65 (source
66 (origin
67 (method git-fetch)
68 (uri (git-reference
69 (url "https://github.com/moderngl/glcontext")
70 (commit commit)))
71 (file-name (git-file-name name version))
72 (sha256
73 (base32 "15pngnc4agdvm8crq782vjlb5v1qrclln5xpqiyhz3jhmipsqb8q"))))
74 (build-system pyproject-build-system)
75 (arguments
76 (list
77 #:phases
78 #~(modify-phases %standard-phases
79 (add-before 'build 'fix-lib-paths
80 (lambda* (#:key inputs outputs #:allow-other-keys)
81 (let ((mesa (assoc-ref inputs "mesa"))
82 (libx11 (assoc-ref inputs "libx11")))
83 (substitute* '("glcontext/x11.cpp"
84 "glcontext/egl.cpp")
85 (("\"libGL.so\"")
86 (string-append "\"" mesa "/lib/libGL.so\""))
87 (("\"libEGL.so\"")
88 (string-append "\"" mesa "/lib/libEGL.so\""))
89 (("\"libX11.so\"")
90 (string-append "\"" libx11 "/lib/libX11.so\"")))
91 (substitute* '("glcontext/__init__.py")
92 (("find_library\\('GL'\\)")
93 (string-append "'" mesa "/lib/libGL.so'"))
94 (("find_library\\('EGL'\\)")
95 (string-append "'" mesa "/lib/libEGL.so'"))
96 (("find_library\\(\"X11\"\\)")
97 (string-append "'" libx11 "/lib/libX11.so'"))))))
98 (add-before 'check 'prepare-test-environment
99 (lambda _
100 (system "Xvfb :1 &")
101 (setenv "DISPLAY" ":1"))))))
102 (inputs
103 (list libx11
104 mesa))
105 (native-inputs
106 (list python-psutil
107 python-pytest
108 python-setuptools
109 python-wheel
110 xorg-server-for-tests))
111 (home-page "https://github.com/moderngl/glcontext")
112 (synopsis "Portable OpenGL Context for ModernGL")
113 (description
114 "Python-glcontext is a library providing an OpenGL implementation for
115ModernGL on multiple platforms.")
116 (license license:expat))))
117
118(define-public python-glfw
119 (package
120 (name "python-glfw")
121 (version "2.8.0")
122 (source
123 (origin
124 (method url-fetch)
125 (uri (pypi-uri "glfw" version))
126 (sha256
127 (base32 "1w36jvn6fx8p7irhwj6bbl67m2id3s0227b3w7bgw9hbicr0vsch"))))
128 (build-system pyproject-build-system)
129 (arguments
130 (list
131 #:tests? #f ; no tests provided
132 #:phases
133 #~(modify-phases %standard-phases
134 (add-after 'unpack 'fix-lib-paths
135 (lambda _
136 (substitute* "glfw/library.py"
137 (("_get_library_search_paths\\(\\), ")
138 (format #f "[ '~a/lib' ],"
139 #$(this-package-input "glfw")))))))))
140 (native-inputs
141 (list python-pytest
142 python-setuptools
143 python-wheel))
144 (inputs
145 (list glfw))
146 (home-page "https://github.com/FlorianRhiem/pyGLFW")
147 (synopsis "Python bindings for GLFW")
148 (description
149 "This package provides Python bindings for @url{http://www.glfw.org/,
150GLFW} OpenGL application development library.")
151 (license license:expat)))
152
153(define-public python-pyglet
154 (package
155 (name "python-pyglet")
156 (version "2.0.18")
157 (source
158 (origin
159 (method url-fetch)
160 (uri (pypi-uri "pyglet" version))
161 (sha256
162 (base32 "1p4rizj81vfqxal288m3afbrgk0il3w7k5kmhai2sah8f26j7ybw"))))
163 (build-system pyproject-build-system)
164 (arguments
165 (list
166 #:test-flags
167 #~(list "tests"
168 "--ignore=tests/interactive"
169 ;; All tests errored
170 "--ignore=tests/integration/media/test_openal.py"
171 "--ignore=tests/integration/text/test_empty_document.py"
172 ;; Tests failed
173 "-k" (string-append "not test2"
174 " and not test5"
175 " and not testPad"
176 " and not testPad"
177 " and not testRange"
178 " and not testRect"
179 " and not testRect"
180 " and not testSet"
181 " and not testSquare"
182 " and not testSquare"
183 " and not testTuple"
184 " and not testTupleRange"
185 " and not test_context_noshare_texture"
186 " and not test_context_share_texture"
187 " and not test_method"
188 " and not test_openal_listener"
189 " and not test_parse_all_controller_mappings"
190 " and not test_player_play"
191 " and not test_player_play_multiple"
192 " and not test_stream_write_needed"
193 " and not test_window_caption"
194 " and not test_window_caption_from_argv"))
195 #:phases
196 #~(modify-phases %standard-phases
197 (add-after 'unpack 'patch-lib-paths
198 (lambda* (#:key inputs #:allow-other-keys)
199 (substitute* (list "pyglet/font/fontconfig.py"
200 "pyglet/font/freetype_lib.py"
201 "pyglet/gl/lib_glx.py"
202 "pyglet/input/linux/evdev.py"
203 "pyglet/libs/egl/egl.py"
204 "pyglet/libs/egl/lib.py"
205 "pyglet/libs/x11/xf86vmode.py"
206 "pyglet/libs/x11/xinerama.py"
207 "pyglet/libs/x11/xlib.py"
208 "pyglet/libs/x11/xsync.py"
209 "pyglet/media/drivers/openal/lib_openal.py"
210 "pyglet/media/drivers/pulse/lib_pulseaudio.py")
211 (("'EGL'")
212 (format #f "'~a/~a'" #$(this-package-input "mesa")
213 "lib/libEGL.so"))
214 (("\"fontconfig\"")
215 (format #f "'~a/~a'" #$(this-package-input "fontconfig-minimal")
216 "lib/libfontconfig.so"))
217 (("\"freetype\"")
218 (format #f "'~a/~a'" #$(this-package-input "freetype")
219 "lib/libfreetype.so"))
220 (("'GL'")
221 (format #f "'~a/~a'" #$(this-package-input "mesa")
222 "lib/libGL.so"))
223 (("'GLU'")
224 (format #f "'~a/~a'" #$(this-package-input "glu")
225 "lib/libGLU.so"))
226 (("'X11'")
227 (format #f "'~a/~a'" #$(this-package-input "libx11")
228 "lib/libX11.so"))
229 (("'Xext'")
230 (format #f "'~a/~a'" #$(this-package-input "libxext")
231 "lib/libXext.so"))
232 (("'Xinerama'")
233 (format #f "'~a/~a'" #$(this-package-input "libxinerama")
234 "lib/libXinerama.so"))
235 (("'Xxf86vm'")
236 (format #f "'~a/~a'" #$(this-package-input "libxxf86vm")
237 "lib/libXxf86vm.so"))
238 (("'c'")
239 (format #f "'~a/~a'" #$(this-package-input "glibc")
240 "lib/libc.so"))
241 (("'gdk-x11-2.0'")
242 (format #f "'~a/~a'" #$(this-package-input "gtk+")
243 "lib/gdk-pixbuf-2.0.so"))
244 (("'gdk_pixbuf-2.0'")
245 (format #f "'~a/~a'" #$(this-package-input "gdk-pixbuf")
246 "lib/libgdk_pixbuf-2.0.so"))
247 (("'openal'")
248 (format #f "'~a/~a'" #$(this-package-input "openal")
249 "lib/libopenal.so"))
250 (("'pulse'")
251 (format #f "'~a/~a'" #$(this-package-input "pulseaudio")
252 "lib/libpulse.so")))))
253 (add-before 'check 'prepare-test-environment
254 (lambda _
255 ;; The test suite requires a running X server.
256 (system "Xvfb :1 &")
257 (setenv "DISPLAY" ":1")
258 (setenv "HOME" "/tmp")
259 (setenv "PYGLET_HEADLESS" "True"))))))
260 (native-inputs
261 (list python-flit-core
262 python-pytest
263 unzip
264 xorg-server-for-tests))
265 (inputs
266 (list ffmpeg
267 fontconfig
268 freeglut
269 freetype
270 gdk-pixbuf
271 glibc
272 glu
273 gtk+
274 libx11
275 libxext
276 libxinerama
277 libxxf86vm
278 mesa
279 openal
280 pulseaudio))
281 (home-page "https://github.com/pyglet/pyglet")
282 (synopsis "Windowing and multimedia library")
283 (description
284 "Pyglet is a Python library for developing games and other visually-rich
285applications. It supports windowing, user interface event handling,
286Joysticks, OpenGL graphics, loading images and videos, playing sounds and
287music." )
288 (license license:bsd-3)))
289
290(define-public python-vispy
291 (package
292 (name "python-vispy")
293 (version "0.14.3")
294 (source
295 (origin
296 (method url-fetch)
297 (uri (pypi-uri "vispy" version))
298 (sha256
299 (base32 "07fkk4bdffn0iq5cprk7ydj978rqc4lvzfcs2vkzgfh8m53vifzg"))))
300 (build-system pyproject-build-system)
301 (arguments
302 (list
303 #:test-flags
304 ;; Test requiring network access to download test data from
305 ;; <https://raw.githubusercontent.com/vispy/demo-data/main/CONTRIBUTING.txt>.
306 #~(list "-k" (string-append "not test_read_write_image"
307 " and not test_wavefront"
308 " and not test_config"))
309 #:phases
310 #~(modify-phases %standard-phases
311 (add-after 'unpack 'patch-library-path
312 (lambda _
313 (substitute* (list "vispy/ext/egl.py"
314 "vispy/ext/fontconfig.py"
315 "vispy/gloo/gl/es2.py"
316 "vispy/gloo/gl/gl2.py")
317 (("ctypes\\.util\\.find_library\\('EGL'\\)")
318 (format #f "'~a/~a'" #$(this-package-input "mesa")
319 "lib/libEGL.so"))
320 (("ctypes\\.util\\.find_library\\('GL'\\)")
321 (format #f "'~a/~a'" #$(this-package-input "mesa")
322 "lib/libGL.so"))
323 (("ctypes\\.util\\.find_library\\('GLESv2'\\)")
324 (format #f "'~a/~a'" #$(this-package-input "mesa")
325 "lib/libGLESv2.so"))
326 (("util\\.find_library\\('fontconfig'\\)")
327 (format #f "'~a/~a'" #$(this-package-input "fontconfig-minimal")
328 "lib/libfontconfig.so")))))
329 (add-before 'check 'prepare-test-environment
330 (lambda _
331 ;; XXX: Check how to set DPI to run headless tests, fails when
332 ;; DISPLAY is set.
333 ;; E RuntimeError: could not determine DPI
334 (setenv "HOME" "/tmp")
335 (invoke "python" "setup.py" "build_ext" "--inplace"))))))
336 (native-inputs
337 (list python-cython-3
338 python-pytest
339 python-setuptools
340 python-setuptools-scm
341 python-wheel))
342 (inputs
343 (list fontconfig
344 mesa))
345 (propagated-inputs
346 (list python-freetype-py
347 python-hsluv
348 python-kiwisolver
349 python-meshio
350 python-numpy
351 python-packaging
352 python-pillow))
353 (home-page "http://vispy.org")
354 (synopsis "Interactive scientific visualization in Python")
355 (description
356 "VisPy is a high-performance interactive 2D/3D data visualization library
357leveraging the computational power of modern Graphics Processing Units (GPUs)
358through the OpenGL library to display very large datasets.")
359 (license license:bsd-3)))
360
361;;;
362;;; Avoid adding new packages to the end of this file. To reduce the chances
363;;; of a merge conflict, place them above in alphabetical order.
364;;;