projects/guix·blob python-team · refs

557 lines · 22.2 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2013, 2025 Andreas Enge <[email protected]>
3;;; Copyright © 2014 John Darrington <[email protected]>
4;;; Copyright © 2015 Eric Bavier <[email protected]>
5;;; Copyright © 2015, 2018 Ricardo Wurmus <[email protected]>
6;;; Copyright © 2016 Kei Kebreau <[email protected]>
7;;; Copyright © 2018 Mark H Weaver <[email protected]>
8;;; Copyright © 2018, 2023 Efraim Flashner <[email protected]>
9;;; Copyright © 2020-2022 Tobias Geerinckx-Rice <[email protected]>
10;;; Copyright © 2022 Andy Tai <[email protected]>
11;;; Copyright © 2022, 2023 John Kehayias <[email protected]>
12;;; Copyright © 2022-2023, 2026 Maxim Cournoyer <[email protected]>
13;;; Copyright © 2023 Simon South <[email protected]>
14;;;
15;;; This file is part of GNU Guix.
16;;;
17;;; GNU Guix is free software; you can redistribute it and/or modify it
18;;; under the terms of the GNU General Public License as published by
19;;; the Free Software Foundation; either version 3 of the License, or (at
20;;; your option) any later version.
21;;;
22;;; GNU Guix is distributed in the hope that it will be useful, but
23;;; WITHOUT ANY WARRANTY; without even the implied warranty of
24;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25;;; GNU General Public License for more details.
26;;;
27;;; You should have received a copy of the GNU General Public License
28;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
29
30(define-module (gnu packages toolkits)
31 #:use-module (gnu packages)
32 #:use-module (gnu packages autotools)
33 #:use-module (gnu packages build-tools)
34 #:use-module (gnu packages compiler-tools)
35 #:use-module (gnu packages compression)
36 #:use-module (gnu packages documentation)
37 #:use-module (gnu packages fontutils)
38 #:use-module (gnu packages gcc)
39 #:use-module (gnu packages gl)
40 #:use-module (gnu packages gtk)
41 #:use-module (gnu packages image)
42 #:use-module (gnu packages pkg-config)
43 #:use-module (gnu packages python)
44 #:use-module (gnu packages python-build)
45 #:use-module (gnu packages python-xyz)
46 #:use-module (gnu packages sdl)
47 #:use-module (gnu packages xorg)
48 #:use-module (guix build-system cmake)
49 #:use-module (guix build-system gnu)
50 #:use-module (guix build-system pyproject)
51 #:use-module (guix build-system waf)
52 #:use-module (guix download)
53 #:use-module (guix gexp)
54 #:use-module (guix git-download)
55 #:use-module ((guix licenses) #:prefix license:)
56 #:use-module (guix packages)
57 #:use-module (guix utils)
58 #:use-module (srfi srfi-1))
59
60(define-public fltk-1.3
61 (package
62 (name "fltk")
63 (version "1.3.11")
64 (source
65 (origin
66 (method git-fetch)
67 (uri (git-reference
68 (url "https://github.com/fltk/fltk")
69 (commit (string-append "release-" version))))
70 (file-name (git-file-name name version))
71 (sha256
72 (base32 "0pnifyhhvcqfjd6iaa4m14kvfyqhjjdw0aqbcizcdhhqrl6q4pjg"))))
73 (build-system gnu-build-system)
74 (arguments
75 (list
76 #:tests? #f ;TODO: compile programs in "test" dir
77 #:configure-flags
78 #~(list "--enable-shared"
79 (string-append "DSOFLAGS=-Wl,-rpath=" %output "/lib"))
80 #:phases
81 #~(modify-phases %standard-phases
82 (add-before 'configure 'patch-makeinclude
83 (lambda _
84 (substitute* "makeinclude.in"
85 (("/bin/sh")
86 (which "sh")))))
87 (add-after 'install 'patch-config
88 ;; Provide -L flags for image libraries when querying fltk-config to
89 ;; avoid propagating inputs.
90 (lambda* (#:key inputs #:allow-other-keys)
91 (let ((conf (string-append #$output "/bin/fltk-config"))
92 (libjpeg-so (search-input-file inputs "lib/libjpeg.so"))
93 (libpng-so (search-input-file inputs "lib/libpng.so"))
94 (libz-so (search-input-file inputs "lib/libz.so")))
95 (substitute* conf
96 (("-ljpeg")
97 (string-append "-L" (dirname libjpeg-so) " -ljpeg"))
98 (("-lpng")
99 (string-append "-L" (dirname libpng-so) " -lpng"))
100 (("-lz")
101 (string-append "-L" (dirname libz-so) " -lz")))))))))
102 (native-inputs (list autoconf automake pkg-config))
103 (inputs
104 (list libjpeg-turbo
105 libpng
106 libx11
107 libxft
108 mesa
109 zlib))
110 (home-page "https://www.fltk.org")
111 (synopsis "3D C++ GUI library")
112 (description
113 "FLTK is a C++ GUI toolkit providing modern GUI functionality without the
114bloat. It supports 3D graphics via OpenGL and its built-in GLUT emulation.
115FLTK is designed to be small and modular enough to be statically linked, but
116works fine as a shared library. FLTK also includes an excellent UI builder
117called FLUID that can be used to create applications in minutes.")
118 (license license:lgpl2.0))) ; plus certain additional permissions
119
120(define-public fltk
121 (package
122 (inherit fltk-1.3)
123 (version "1.4.5")
124 (source
125 (origin
126 (method git-fetch)
127 (uri (git-reference
128 (url "https://github.com/fltk/fltk")
129 (commit (string-append "release-" version))))
130 (sha256
131 (base32 "19bl0ryarg31wkhw01ryilp9iwwh6vwnsq9mnzmarzm0dkwhjc7c"))
132 (modules '((guix build utils)))
133 (snippet #~(for-each delete-file-recursively '("jpeg" "zlib" "png")))))
134 (build-system cmake-build-system)
135 (arguments
136 (list
137 ;; The tests are GUI programs that need manual verification.
138 #:tests? #f
139 #:configure-flags
140 #~(list "-DFLTK_BUILD_SHARED_LIBS=ON"
141 "-DFLTK_BUILD_TEST=OFF")
142 #:phases
143 #~(modify-phases %standard-phases
144 (add-after 'install 'patch-config
145 ;; Avoid propagating inputs to consumers that rely on fltk-config.
146 (lambda* (#:key inputs #:allow-other-keys)
147 (substitute* (string-append #$output "/bin/fltk-config")
148 ;; Take care to patch "-lGLU" before "-lGL".
149 (("-lGLU") (search-input-file inputs "lib/libGLU.so"))
150 (("-lGL") (search-input-file inputs "lib/libGL.so")))))
151 (add-after 'install 'delete-static-libraries
152 (lambda _
153 (for-each delete-file
154 (find-files (string-append #$output "/lib")
155 "\\.a$")))))))
156 (native-inputs (list))
157 (inputs
158 (list glu
159 libjpeg-turbo
160 libpng
161 libx11
162 libxft
163 mesa
164 zlib))))
165
166(define-public imgui
167 (package
168 (name "imgui")
169 (version "1.92.9b")
170 (source (origin
171 (method git-fetch)
172 (uri (git-reference
173 (url "https://github.com/ocornut/imgui")
174 (commit (string-append "v" version))))
175 (file-name (git-file-name name version))
176 (sha256
177 (base32
178 "0m35zy4j1m7pvlymxhmg8gcll58acil0il1x79iyyakksylvwd92"))
179 (modules '((guix build utils)))
180 (snippet
181 ;; Remove bundled fonts.
182 #~(for-each delete-file
183 (find-files "misc/fonts" "\\.ttf")))))
184 (outputs '("out" "doc"))
185 (build-system gnu-build-system)
186 (arguments
187 (list
188 #:tests? #f ;no test suite
189 #:modules '((guix build gnu-build-system)
190 (guix build utils)
191 (ice-9 ftw)
192 (srfi srfi-26))
193 ;; The build phase does not use make but we will use make-flags in a
194 ;; similar fashion to make inheritance for older imgui versions easier.
195 #:make-flags
196 ;; This first option is necessary at least for OpenBoardView, otherwise
197 ;; it would fail with the "Too many vertices in ImDrawList using 16-bit
198 ;; indices".
199 #~(list "-DImDrawIdx=unsigned int"
200 #$@(if (this-package-input "freetype")
201 #~("-DIMGUI_ENABLE_FREETYPE"
202 "-I" (search-input-directory %build-inputs
203 "include/freetype2")
204 "-lfreetype")
205 #~())
206 #$@(if (this-package-input "glfw")
207 #~("-lglfw")
208 #~())
209 #$@(if (this-package-input "sdl2")
210 #~("-lSDL2")
211 #~())
212 #$@(if (this-package-input "sdl3")
213 #~("-lSDL3")
214 #~())
215 "-I" (string-append (getcwd) "/source")
216 "-g" "-O2" "-fPIC" "-shared"
217 "-lGL"
218 "-o" "libimgui.so")
219 #:phases
220 #~(modify-phases %standard-phases
221 (delete 'configure)
222 (replace 'build
223 (lambda* (#:key inputs make-flags #:allow-other-keys)
224 ;; Build main library.
225 (define (has-lib? soname)
226 (false-if-exception
227 (search-input-file inputs (string-append "lib/" soname))))
228 (define freetype?
229 (has-lib? "libfreetype.so"))
230 (define glfw?
231 (has-lib? "libglfw.so"))
232 (define sdl2?
233 (has-lib? "libSDL2.so"))
234 (define sdl3?
235 (has-lib? "libSDL3.so"))
236 (unless freetype?
237 (delete-file-recursively "misc/freetype"))
238 (unless sdl3?
239 (substitute* (find-files "." "(\\.cpp|\\.mm)$")
240 (("#include <SDL")
241 "#include <SDL2/SDL")))
242 (define args
243 (append make-flags
244 `("imgui.cpp"
245 "imgui_draw.cpp"
246 "imgui_tables.cpp"
247 "imgui_widgets.cpp"
248 ;; Include the supported backends.
249 ,@(if glfw?
250 '("backends/imgui_impl_glfw.cpp")
251 '())
252 ,@(if sdl3?
253 '("backends/imgui_impl_sdl3.cpp")
254 '())
255 ,@(if sdl2?
256 '("backends/imgui_impl_sdl2.cpp")
257 '())
258 "backends/imgui_impl_opengl2.cpp"
259 "backends/imgui_impl_opengl3.cpp"
260 ;; Include wrappers for C++ standard library
261 ;; (STL) and fontconfig.
262 ,@(find-files "misc" "\\.cpp$"))))
263 (format #t "invoking ~s with arguments: ~s~%"
264 #$(cc-for-target) args)
265 (apply invoke #$(cc-for-target) args)))
266 (replace 'install
267 (lambda _
268 (let* ((header? (cut string-suffix? ".h" <>))
269 (imgui-headers (scandir "." header?))
270 (backend-headers (find-files
271 "backends"
272 "(glfw|opengl|sdl|vulkan).*\\.h$"))
273 (misc-headers (find-files "misc" "\\.h$")))
274 (install-file "libimgui.so" (string-append #$output "/lib"))
275 ;; Install headers.
276 (for-each (lambda (f)
277 (install-file f (string-append #$output
278 "/include/imgui")))
279 imgui-headers)
280 (for-each (lambda (f)
281 (install-file f (string-append
282 #$output
283 "/include/imgui/backends")))
284 backend-headers)
285 (for-each (lambda (f)
286 (install-file f (string-append #$output
287 "/include/imgui/"
288 (dirname f))))
289 misc-headers)
290 ;; Install examples.
291 (copy-recursively "examples"
292 (string-append #$output:doc
293 "/share/imgui/examples"))))))))
294 (inputs (list fontconfig freetype glfw mesa sdl3))
295 (home-page "https://github.com/ocornut/imgui")
296 (synopsis "Immediate-mode C++ GUI library with minimal dependencies")
297 (description "@code{dear imgui} (also know as ImGui) is a graphical user
298interface library for C++. It creates optimized vertex buffers that you can
299render anytime in your 3D-pipeline-enabled application. It's fast, portable,
300renderer-agnostic, and self-contained, without external dependencies.
301
302ImGui is aimed at content creation, visualization, and debugging tools as
303opposed to average end-user interfaces. Hence it favors simplicity and
304productivity but lacks certain features often found in higher-level libraries.
305It is particularly suited to integration in game engine tooling, real-time 3D
306applications, full-screen applications, and embedded platforms without
307standard operating system features.")
308 (license license:expat)))
309
310(define-public imgui-with-sdl2
311 (package/inherit imgui
312 (name "imgui-with-sdl2")
313 (inputs (modify-inputs inputs
314 (replace "sdl3" sdl2)))))
315
316(define-public imgui-1.91
317 (package
318 (inherit imgui)
319 (name "imgui")
320 (version "1.91.9b")
321 (source (origin
322 (inherit (package-source imgui))
323 (method git-fetch)
324 (uri (git-reference
325 (url "https://github.com/ocornut/imgui")
326 (commit (string-append "v" version))))
327 (file-name (git-file-name name version))
328 (sha256
329 (base32
330 "1ji0fw0xb01c60hqzmvqi0ca5cnbm94x4v371f3w03q7zl6a8jvn"))))))
331
332;;; A more minimal variant of imgui that only depends on mesa, avoiding
333;;; transitively depending on libx11 and is thus less likely to run into
334;;; problems in FHS environments.
335(define-public imgui-for-mangohud
336 (package
337 (inherit imgui-1.91)
338 (arguments
339 (substitute-keyword-arguments arguments
340 ((#:disallowed-references _ ''())
341 (list libx11))
342 ((#:make-flags flags ''())
343 ;; Remove the "-DImDrawIdx=unsigned int" flag as it corrupts the
344 ;; rendering of MangoHud.
345 #~(delete "-DImDrawIdx=unsigned int" #$flags))))
346 (inputs (list mesa))))
347
348(define-public motif
349 ;; This commit is from February 2023 and v2.3.8 from 2017.
350 (let ((commit "0f556b0873c72ba1152a12fd54c3198ee039e413")
351 (revision "1"))
352 (package
353 (name "motif")
354 (version (git-version "2.3.8" revision commit))
355 (source
356 (origin
357 (method git-fetch)
358 (uri (git-reference
359 (url "https://git.code.sf.net/p/motif/code")
360 (commit commit)))
361 (file-name (git-file-name name version))
362 (sha256
363 (base32
364 "1g28i4978p9dpcdxv2yx4m17bchdypm3yy6m6gzchdlrv2iklhl9"))))
365 (build-system gnu-build-system)
366 (inputs
367 (list libx11 xorgproto))
368 (propagated-inputs
369 (list fontconfig freetype libxext libxft libxpm libxt xbitmaps))
370 (native-inputs
371 ;; This fails to build with GCC 14 due to missing header includes and
372 ;; other C semantics issues.
373 (list gcc-11
374 autoconf
375 automake
376 byacc
377 flex
378 libtool
379 pkg-config))
380 (home-page "https://motif.ics.com/motif")
381 (synopsis "Toolkit for the X window system")
382 (description
383 "Motif is a standard graphical user interface (as defined by the IEEE
3841295 specification), used on more than 200 hardware and software platforms.
385It provides application developers, end users, and system vendors with a
386widely used environment for standardizing application presentation on a wide
387range of platforms.")
388 (license license:lgpl2.1+))))
389
390(define-public ntk
391 (package
392 (name "ntk")
393 (version "1.3.1000")
394 (source (origin
395 (method git-fetch)
396 (uri (git-reference
397 (url "git://git.tuxfamily.org/gitroot/non/fltk.git")
398 (commit (string-append "v" version))))
399 (sha256
400 (base32
401 "0j38mhnfqy6swcrnc5zxcwlqi8b1pgklyghxk6qs1lf4japv2zc0"))
402 (file-name (git-file-name name version))))
403 (build-system waf-build-system)
404 (arguments
405 `(#:tests? #f ;no "check" target
406 #:configure-flags '("--enable-gl")
407 #:phases
408 (modify-phases %standard-phases
409 (add-before 'configure 'setup-waf
410 (lambda* (#:key inputs #:allow-other-keys)
411 (let ((waf (assoc-ref inputs "waf")))
412 (delete-file "waf")
413 (copy-file (string-append waf "/bin/waf") "waf"))
414 #t))
415 (add-before 'configure 'set-ldflags
416 (lambda* (#:key outputs #:allow-other-keys)
417 (setenv "LDFLAGS"
418 (string-append "-Wl,-rpath="
419 (assoc-ref outputs "out") "/lib"))
420 #t)))))
421 (inputs
422 `(("libjpeg" ,libjpeg-turbo)
423 ("glu" ,glu)
424 ("waf" ,waf)))
425 ;; ntk.pc lists "x11" and "xft" in Requires.private, and "cairo" in
426 ;; Requires.
427 (propagated-inputs
428 (list cairo libxft libx11))
429 (native-inputs
430 (list pkg-config))
431 (home-page "https://non.tuxfamily.org/ntk/")
432 (synopsis "Fork of FLTK with graphics rendering via Cairo")
433 (description
434 "The Non Tool Kit (NTK) is a fork of the Fast Light ToolKit library,
435adding improved graphics rendering via Cairo, a streamlined and enhanced
436widget set, and other features designed to improve the appearance and
437performance of the Non applications.")
438 (license license:lgpl2.0+))) ; plus certain additional permissions
439
440(define-public nuklear
441 (package
442 (name "nuklear")
443 (version "4.12.0")
444 (home-page "https://github.com/Immediate-Mode-UI/Nuklear")
445 (source
446 (origin
447 (method git-fetch)
448 (uri (git-reference
449 (url home-page)
450 (commit version)))
451 (file-name (git-file-name name version))
452 (sha256
453 (base32 "13cswwdys4hqdvbm4g4b9l269i16s7c4204j16v67ghj3b4mjifg"))
454 (snippet #~(begin
455 (delete-file "nuklear.h")
456 (delete-file "doc/index.html")))))
457 (build-system pyproject-build-system)
458 (arguments
459 (list
460 #:tests? #f ;no tests
461 #:phases
462 #~(modify-phases %standard-phases
463 (delete 'configure)
464 (replace 'build
465 (lambda _
466 (with-directory-excursion "src"
467 (invoke "./paq.sh"))
468 (with-directory-excursion "doc"
469 (with-input-from-file "../nuklear.h"
470 (lambda _
471 (with-output-to-file "index.html"
472 (lambda _
473 (invoke "stddoc"))))))))
474 (replace 'install
475 (lambda _
476 (install-file "nuklear.h"
477 (string-append #$output "/include"))
478 (install-file "doc/index.html"
479 (string-append #$output "/share/doc")))))))
480 (native-inputs (list stddoc python-setuptools))
481 (synopsis "Graphical user interface toolkit written in ANSI C")
482 (description
483 "This package provides an immediate-mode graphical user interface
484toolkit. It was designed as an embeddable user interface for applications and
485does not have any dependencies, a default render backend or OS window/input
486handling. The library is self contained in one single header file and can be
487used either in header only mode or in implementation mode.")
488 (license (list license:unlicense license:expat))))
489
490(define-public implot
491 (package
492 (name "implot")
493 (version "1.0")
494 (source (origin
495 (method git-fetch)
496 (uri (git-reference
497 (url "https://github.com/epezent/implot")
498 (commit (string-append "v" version))))
499 (file-name (git-file-name name version))
500 (sha256
501 (base32
502 "1pcq6nn82qpkwk27kyiaxky4pnaz9kj3fc3q25laj154r83ppikl"))))
503 (build-system gnu-build-system)
504 (arguments
505 (list
506 #:phases
507 #~(modify-phases %standard-phases
508 (delete 'bootstrap)
509 (delete 'configure)
510 (replace 'build
511 ;; Build a shared library from the source code.
512 (lambda* (#:key inputs #:allow-other-keys)
513 (invoke #$(cc-for-target) "-I" (getcwd)
514 "-I" (search-input-directory inputs "include/imgui")
515 "-g" "-O2" "-fPIC" "-shared"
516 "-o" "libimplot.so"
517 "implot.cpp"
518 "implot_items.cpp")))
519 (replace 'install
520 ;; Copy the library and header files to the output.
521 (lambda _
522 (install-file "libimplot.so" (string-append #$output "/lib"))
523 (for-each (lambda (file-name)
524 (install-file file-name
525 (string-append #$output
526 "/include/implot")))
527 '("implot.h" "implot_internal.h")))))
528 #:tests? #f)) ; no test suite
529 (inputs (list imgui))
530 (home-page "https://github.com/epezent/implot")
531 (synopsis "Immediate-mode C++ plotting library for ImGui")
532 (description "ImPlot is an immediate-mode, GPU-accelerated plotting
533library in C++ for the ImGui GUI library, suitable for creating real-time
534visualizations or interactive plots. Like ImGui, ImPlot is self-contained and
535requires only minimal code to integrate with existing applications.")
536 (license license:expat)))
537
538(define-public implot-0
539 (package
540 (inherit implot)
541 (name "implot")
542 (version "0.17")
543 (source (origin
544 (method git-fetch)
545 (uri (git-reference
546 (url "https://github.com/epezent/implot")
547 (commit (string-append "v" version))))
548 (file-name (git-file-name name version))
549 (sha256
550 (base32
551 "1rp4lxgr11yc3z3cmlrpyaf916n74wp7401r21v7xbybfd2cvp0w"))))))
552
553(define-public implot-for-mangohud
554 (package
555 (inherit implot-0)
556 (inputs (modify-inputs inputs
557 (replace "imgui" imgui-for-mangohud)))))