projects/guix·blob python-team · refs

1923 lines · 80.8 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2015 宋文武 <[email protected]>
3;;; Copyright © 2016, 2018, 2020, 2023, 2025 Efraim Flashner <[email protected]>
4;;; Copyright © 2017, 2018, 2024 Ricardo Wurmus <[email protected]>
5;;; Copyright © 2017 Corentin Bocquillon <[email protected]>
6;;; Copyright © 2017–2021 Tobias Geerinckx-Rice <[email protected]>
7;;; Copyright © 2018 Fis Trivial <[email protected]>
8;;; Copyright © 2018 Marius Bakke <[email protected]>
9;;; Copyright © 2018 Mark H Weaver <[email protected]>
10;;; Copyright © 2018 Tomáš Čech <[email protected]>
11;;; Copyright © 2018, 2020 Marius Bakke <[email protected]>
12;;; Copyright © 2018 Alex Vong <[email protected]>
13;;; Copyright © 2019, 2020 Brett Gilio <[email protected]>
14;;; Copyright © 2019 Jonathan Brielmaier <[email protected]>
15;;; Copyright © 2019 Mathieu Othacehe <[email protected]>
16;;; Copyright © 2020 Liliana Marie Prikler <[email protected]>
17;;; Copyright © 2020 Yuval Kogman <[email protected]>
18;;; Copyright © 2020 Jakub Kądziołka <[email protected]>
19;;; Copyright © 2021 qblade <[email protected]>
20;;; Copyright © 2021, 2023-2026 Maxim Cournoyer <[email protected]>
21;;; Copyright © 2022, 2023 Juliana Sims <[email protected]>
22;;; Copyright © 2024 Evgeny Pisemsky <[email protected]>
23;;; Copyright © 2024 Janneke Nieuwenhuizen <[email protected]>
24;;; Copyright © 2025 Aiden Isik <[email protected]>
25;;; Copyright © 2025 Hilton Chain <[email protected]>
26;;; Copyright © 2025 John Kehayias <[email protected]>
27;;; Copyright © 2025 Josep Bigorra <[email protected]>
28;;; Copyright © 2025 Nicolas Graves <[email protected]>
29;;; Copyright © 2025, 2026 Anderson Torres <[email protected]>
30;;; Copyright © 2026 Nemin <[email protected]>
31;;; Copyright © 2026 Nguyễn Gia Phong <[email protected]>
32;;; Copyright © 2026 Yan Abu Arab <[email protected]>
33;;;
34;;; This file is part of GNU Guix.
35;;;
36;;; GNU Guix is free software; you can redistribute it and/or modify it
37;;; under the terms of the GNU General Public License as published by
38;;; the Free Software Foundation; either version 3 of the License, or (at
39;;; your option) any later version.
40;;;
41;;; GNU Guix is distributed in the hope that it will be useful, but
42;;; WITHOUT ANY WARRANTY; without even the implied warranty of
43;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
44;;; GNU General Public License for more details.
45;;;
46;;; You should have received a copy of the GNU General Public License
47;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
48
49(define-module (gnu packages build-tools)
50 #:use-module (gnu packages algebra)
51 #:use-module (gnu packages autotools)
52 #:use-module (gnu packages base)
53 #:use-module (gnu packages bash)
54 #:use-module (gnu packages c)
55 #:use-module (gnu packages check)
56 #:use-module (gnu packages code)
57 #:use-module (gnu packages compression)
58 #:use-module (gnu packages cpp)
59 #:use-module (gnu packages cppi)
60 #:use-module (gnu packages dns)
61 #:use-module (gnu packages elf)
62 #:use-module (gnu packages gcc)
63 #:use-module (gnu packages guile)
64 #:use-module (gnu packages guile-xyz)
65 #:use-module (gnu packages jemalloc)
66 #:use-module (gnu packages linux)
67 #:use-module (gnu packages lisp)
68 #:use-module (gnu packages logging)
69 #:use-module (gnu packages lua)
70 #:use-module (gnu packages man)
71 #:use-module (gnu packages package-management)
72 #:use-module (gnu packages pcre)
73 #:use-module (gnu packages perl)
74 #:use-module (gnu packages pkg-config)
75 #:use-module (gnu packages pretty-print)
76 #:use-module (gnu packages protobuf)
77 #:use-module (gnu packages python)
78 #:use-module (gnu packages python-build)
79 #:use-module (gnu packages python-check)
80 #:use-module (gnu packages python-crypto)
81 #:use-module (gnu packages python-web)
82 #:use-module (gnu packages python-xyz)
83 #:use-module (gnu packages compiler-tools)
84 #:use-module (gnu packages regex)
85 #:use-module (gnu packages rpc)
86 #:use-module (gnu packages rust)
87 #:use-module (gnu packages serialization)
88 #:use-module (gnu packages sqlite)
89 #:use-module (gnu packages tcl)
90 #:use-module (gnu packages tls)
91 #:use-module (gnu packages unicode)
92 #:use-module (gnu packages version-control)
93 #:use-module (gnu packages xml)
94 #:use-module (gnu packages)
95 #:use-module (guix build-system cargo)
96 #:use-module (guix build-system cmake)
97 #:use-module (guix build-system copy)
98 #:use-module (guix build-system gnu)
99 #:use-module (guix build-system guile)
100 #:use-module (guix build-system hare)
101 #:use-module (guix build-system meson)
102 #:use-module (guix build-system pyproject)
103 #:use-module (guix build-system trivial)
104 #:use-module (guix deprecation)
105 #:use-module (guix download)
106 #:use-module (guix gexp)
107 #:use-module (guix git-download)
108 #:use-module ((guix licenses) #:prefix license:)
109 #:use-module (guix modules)
110 #:use-module (guix packages)
111 #:use-module (guix search-paths)
112 #:use-module (guix utils)
113 #:use-module (ice-9 optargs)
114 #:use-module (srfi srfi-1))
115
116(define-public acr
117 (package
118 (name "acr")
119 (version "2.2.4")
120 (source
121 (origin
122 (method git-fetch)
123 (uri (git-reference
124 (url "https://github.com/radareorg/acr")
125 (commit version)))
126 (file-name (git-file-name name version))
127 (sha256
128 (base32
129 "1qd7p50b9gkh2ihf7gs6xpdkb5jk8frg90ajqlw1pbza8735f9q1"))
130 (snippet
131 #~(begin
132 (delete-file "configure")))))
133 (build-system gnu-build-system)
134 (arguments
135 (list
136 #:tests? #f ; No tests
137 #:phases
138 #~(modify-phases %standard-phases
139 (delete 'bootstrap)
140 (add-after 'patch-source-shebangs 'bootstrap-after-patch-source-shebangs
141 (assoc-ref %standard-phases 'bootstrap)))))
142 (synopsis "Autoconf replacement written in pure Bash")
143 (description
144 "@acronym{ACR, Autoconf Replacement} tries to replace autoconf
145functionality generating a full-compatible configure script, but relying on
146Bourne shell script instead of m4.")
147 (home-page "https://github.com/radareorg/acr")
148 (license license:gpl2)))
149
150(define-public autosetup-boot0
151 (hidden-package
152 (package
153 (name "autosetup-boot0")
154 (version "0.7.3")
155 (source
156 (origin
157 (method git-fetch)
158 (uri (git-reference
159 (url "https://github.com/msteveb/autosetup")
160 (commit (string-append "v" version))))
161 (file-name (git-file-name "autosetup" version))
162 (sha256
163 (base32
164 "1ymzsrms3d5vf0vpwsfhapw4f462cjqbmic5pvr27451ifj0fybn"))
165 (modules '((guix build utils)))
166 (snippet #~(delete-file "jimsh0.c"))))
167 (build-system gnu-build-system)
168 (arguments
169 (list
170 #:tests? #f ;no need for a bootstrap package
171 #:phases
172 #~(modify-phases %standard-phases
173 (add-after 'unpack 'patch-tclsh-path
174 (lambda* (#:key inputs #:allow-other-keys)
175 (substitute* "sys-find-tclsh"
176 (("jimsh tclsh")
177 (search-input-file inputs "bin/jimsh")))
178 ;; Skip testing on specific Tcl versions
179 ;; that are no longer found by the patched script.
180 (substitute* "Makefile"
181 (("^.*tclsh8\\..*") ""))))
182 (delete 'configure)
183 (delete 'build)
184 (replace 'install
185 (lambda* (#:key inputs #:allow-other-keys)
186 (invoke "jimsh" "autosetup"
187 (string-append "--sysinstall=" #$output)))))))
188 (inputs
189 (list jimtcl-boot0))
190 (home-page "https://msteveb.github.io/autosetup/")
191 (synopsis "Bootstrap Autosetup")
192 (description
193 "This package bootstrap Autosetup for building Jim Tcl,
194which in turn is used by Autosetup.")
195 (license license:bsd-2))))
196
197(define-public autosetup
198 (package/inherit autosetup-boot0
199 (name "autosetup")
200 (arguments
201 (substitute-keyword-arguments arguments
202 ((#:tests? _ #f) #t)
203 ((#:test-target _ "check") "test")))
204 (inputs (modify-inputs inputs
205 (delete 'jimtcl-boot0)
206 (prepend jimtcl)))
207 (synopsis "Build environment auto-configurator")
208 (description
209 "@command{autosetup} is a tool, similar to @command{autoconf},
210to configure a build system for the appropriate environment,
211according to the system capabilities and the user-selected options.")
212 (properties (alist-delete 'hidden? (package-properties autosetup-boot0)))))
213
214(define-public bam
215 (package
216 (name "bam")
217 (version "0.5.1")
218 (source (origin
219 ;; do not use auto-generated tarballs
220 (method git-fetch)
221 (uri (git-reference
222 (url "https://github.com/matricks/bam")
223 (commit (string-append "v" version))))
224 (file-name (git-file-name name version))
225 (sha256
226 (base32
227 "13br735ig7lygvzyfd15fc2rdygrqm503j6xj5xkrl1r7w2wipq6"))
228 (patches (search-patches "bam-python3-compat.patch"))))
229 (build-system gnu-build-system)
230 (arguments
231 `(#:make-flags `(,(string-append "CC=" ,(cc-for-target))
232 ,(string-append "INSTALL_PREFIX="
233 (assoc-ref %outputs "out")))
234 #:test-target "test"
235 #:phases
236 (modify-phases %standard-phases
237 (delete 'configure))))
238 (native-inputs
239 (list python-minimal-wrapper))
240 (inputs
241 (list lua))
242 (home-page "https://matricks.github.io/bam/")
243 (synopsis "Fast and flexible build system")
244 (description "Bam is a fast and flexible build system. Bam uses Lua to
245describe the build process. It takes its inspiration for the script files
246from scons. While scons focuses on being 100% correct when building, bam
247makes a few sacrifices to acquire fast full and incremental build times.")
248 (license license:bsd-3)))
249
250(define-public bear
251 (package
252 (name "bear")
253 (version "3.1.6")
254 (source
255 (origin
256 (method git-fetch)
257 (uri (git-reference
258 (url "https://github.com/rizsotto/Bear")
259 (commit version)))
260 (file-name (git-file-name name version))
261 (sha256
262 (base32 "0pnrsnwvsqby0vgb33zsrjznb7l82ji7i4aigk32hg3rl674qqvx"))))
263 (build-system cmake-build-system)
264 (arguments
265 `(#:phases (modify-phases %standard-phases
266 (add-after 'unpack 'disable-TEST_BEFORE_INSTALL
267 (lambda _
268 (substitute* "CMakeLists.txt"
269 ;; Delete the matching line—and comment out the next.
270 ((".*TEST_(BEFORE_INSTALL|COMMAND).*") "#"))))
271 (add-before 'check 'set-build-environment
272 (lambda _
273 (setenv "CC" "gcc")))
274 (replace 'check
275 ;; TODO: Test configuration is incomplete.
276 (lambda* (#:key tests? #:allow-other-keys)
277 (when tests?
278 (invoke "ctest")))))))
279 (inputs
280 `(("c-ares" ,c-ares)
281 ("fmt" ,fmt)
282 ("grpc" ,grpc)
283 ("nlohmann-json" ,nlohmann-json)
284 ("protobuf" ,protobuf)
285 ("python" ,python-wrapper)
286 ("re2" ,re2)
287 ("spdlog" ,spdlog)))
288 (native-inputs
289 `(("abseil-cpp" ,abseil-cpp)
290 ("googletest" ,googletest)
291 ("openssl" ,openssl)
292 ("pkg-config" ,pkg-config)
293 ("python-lit" ,python-lit)
294 ("zlib" ,zlib)))
295 (home-page "https://github.com/rizsotto/Bear")
296 (synopsis "Tool for generating a compilation database")
297 (description "A JSON compilation database is used in the Clang project to
298provide information on how a given compilation unit is processed. With this,
299it is easy to re-run the compilation with alternate programs. Bear is used to
300generate such a compilation database.")
301 (license license:gpl3+)))
302
303(define-public bmake
304 (package
305 (name "bmake")
306 (version "20260824")
307 (source
308 (origin
309 (method url-fetch)
310 (uri (string-append
311 "http://www.crufty.net/ftp/pub/sjg/bmake-" version ".tar.gz"))
312 (sha256
313 (base32 "0wnbs8vhzci4iybnl504412bh3kykxdq050bpr0mgm9db4x2bikn"))
314 (patches (search-patches "bmake-run-check-separately.patch"))))
315 (build-system gnu-build-system)
316 (inputs
317 (list bash-minimal))
318 (native-inputs
319 (list bc coreutils-minimal))
320 (arguments
321 (list
322 #:test-target "test"
323 #:phases
324 #~(modify-phases %standard-phases
325 ;; Ensure that a store path to /bin/sh is detected as a POSIX shell by
326 ;; modifying the pattern matching in the use_defshell() function.
327 ;; Without this, the tests won't correctly detect our provided default
328 ;; shell as a POSIX shell and will thus fail.
329 (add-after 'unpack 'fix-shell-detection
330 (lambda _
331 (substitute* "configure"
332 (("sh\\|/bin/sh\\|\\*/bsh)")
333 "*/bin/sh)"))))
334 (add-after 'configure 'fix-test ; fix from nixpkgs
335 (lambda* (#:key inputs native-inputs #:allow-other-keys)
336 (substitute* "unit-tests/unexport-env.mk"
337 (("PATH=\t/bin:/usr/bin:/sbin:/usr/sbin")
338 "PATH := ${PATH}"))
339 (substitute* '("unit-tests/varmod-sun-shell1.exp"
340 "unit-tests/suff.exp")
341 (("/bin/sh")
342 (search-input-file (or native-inputs inputs) "/bin/sh")))
343 (substitute* '("unit-tests/opt-keep-going-indirect.mk"
344 "unit-tests/opt-keep-going-indirect.exp")
345 (("false")
346 (search-input-file (or native-inputs inputs) "/bin/false"))))))
347 #:configure-flags
348 #~(list
349 (string-append
350 "--with-defshell=" #$(this-package-input "bash-minimal") "/bin/sh")
351 (string-append
352 "--with-default-sys-path=" #$output "/share/mk"))
353 #:make-flags
354 #~(list
355 "INSTALL=install" ; use coreutils' install
356 (string-append
357 "BROKEN_TESTS="
358 (string-join
359 (list "cmd-interrupt"
360 "deptgt-interrupt"
361 "varmod-localtime"
362 ;; directive-export failures are related to TZ env.
363 ;; these tests are also disabled by nixpkgs.
364 "directive-export"
365 "directive-export-gmake"
366 " "))))))
367 (home-page "http://www.crufty.net/help/sjg/bmake.htm")
368 (synopsis "BSD's make")
369 (description
370 "bmake is a program designed to simplify the maintenance of other
371programs. Its input is a list of specifications as to the files upon which
372programs and other files depend.")
373 (license license:bsd-3)))
374
375(define-public gn
376 (let ((commit "6f8c0328ee29c76e3566a216f2f0cf2992daa6ed")
377 (revision "2409")) ;as returned by `git describe`, used below
378 (package
379 (name "gn")
380 (version (git-version "0.0" revision commit))
381 (home-page "https://gn.googlesource.com/gn")
382 (source (origin
383 (method git-fetch)
384 (uri (git-reference (url home-page) (commit commit)))
385 (sha256
386 (base32
387 "1qc9d0q33p64q28vhpkl1v1fs712g5c9a5a9rz3gqil0xb8qmpim"))
388 (file-name (git-file-name name version))))
389 (build-system gnu-build-system)
390 (arguments
391 (list #:phases
392 #~(modify-phases %standard-phases
393 (add-before 'configure 'set-build-environment
394 (lambda _
395 (setenv "CC" "gcc")
396 (setenv "CXX" "g++")
397 (setenv "CXXFLAGS"
398 "-g -O2 -Wno-error=redundant-move -Wno-error=comment")
399 (setenv "AR" "ar")))
400 (replace 'configure
401 (lambda _
402 (invoke "python" "build/gen.py"
403 "--no-last-commit-position")))
404 (add-after 'configure 'create-last-commit-position
405 (lambda _
406 ;; Mimic GenerateLastCommitPosition from gen.py.
407 (call-with-output-file "out/last_commit_position.h"
408 (lambda (port)
409 (format port
410 "// Generated by Guix.
411
412#ifndef OUT_LAST_COMMIT_POSITION_H_
413#define OUT_LAST_COMMIT_POSITION_H_
414
415#define LAST_COMMIT_POSITION_NUM ~a
416#define LAST_COMMIT_POSITION \"~a (~a)\"
417
418#endif // OUT_LAST_COMMIT_POSITION_H_
419"
420 #$revision #$revision
421 #$(string-take commit 12))))))
422 (replace 'build
423 (lambda _
424 (invoke "ninja" "-C" "out" "gn"
425 "-j" (number->string (parallel-job-count)))))
426 (replace 'check
427 (lambda* (#:key tests? #:allow-other-keys)
428 (if tests?
429 (begin
430 (invoke "ninja" "-C" "out" "gn_unittests"
431 "-j" (number->string (parallel-job-count)))
432 (invoke "./out/gn_unittests"))
433 (format #t "test suite not run~%"))))
434 (replace 'install
435 (lambda _
436 (install-file "out/gn" (string-append #$output "/bin")))))))
437 (native-inputs
438 (list ninja python-wrapper))
439 (synopsis "Generate Ninja build files")
440 (description
441 "GN is a tool that collects information about a project from @file{.gn}
442files and generates build instructions for the Ninja build system.")
443 ;; GN is distributed as BSD-3, but bundles some files from ICU using the
444 ;; X11 license.
445 (license (list license:bsd-3 license:x11)))))
446
447(define-public maturin
448 (package
449 (name "maturin")
450 (version "1.11.5")
451 (source (origin
452 (method url-fetch)
453 (uri (crate-uri "maturin" version))
454 (file-name (string-append name "-" version ".tar.gz"))
455 (sha256
456 (base32
457 "1w36bxbxn455bh5ymv1i2crqkvpkzjni06b25gj7bb14sq4h7s10"))
458 (patches (search-patches "maturin-no-cross-compile.patch"))))
459 (build-system cargo-build-system)
460 (arguments
461 (list
462 #:modules '((guix build cargo-build-system)
463 ((guix build pyproject-build-system) #:prefix py:)
464 (guix build utils))
465 #:imported-modules `((guix build cargo-build-system)
466 (guix build cargo-utils)
467 ,@%pyproject-build-system-modules)
468 #:install-source? #f
469 #:cargo-test-flags
470 ''("--"
471 ;; A sample pyproject.toml is not provided by the package for the
472 ;; tests to run.
473 "--skip=build_options::tests::test_find_bridge_bin"
474 "--skip=build_options::tests::test_find_bridge_cffi"
475 "--skip=build_options::tests::test_find_bridge_pyo3"
476 "--skip=build_options::tests::test_find_bridge_pyo3_abi3"
477 "--skip=build_options::tests::test_find_bridge_pyo3_feature"
478 "--skip=metadata::tests::test_implicit_readme"
479 "--skip=metadata::tests::test_merge_metadata_from_pyproject_dynamic_license_test"
480 "--skip=metadata::tests::test_merge_metadata_from_pyproject_toml"
481 "--skip=metadata::tests::test_merge_metadata_from_pyproject_toml_with_customized_python_source_dir"
482 "--skip=metadata::tests::test_pep639"
483 "--skip=module_writer::mock_writer::metadata_hello_world_pep639"
484 "--skip=pyproject_toml::tests::test_warn_missing_maturin_version")
485 #:phases
486 #~(modify-phases %standard-phases
487 (add-after 'build 'build-python-module
488 (lambda _
489 ;; Match the features from the cargo-build-system and Cargo.toml.
490 (setenv "MATURIN_SETUP_ARGS" "--features=default")
491 ((assoc-ref py:%standard-phases 'build))))
492
493 ;; We can't use the pyproject install phase because maturin is a
494 ;; binary, not a python script.
495 (add-after 'install 'install-python-module
496 (lambda* (#:key inputs outputs #:allow-other-keys)
497 (let ((wheel (car (find-files "dist" "\\.whl$")))
498 (site-dir (py:site-packages inputs outputs))
499 (pyversion
500 (string-append "python"
501 (py:python-version
502 (assoc-ref inputs "python-wrapper")))))
503 (invoke "python" "-m" "zipfile" "-e" wheel site-dir)
504 (mkdir-p (string-append #$output "/bin"))
505 (for-each delete-file
506 (find-files (string-append #$output "/lib/" pyversion)
507 "^maturin$")))))
508 (add-after 'install 'install-completions
509 (lambda _
510 (let ((share (string-append #$output "/share"))
511 (maturin (string-append #$output "/bin/maturin")))
512 ;; TODO? fig, powershell
513 (mkdir-p (string-append #$output "/etc/bash_completion.d"))
514 (with-output-to-file
515 (string-append #$output "/etc/bash_completion.d/maturin")
516 (lambda _ (invoke maturin "completions" "bash")))
517 (mkdir-p (string-append share "/fish/vendor_completions.d"))
518 (with-output-to-file
519 (string-append share "/fish/vendor_completions.d/maturin.fish")
520 (lambda _ (invoke maturin "completions" "fish")))
521 (mkdir-p (string-append share "/zsh/site-functions"))
522 (with-output-to-file
523 (string-append share "/zsh/site-functions/_maturin")
524 (lambda _ (invoke maturin "completions" "zsh")))
525 (mkdir-p (string-append share "/elvish/lib"))
526 (with-output-to-file
527 (string-append share "/elvish/lib/maturin")
528 (lambda _ (invoke maturin "completions" "elvish")))
529 (mkdir-p (string-append share "/nushell/vendor/autoload"))
530 (with-output-to-file
531 (string-append share "/nushell/vendor/autoload/maturin")
532 (lambda _ (invoke maturin "completions" "nushell")))))))))
533 (propagated-inputs
534 (list python-tomli))
535 (inputs (append
536 (list (list zstd "lib")
537 bzip2)
538 (cargo-inputs 'maturin)))
539 (native-inputs
540 (list pkg-config
541 python-wheel
542 python-wrapper
543 python-setuptools-rust))
544 (home-page "https://github.com/pyo3/maturin")
545 (synopsis "Build and publish crates and python packages")
546 (description
547 "Build and publish crates with @code{pyo3}, @code{rust-cpython} and
548@code{cffi} bindings as well as rust binaries as python packages.")
549 (license (list license:expat license:asl2.0))))
550
551(define-public meson
552 (package
553 (name "meson")
554 (version "1.9.0")
555 (source (origin
556 (method url-fetch)
557 (uri (string-append "https://github.com/mesonbuild/meson/"
558 "releases/download/" version "/meson-"
559 version ".tar.gz"))
560 (sha256
561 (base32
562 "13a9pj7d2mxgv5gbd78di4pb4w722vjis0vmk38m1vdm95v2f9yd"))
563 (patches
564 (search-patches "meson-gir-fallback-path.patch"
565 "meson-keep-rpath-vicinity.patch"))))
566 (build-system gnu-build-system)
567 (arguments
568 (list
569 #:tests? #f ;disabled to avoid extra dependencies
570 ;; Custom build steps to prevent using pyproject-build-system which
571 ;; allows to edit the latter without a C++ world rebuild.
572 #:phases
573 #~(modify-phases %standard-phases
574 (delete 'bootstrap)
575 (delete 'configure)
576 (replace 'build
577 (lambda _
578 (invoke "python" "./setup.py" "build")))
579 (replace 'install
580 (lambda _
581 (invoke "python" "./setup.py" "install"
582 (string-append "--prefix=" #$output) "--no-compile")
583 (invoke "python" "-m" "compileall"
584 "--invalidation-mode=unchecked-hash" #$output)))
585 ;; Meson calls the various executables in out/bin through the
586 ;; Python interpreter, so we cannot use the shell wrapper.
587 (add-after 'install 'wrap
588 (lambda _
589 (let* ((mdist (car (find-files #$output "^mdist\\.py$")))
590 (site (dirname (dirname mdist))))
591 (substitute* (string-append #$output "/bin/meson")
592 (("import sys" all)
593 (format #f "~a~%sys.path.insert(0, ~s)" all site)))))))))
594 (native-inputs (list python-setuptools-bootstrap))
595 (inputs (list python-wrapper ninja))
596 (home-page "https://mesonbuild.com/")
597 (synopsis "Build system designed to be fast and user-friendly")
598 (description
599 "The Meson build system is focused on user-friendliness and speed.
600It can compile code written in C, C++, Fortran, Java, Rust, and other
601languages. Meson provides features comparable to those of the
602Autoconf/Automake/make combo. Build specifications, also known as @dfn{Meson
603files}, are written in a custom domain-specific language (@dfn{DSL}) that
604resembles Python.")
605 (license license:asl2.0)))
606
607(define-public meson-documentation
608 (package
609 (inherit meson)
610 (version (package-version meson))
611 (name "meson-documentation")
612 (source (origin
613 ;; XXX: The documentation is not included in the release
614 ;; tarball; use git-fetch, preserving the version of our meson
615 ;; package to have the matching documentation.
616 (method git-fetch)
617 (uri (git-reference
618 (url "https://github.com/mesonbuild/meson")
619 (commit version)))
620 (file-name (git-file-name name version))
621 (sha256
622 (base32
623 "0f9pvc1p2z51qh4i6yd8cydbpcdkkblsv68zxdgcvk9j4akaaqb9"))))
624 (name "meson-documentation")
625 (build-system meson-build-system)
626 (arguments
627 ;; Disable the HTML documentation, which requires hotdoc, which itself
628 ;; has multiple Node.js dependencies, and is thus difficult to package in
629 ;; Guix.
630 (list #:configure-flags #~(list "-Dhtml=false")
631 #:phases #~(modify-phases %standard-phases
632 (add-after 'unpack 'chdir
633 (lambda _
634 (chdir "docs"))))))
635 (native-inputs (list python python-strictyaml))
636 (synopsis "Meson reference manual")
637 (description "This package provides the reference manual of
638Meson (@samp{meson-reference(3)}).")))
639
640(define-public muon
641 (package
642 (name "muon")
643 (version "0.6.0")
644 (source (origin
645 (method git-fetch)
646 (uri (git-reference
647 (url "https://github.com/muon-build/muon")
648 (commit version)))
649 (file-name (git-file-name name version))
650 (sha256
651 (base32
652 "1j5xw3i3z4v0hhlsxy1f8lqddlrr0i5h5yxz8mlxdfcn40d1sfn0"))))
653 (build-system meson-build-system)
654 (arguments
655 (list #:meson (computed-file "null-package" #~(mkdir #$output))
656 #:ninja samu-as-ninja-wrapper
657 #:configure-flags #~(list "-Dsamurai=disabled")
658 #:tests? #f ;to avoid extra dependencies
659 #:phases
660 #~(modify-phases %standard-phases
661 (add-after 'patch-source-shebangs 'build-muon-bootstrap
662 (lambda _
663 (setenv "CC" #$(cc-for-target))
664 (setenv "CFLAGS" "-DBOOTSTRAP_NO_SAMU")
665 (invoke "./bootstrap.sh" "build")))
666 (add-after 'build-muon-bootstrap 'setup-muon-bootstrap-as-meson
667 (lambda _
668 (mkdir "bin")
669 (symlink "../build/muon-bootstrap" "bin/meson")
670 (setenv "PATH" (string-append (getcwd) "/bin:"
671 (getenv "PATH"))))))))
672 (native-inputs (list samurai))
673 (inputs (list bash-minimal pkgconf))
674 (native-search-paths (list $PKG_CONFIG_PATH))
675 (home-page "https://muon.build/")
676 (synopsis "Meson build system alternative implementation in C99")
677 (description "Muon is an implementation of the meson build system in c99
678with minimal dependencies.")
679 (license license:gpl3))) ;for the combined work
680
681(define-public muon-as-meson-wrapper
682 (package/inherit muon
683 (name "muon-as-meson-wrapper")
684 (build-system trivial-build-system)
685 (arguments
686 (list #:builder
687 (with-imported-modules '((guix build utils))
688 #~(begin
689 (use-modules (guix build utils))
690 (let ((bindir (string-append #$output "/bin"))
691 (samu (string-append #$(this-package-input "muon")
692 "/bin/muon")))
693 (mkdir-p bindir)
694 (symlink samu (string-append bindir "/meson")))))))
695 (inputs (list muon))
696 (description "This package provides the @command{meson} command,
697implemented as a symbolic link to the @command{muon} command of @code{muon}
698package.")))
699
700(define-public premake4
701 (package
702 (name "premake")
703 (version "4.3")
704 (source (origin
705 (method url-fetch)
706 (uri (string-append "mirror://sourceforge/premake/Premake/"
707 version "/premake-" version "-src.zip"))
708 (sha256
709 (base32
710 "1017rd0wsjfyq2jvpjjhpszaa7kmig6q1nimw76qx3cjz2868lrn"))))
711 (build-system gnu-build-system)
712 (native-inputs
713 (list unzip)) ; for unpacking the source
714 (arguments
715 `(#:make-flags (list (string-append "CC=" ,(cc-for-target)))
716 #:tests? #f ; No test suite
717 #:phases
718 (modify-phases %standard-phases
719 (delete 'configure)
720 (add-after 'unpack 'enter-source
721 (lambda _ (chdir "build/gmake.unix") #t))
722 (replace 'install
723 (lambda* (#:key outputs #:allow-other-keys)
724 (install-file "../../bin/release/premake4"
725 (string-append (assoc-ref outputs "out") "/bin"))
726 #t)))))
727 (synopsis "Portable software build tool")
728 (description "@code{premake4} is a command line utility that reads a
729scripted definition of a software project and outputs @file{Makefile}s or
730other lower-level build files.")
731 (home-page "https://premake.github.io")
732 (license license:bsd-3)))
733
734(define-public premake5
735 (package
736 (inherit premake4)
737 (version "5.0.0-beta7")
738 (source (origin
739 (method url-fetch)
740 (uri (string-append "https://github.com/premake/premake-core/"
741 "releases/download/v" version
742 "/premake-" version "-src.zip"))
743 (sha256
744 (base32
745 "0q287af75d6w3c7dbfq7rmbh9isqzs9v30fjpm37lcafs2p7966k"))))
746 (arguments
747 (substitute-keyword-arguments arguments
748 ((#:phases phases)
749 `(modify-phases ,phases
750 (replace 'enter-source
751 ;; For some reason we end up in the .github subdir of the source,
752 ;; which is why we first go back a dir unlike in premake4.
753 (lambda _ (chdir "..") #t))
754 (add-after 'enter-source 'enter-build-dir
755 (lambda _ (chdir "build/gmake.unix") #t))
756 (add-after 'enter-source 'patch-builtin-uuidgen
757 ;; Use built-in UUID generation
758 (lambda _
759 (substitute* "src/host/os_uuid.c"
760 (("#elif PLATFORM_LINUX")
761 "#elif 0"))
762 (substitute* "build/gmake.unix/Premake5.make"
763 (("-luuid")
764 ""))
765 (substitute* "premake5.lua"
766 (("filter \"system:linux or macosx\"")
767 "filter \"system:macosx\""))))
768 (replace 'install
769 (lambda* (#:key outputs #:allow-other-keys)
770 (install-file "../../bin/release/premake5"
771 (string-append (assoc-ref outputs "out") "/bin"))
772 #t))))))
773 (description "@code{premake5} is a command line utility that reads a
774scripted definition of a software project and outputs @file{Makefile}s or
775other lower-level build files.")))
776
777(define-public scons
778 (package
779 (name "scons")
780 (version "4.9.1")
781 (source (origin
782 (method git-fetch)
783 (uri (git-reference
784 (url "https://github.com/SCons/scons")
785 (commit version)))
786 (file-name (git-file-name name version))
787 (patches (search-patches "scons-test-environment.patch"))
788 (sha256
789 (base32
790 "1h9653965bqf8zab4gbsilsmnhp6nxn5b5b9yvm6pf401qjx8n4x"))))
791 (build-system pyproject-build-system)
792 (arguments
793 (list
794 #:modules (append %pyproject-build-system-modules
795 '((ice-9 ftw) (srfi srfi-26)))
796 #:phases
797 #~(modify-phases (@ (guix build pyproject-build-system) %standard-phases)
798 (add-after 'unpack 'adjust-hard-coded-paths
799 (lambda _
800 (substitute* "SCons/Script/Main.py"
801 (("/usr/share/scons")
802 (string-append #$output "/share/scons")))))
803 (replace 'check
804 (lambda* (#:key tests? #:allow-other-keys)
805 (when tests?
806 ;; remove these tests as they require a read/write filesystem
807 (delete-file "SCons/Variables/PathVariableTests.py")
808 (invoke "python" "runtest.py" "--all" "--unit-only" ))))
809 (add-after 'install 'move-manuals
810 (lambda _
811 ;; XXX: For some reason manuals get installed to the top-level
812 ;; #$output directory.
813 (with-directory-excursion #$output
814 (let ((man1 (string-append #$output "/share/man/man1"))
815 (stray-manuals (scandir "."
816 (cut string-suffix? ".1" <>))))
817 (mkdir-p man1)
818 (for-each (lambda (manual)
819 (link manual (string-append man1 "/" manual))
820 (delete-file manual))
821 stray-manuals))))))))
822 (native-inputs
823 ;; TODO: Add 'fop' when available in Guix to generate manuals.
824 (list python-setuptools python-lxml python-wheel
825 ;;For tests.
826 python-psutil))
827 (home-page "https://scons.org/")
828 (synopsis "Software construction tool written in Python")
829 (description
830 "SCons is a software construction tool. Think of SCons as an improved,
831cross-platform substitute for the classic Make utility with integrated
832functionality similar to autoconf/automake and compiler caches such as ccache.
833In short, SCons is an easier, more reliable and faster way to build
834software.")
835 (license license:x11)))
836
837(define-public tup
838 (package
839 (name "tup")
840 (version "0.8")
841 (source (origin
842 (method url-fetch)
843 (uri (string-append "https://gittup.org/tup/releases/tup-v"
844 version ".tar.gz"))
845 (sha256
846 (base32
847 "1yv60apd8dsigb74cjw1nzvqqqpjbsxz1i9dhq24jdkjwgsra3w4"))
848 (modules '((guix build utils)))
849 (snippet
850 '(begin
851 ;; NOTE: Tup uses a slightly modified Lua, so it cannot be
852 ;; unbundled. See: src/lua/tup-lua.patch
853 (delete-file-recursively "src/pcre")
854 (delete-file-recursively "src/sqlite3")
855 (delete-file-recursively "src/inih")
856 ;; ldpreload Used only on BSD. Deleting to avoid putting
857 ;; license:bsd-2 in the licenses field
858 (delete-file-recursively "src/ldpreload")))))
859 (build-system gnu-build-system)
860 (arguments
861 (list
862 #:phases
863 #~(modify-phases %standard-phases
864 ;; There is a bootstrap script, but it doesn't do what you think - it
865 ;; builds tup.
866 (delete 'bootstrap)
867 (replace 'configure
868 (lambda* (#:key inputs #:allow-other-keys)
869 (substitute* "build.sh"
870 ;; LDFLAGS
871 (("-lm") "-lm -lsqlite3 -linih `pcre2-config --libs8`")
872 ;; CFLAGS
873 (("-DHAVE_CONFIG_H") "-DHAVE_CONFIG_H `pcre2-config --cflags`")
874 ;; Don't build bundled inih and pcre
875 (("\\.\\./src/inih/ini\\.c \\.\\./src/pcre/\\*\\.c") "")
876 ;; Don't build bundled sqlite3
877 (("\\$CC \\$CFLAGS -c \\.\\./src/sqlite3/sqlite3\\.c.*") ""))
878 (substitute* "src/tup/option.c"
879 (("\"ini.h\"") "<ini.h>"))
880 (substitute* '("src/tup/tupid.h"
881 "src/tup/db.c")
882 (("sqlite3/sqlite3.h")
883 (search-input-file inputs "include/sqlite3.h")))
884 (with-output-to-file "tup.config"
885 (lambda _
886 (format #t (string-append "CONFIG_TUP_USE_SYSTEM_SQLITE=y~%"
887 "CONFIG_TUP_USE_SYSTEM_PCRE=y~%"
888 "CONFIG_TUP_USE_SYSTEM_INIH=y~%"))))))
889 (delete 'check) ; Most tests require fuse to be setup
890 (replace 'build
891 (lambda _
892 ;; Based on bootstrap-nofuse.sh, but with a detour to patch-shebang.
893 (invoke "./build.sh")
894 (invoke "./build/tup" "init")
895 (invoke "./build/tup" "generate" "--verbose" "build-nofuse.sh")
896 (patch-shebang "build-nofuse.sh")
897 (invoke "./build-nofuse.sh")))
898 (replace 'install
899 (lambda* (#:key outputs #:allow-other-keys)
900 (let* ((outdir (assoc-ref outputs "out"))
901 (ftdetect (string-append outdir
902 "/share/vim/vimfiles/ftdetect")))
903 (install-file "tup" (string-append outdir "/bin"))
904 (install-file "tup.1" (string-append outdir "/share/man/man1"))
905 (install-file "contrib/syntax/tup.vim"
906 (string-append outdir "/share/vim/vimfiles/syntax"))
907 (mkdir-p ftdetect)
908 (with-output-to-file (string-append ftdetect "/tup.vim")
909 (lambda _
910 (display "au BufNewFile,BufRead Tupfile,*.tup setf tup")))))))))
911 (inputs
912 (list fuse libinih pcre2 sqlite))
913 (native-inputs
914 (list pkg-config))
915 (home-page "https://gittup.org/tup/")
916 (synopsis "Fast build system that's hard to get wrong")
917 (description "Tup is a generic build system based on a directed acyclic
918graphs of commands to be executed. Tup instruments your build to detect the
919exact dependencies of the commands, allowing you to take advantage of ideal
920parallelism during incremental builds, and detecting any situations where
921a build worked by accident.")
922 (license (list
923 license:gpl2
924 license:x11)))) ; src/lua
925
926(define-public osc
927 (package
928 (name "osc")
929 (version "1.19.0")
930 (source
931 (origin
932 (method git-fetch)
933 (uri (git-reference
934 (url "https://github.com/openSUSE/osc")
935 (commit version)))
936 (file-name (git-file-name name version))
937 (sha256
938 (base32 "09an4c5gjc99a6bfy4ax5yyng14v7b4fknkdzwl0hn89q5990xab"))))
939 (build-system pyproject-build-system)
940 (arguments
941 (list
942 #:tests? #f ; XXX: Fix tests.
943 #:phases
944 #~(modify-phases %standard-phases
945 (add-before 'check 'check-setup
946 (lambda* (#:key tests? #:allow-other-keys)
947 (when tests?
948 (setenv "HOME" (getcwd))))))))
949 (native-inputs
950 (list python-setuptools
951 python-wheel
952 diffstat))
953 (inputs
954 (list python-urllib3
955 python-ruamel.yaml
956 python-m2crypto
957 python-pycurl
958 rpm)) ; for python-rpm
959 (home-page "https://github.com/openSUSE/osc")
960 (synopsis "Open Build Service command line tool")
961 (description "@command{osc} is a command line interface to the Open Build
962Service. It allows you to checkout, commit, perform reviews etc. The vast
963majority of the OBS functionality is available via commands and the rest can
964be reached via direct API calls.")
965 (license license:gpl2+)))
966
967(define-public compdb
968 (package
969 (name "compdb")
970 (version "0.2.0")
971 (source
972 (origin
973 (method git-fetch)
974 (uri (git-reference
975 (url "https://github.com/Sarcasm/compdb")
976 (commit (string-append "v" version))))
977 (file-name (git-file-name name version))
978 (sha256
979 (base32 "0f4x0gm5n1mr87dx3gzn5da16a1qhd2y3kz22dl5xsd9pd720l4w"))))
980 (build-system pyproject-build-system)
981 (arguments
982 (list
983 #:test-backend ''unittest))
984 (native-inputs (list python-setuptools))
985 (propagated-inputs (list python-configparser))
986 (home-page "https://github.com/Sarcasm/compdb")
987 (synopsis "Compilation database Swiss army knife")
988 (description
989 "@command{compdb} is a command line tool to manipulate compilation
990databases. It eases the usage of tooling in a codebase by spoon-feeding the
991right compilation options.")
992 (license license:expat)))
993
994(define-public compiledb
995 (package
996 (name "compiledb")
997 (version "0.10.1")
998 (source
999 (origin
1000 (method git-fetch)
1001 (uri (git-reference
1002 (url "https://github.com/nickdiego/compiledb")
1003 (commit (string-append "v" version))))
1004 (file-name (git-file-name name version))
1005 (sha256
1006 (base32 "0qricdgqzry7j3rmgwyd43av3c2kxpzkh6f9zcqbzrjkn78qbpd4"))))
1007 (build-system pyproject-build-system)
1008 (arguments
1009 (list
1010 #:phases
1011 #~(modify-phases %standard-phases
1012 (add-after 'unpack 'no-compat-shim-dependency
1013 ;; shutilwhich is only needed for python 3.3 and earlier
1014 (lambda* (#:key inputs #:allow-other-keys)
1015 (substitute* "setup.py"
1016 (("^ *'shutilwhich'\n")
1017 ""))
1018 (substitute* "compiledb/compiler.py"
1019 (("shutilwhich")
1020 "shutil"))
1021 (substitute* "tests/data/multiple_commands_oneline.txt"
1022 (("/bin/echo")
1023 (search-input-file inputs "bin/echo"))))))))
1024 (propagated-inputs (list python-bashlex python-click))
1025 (native-inputs (list python-pytest python-setuptools python-wheel))
1026 (home-page "https://github.com/nickdiego/compiledb")
1027 (synopsis
1028 "Generate Clang JSON Compilation Database files for make-based build systems")
1029 (description
1030 "@code{compiledb} provides a @code{make} python wrapper script which,
1031besides executing the make build command, updates the JSON compilation
1032database file corresponding to that build, resulting in a command-line
1033interface similar to Bear.")
1034 (license license:gpl3)))
1035
1036(define-public build
1037 (package
1038 (name "build")
1039 (version "0.3.10")
1040 (source
1041 (origin
1042 (method url-fetch)
1043 (uri (string-append "https://www.codesynthesis.com/download/"
1044 "build/" (version-major+minor version)
1045 "/build-" version ".tar.bz2"))
1046 (sha256
1047 (base32 "1lx5rpnmsbip43zpp0a57sl5rm7pjb0y6i2si6rfglfp4p9d3z76"))))
1048 (build-system gnu-build-system)
1049 (arguments
1050 `(#:make-flags (list (string-append "install_prefix=" %output))
1051 #:tests? #f
1052 #:phases (modify-phases %standard-phases
1053 (delete 'build)
1054 (delete 'configure))))
1055 (home-page "https://www.codesynthesis.com/projects/build/")
1056 (synopsis "Massively-parallel build system implemented on top of GNU make")
1057 (description "Build is a massively-parallel software build system
1058implemented on top of GNU Make, designed with the following tasks in mind:
1059@itemize
1060@item configuration
1061@item building
1062@item testing
1063@item installation
1064@end itemize
1065Build has features such as:
1066@itemize
1067@item Position-independent makefiles.
1068@item Non-recursive multi-makefile include-based structure.
1069@item Leaf makefiles are full-fledged GNU makefiles, not just variable definitions.
1070@item Complete dependency graph.
1071@item Inter-project dependency tracking.
1072@item Extensible language/compiler framework.
1073@end itemize")
1074 (license license:gpl2+)))
1075
1076(define-public genie
1077 (let ((commit "22cc907a4351db46c55f73e6aa901f1b2f0c52ad")
1078 (revision "0"))
1079 (package
1080 (name "genie")
1081 (version (git-version "1170" revision commit))
1082 (source (origin
1083 (method git-fetch)
1084 (uri (git-reference
1085 (url "https://github.com/bkaradzic/genie")
1086 (commit commit)))
1087 (file-name (git-file-name name version))
1088 (sha256
1089 (base32
1090 "1wxhbdnr52qa2xr1i83577mwr25fxr5vby4r7m5brp9z5a08fwry"))))
1091 (build-system gnu-build-system)
1092 (arguments
1093 (list #:phases #~(modify-phases %standard-phases
1094 (delete 'configure)
1095 (replace 'install
1096 (lambda _
1097 (install-file "bin/linux/genie"
1098 (string-append #$output "/bin")))))
1099 #:tests? #f)) ;no tests
1100 (home-page "https://github.com/bkaradzic/genie")
1101 (synopsis "Project generator")
1102 (description
1103 "GENie generates projects from Lua scripts, making it easy to apply the
1104same settings to multiple projects. It supports generating projects using GNU
1105Makefiles, JSON Compilation Database, and experimentally Ninja.")
1106 (license license:bsd-3))))
1107
1108(define*-public (gnulib-checkout #:key
1109 version
1110 (revision "1")
1111 commit
1112 hash)
1113 "Return as a package the exact gnulib checkout."
1114 (package
1115 (name "gnulib")
1116 (version (git-version version revision commit))
1117 (source
1118 (origin
1119 (method git-fetch)
1120 (uri (git-reference
1121 (url "https://git.savannah.gnu.org/git/gnulib.git/")
1122 (commit commit)))
1123 (file-name (git-file-name name version))
1124 (sha256 hash)
1125 (snippet
1126 (with-imported-modules (source-module-closure '((guix build utils)))
1127 #~(begin
1128 (use-modules (guix build utils)
1129 (ice-9 ftw)
1130 (ice-9 rdelim))
1131 ;; .c, .h and .gperf files whose first line is /* DO NOT EDIT!
1132 ;; GENERATED AUTOMATICALLY! */ are generated automatically based
1133 ;; on the unicode database. Since we replace the unicode
1134 ;; database with our own, we need to regenerate them. So, they
1135 ;; are removed from the source. They are sprinkled all over the
1136 ;; place unfortunately, so we can’t exclude whole directories.
1137 (let ((generated-automatically?
1138 (lambda (filename . unused)
1139 (and (or (string-suffix? ".c" filename)
1140 (string-suffix? ".h" filename)
1141 (string-suffix? ".gperf" filename))
1142 (call-with-input-file filename
1143 (lambda (port)
1144 (let ((first-line (read-line port)))
1145 (equal?
1146 first-line
1147 "/* DO NOT EDIT! GENERATED AUTOMATICALLY! */"))))))))
1148 (for-each delete-file (find-files (getcwd) generated-automatically?)))
1149 ;; Other files are copied from UCD.
1150 (for-each delete-file
1151 '("tests/unigbrk/GraphemeBreakTest.txt"
1152 "tests/uninorm/NormalizationTest.txt"
1153 "tests/uniname/UnicodeData.txt"
1154 "tests/uniname/NameAliases.txt"
1155 ;; FIXME: tests/uniname/HangulSyllableNames.txt
1156 ;; seems like a UCD file but it is not distributed
1157 ;; with UCD.
1158 "tests/uniwbrk/WordBreakTest.txt")))))
1159 (patches (search-patches "gnulib-bootstrap.patch"))))
1160 (build-system copy-build-system)
1161 (arguments
1162 (list
1163 #:install-plan
1164 #~'(("./gnulib-tool" "bin/")
1165 ("./gnulib-tool.py" "bin/")
1166 ("./gnulib-tool.sh" "bin/")
1167 ("." "src/gnulib" #:exclude-regexp ("\\.git.*")))
1168 #:modules '((ice-9 match)
1169 (guix build utils)
1170 (guix build copy-build-system)
1171 ((guix build gnu-build-system) #:prefix gnu:))
1172 #:phases
1173 #~(modify-phases %standard-phases
1174 ;; Since this package is intended to be used in source form, it
1175 ;; should not retain references to tools (with the exception for the
1176 ;; commands we install, which should be wrapper for proper
1177 ;; execution).
1178 (delete 'patch-source-shebangs)
1179 (delete 'patch-generated-file-shebangs)
1180 (delete 'patch-usr-bin-file)
1181 (add-before 'install 'check
1182 (assoc-ref gnu:%standard-phases 'check))
1183 (add-before 'check 'fix-tests
1184 (lambda _
1185 (substitute* "Makefile"
1186 (("-f maint.mk syntax-check")
1187 "_gl-Makefile=yes -f maint.mk syntax-check"))
1188 (invoke "git" "init")
1189 (invoke "git" "config" "user.name" "Guix")
1190 (invoke "git" "config" "user.email" "guix@localhost")
1191 (invoke "git" "add" ".")
1192 ;; Syntax checks are only run against committed files.
1193 (invoke "git" "commit" "-m" "Prepare for tests.")))
1194 (add-before 'check 'disable-failing-tests
1195 (lambda _
1196 (substitute* "cfg.mk"
1197 (("local-checks-to-skip =")
1198 ;; sc_copyright_check fails because the fake commit date may
1199 ;; be later than the copyright year.
1200 "local-checks-to-skip = \\
1201 sc_Wundef_boolean \\
1202 sc_copyright_check \\
1203 sc_file_system \\
1204 sc_error_message_warn_fatal \\
1205 sc_indent \\
1206 sc_keep_gnulib_texi_files_mostly_ascii \\
1207 sc_prefer_angle_bracket_headers \\
1208 sc_prohibit_assert_without_use \\
1209 sc_prohibit_close_stream_without_use \\
1210 sc_prohibit_defined_have_decl_tests \\
1211 sc_prohibit_doubled_word \\
1212 sc_prohibit_empty_lines_at_EOF \\
1213 sc_prohibit_intprops_without_use \\
1214 sc_prohibit_openat_without_use \\
1215 sc_prohibit_test_minus_ao \\
1216 sc_readme_link_copying \\
1217 sc_readme_link_install \\
1218 sc_unportable_grep_q \\
1219 sc_unsigned_char \\
1220 sc_unsigned_int \\
1221 sc_unsigned_long \\
1222 sc_unsigned_short"))
1223 (substitute* "Makefile"
1224 (("sc_check_(sym_list|copyright|config_h_reminder)" rule)
1225 (string-append "disabled_check_" rule))
1226 (("sc_cpp_indent_check")
1227 "disabled_cpp_indent_check")
1228 (("sc_prefer_ac_check_funcs_once")
1229 "disabled_prefer_ac_check_funcs_once")
1230 (("sc_prohibit_(AC_LIBOBJ_in_m4|leading_TABs\
1231|sc_omitted_at)" rule)
1232 (string-append "disabled_prohibit_" rule)))))
1233 (add-before 'check 'regenerate-unicode
1234 (lambda* (#:key inputs #:allow-other-keys)
1235 (define (find-ucd-file name)
1236 (search-input-file inputs (string-append "share/ucd/" name)))
1237 (define (find-ucd-files . names)
1238 (map find-ucd-file names))
1239 (with-directory-excursion "lib"
1240 ;; See the compile-command buffer-local variable in
1241 ;; lib/gen-uni-tables.c
1242 (invoke "gcc" "-O" "-Wall" "gen-uni-tables.c"
1243 "-Iunictype" "-o" "gen-uni-tables")
1244 (apply invoke
1245 "./gen-uni-tables"
1246 (append
1247 (find-ucd-files "UnicodeData.txt"
1248 "PropList.txt"
1249 "DerivedCoreProperties.txt"
1250 "emoji/emoji-data.txt"
1251 "ArabicShaping.txt"
1252 "Scripts.txt"
1253 "Blocks.txt")
1254 (list
1255 #$(this-package-native-input "PropList.txt"))
1256 (find-ucd-files "BidiMirroring.txt"
1257 "EastAsianWidth.txt"
1258 "LineBreak.txt"
1259 "auxiliary/WordBreakProperty.txt"
1260 "auxiliary/GraphemeBreakProperty.txt"
1261 "CompositionExclusions.txt"
1262 "SpecialCasing.txt"
1263 "CaseFolding.txt")
1264 (list #$(package-version (this-package-native-input "ucd")))))
1265 (invoke "clisp" "-C" "uniname/gen-uninames.lisp"
1266 (find-ucd-file "UnicodeData.txt") ;input file
1267 (find-ucd-file "NameAliases.txt") ;alias file
1268 "uniname/uninames.h") ;output file
1269 (for-each
1270 (match-lambda
1271 ((ucd-file . directory)
1272 (copy-file (find-ucd-file ucd-file)
1273 (string-append "../tests/" directory "/"
1274 (basename ucd-file)))))
1275 '(("NameAliases.txt" . "uniname")
1276 ("UnicodeData.txt" . "uniname")
1277 ("NormalizationTest.txt" . "uninorm")
1278 ("auxiliary/GraphemeBreakTest.txt" . "unigbrk")
1279 ("auxiliary/WordBreakTest.txt" . "uniwbrk")))
1280 (delete-file "gen-uni-tables")))))))
1281 (inputs
1282 (list bash-minimal)) ;shebang for gnulib-tool
1283 (native-inputs
1284 (list
1285 bash-minimal python perl clisp
1286 ;; Unicode data:
1287 ucd
1288 (origin
1289 (method url-fetch)
1290 (uri (string-append
1291 "https://www.unicode.org/Public/"
1292 "3.0-Update1/PropList-3.0.1.txt"))
1293 (file-name "PropList.txt")
1294 (sha256
1295 (base32
1296 "0k6wyijyzdl5g3nibcwfm898kfydx1pqaz28v7fdvnzdvd5fz7lh")))
1297 ;; Programs for the tests:
1298 cppi indent git-minimal/pinned autoconf))
1299 (home-page "https://www.gnu.org/software/gnulib/")
1300 (synopsis "Source files to share among distributions")
1301 (description
1302 "Gnulib is a central location for common infrastructure needed by GNU
1303packages. It provides a wide variety of functionality, e.g., portability
1304across many systems, working with Unicode strings, cryptographic computation,
1305and much more. The code is intended to be shared at the level of source
1306files, rather than being a standalone library that is distributed, built, and
1307installed. The included @command{gnulib-tool} script helps with using Gnulib
1308code in other packages. Gnulib also includes copies of licensing and
1309maintenance-related files, for convenience.")
1310 (native-search-paths
1311 (list (search-path-specification
1312 (variable "GNULIB_SRCDIR")
1313 (files (list "src/gnulib"))
1314 (separator #f))))
1315 (license (list license:lgpl2.0+ license:gpl3+))))
1316
1317(define-public gnulib
1318 (gnulib-checkout
1319 #:version "2025-06-30" ;date from last commit on stable-202507 branch
1320 #:commit "9297749090b01720888dceeb5f6dab3d52dcef40"
1321 #:hash (base32 "10qyhji7q71fhq2956aszj6bipbf11hn0xcrrpkwj9azwindw7ch")))
1322
1323(define-public maak
1324 (package
1325 (name "maak")
1326 (version "0.8.3")
1327 (source
1328 (origin
1329 (method git-fetch)
1330 (uri (git-reference
1331 (url "https://codeberg.org/jjba23/maak.git")
1332 (commit (string-append "v" version))))
1333 (file-name (git-file-name name version))
1334 (sha256
1335 (base32 "0rlb643hqysyfpdgg91n0h6p1m78l9pmbf17xh4fqqzvsgng0dms"))))
1336 (build-system guile-build-system)
1337 (arguments
1338 (list
1339 #:source-directory "src"
1340 #:modules '((guix build guile-build-system)
1341 (guix build utils)
1342 (ice-9 match))
1343 #:phases
1344 #~(modify-phases %standard-phases
1345 (add-before 'build 'install-program-files
1346 (lambda _
1347 (let ((bin (string-append #$output "/bin"))
1348 (share (string-append #$output "/share")))
1349 (install-file "resources/help.txt"
1350 (string-append share "/resources"))
1351 (install-file "scripts/maak" bin)
1352 (chmod (string-append bin "/maak") #o755))))
1353 (add-after 'unpack 'fix-paths
1354 (lambda* (#:key inputs #:allow-other-keys)
1355 (for-each (match-lambda
1356 ((pattern program format-string)
1357 (substitute* "scripts/maak"
1358 ((pattern)
1359 (format #f format-string
1360 (search-input-file inputs
1361 (string-append "bin/"
1362 program)))))))
1363 '(("readlink -f " "readlink" "~s -f ")
1364 ("realpath " "realpath" "~s ")
1365 ("dirname " "dirname" "~s ")
1366 ("getopt " "getopt" "~s ")
1367 ("exec guile " "guile" "exec ~s ")))))
1368 (add-after 'build 'install-completions
1369 (lambda _
1370 (for-each (match-lambda
1371 ((src-file dest-dir dest-name)
1372 (let ((target-dir (string-append #$output dest-dir)))
1373 (mkdir-p target-dir)
1374 (copy-file src-file
1375 (string-append target-dir "/"
1376 dest-name)))))
1377 '(("scripts/maak-completion.bash"
1378 "/share/bash-completion/completions" "maak")
1379 ("scripts/maak-completion.fish"
1380 "/share/fish/vendor_completions.d" "maak.fish")
1381 ("scripts/maak-completion.zsh"
1382 "/share/zsh/site-functions" "_maak"))))))))
1383 (inputs (list guile-3.0 bash-minimal coreutils util-linux))
1384 (home-page "https://codeberg.org/jjba23/maak")
1385 (synopsis "Command runner à la Make using Guile Scheme")
1386 (description
1387 "Maak is a command runner and control plane for your
1388projects. It allows you to use the power of Lisp (Guile Scheme) to define
1389your tasks, build steps, repetitive tasks or other automation.
1390
1391With Maak you can easily call external shell commands and integrate with
1392your existing scripts and tools. It is inspired by the GNU Make utility
1393but it does away with a lot of the complexity that comes with its history.")
1394 (license license:gpl3+)))
1395
1396(define-public pdpmake
1397 (package
1398 (name "pdpmake")
1399 (version "2.0.4")
1400 (source
1401 (origin
1402 (method git-fetch)
1403 (uri (git-reference
1404 (url "git://git.frippery.org/pdpmake")
1405 (commit version)))
1406 (file-name (git-file-name name version))
1407 (sha256
1408 (base32
1409 "13qfvn0kw1fkpmjdpk0cscmvj5iycdq68kqfiml1slf1936pllb9"))))
1410 (build-system gnu-build-system)
1411 (arguments
1412 (list
1413 #:phases
1414 #~(modify-phases %standard-phases
1415 (delete 'configure)
1416 ;; pdpmake can be built easily without relying on a previous Make
1417 ;; implementation; let's do this for the sake of bootstrappability.
1418 (replace 'build
1419 (lambda _
1420 (let ((args (append (find-files "." "\\.c$")
1421 (list "-o" "make"))))
1422 (apply invoke #$(cc-for-target) args))))
1423 (replace 'check
1424 (lambda* (#:key tests? #:allow-other-keys)
1425 (when tests?
1426 (with-directory-excursion "testsuite"
1427 (invoke "./runtest" "-v")))))
1428 (replace 'install
1429 (lambda _
1430 (let ((bindir (string-append #$output "/bin"))
1431 (mandir (string-append #$output "/share/man/man1")))
1432 (mkdir-p bindir)
1433 (mkdir-p mandir)
1434 (install-file "make" bindir)
1435 (install-file "pdpmake.1" mandir)))))))
1436 (home-page "https://frippery.org/make/")
1437 (synopsis "Public domain POSIX make")
1438 (description
1439 "This package contains an implementation of POSIX make. The default
1440configuration enables extensions. Generally these extensions are compatible
1441with GNU make.")
1442 ;; pdpmake is distributed under the public domain, but the sources include
1443 ;; tests under the GPL license version 2.
1444 (license
1445 (list license:gpl2
1446 license:public-domain))))
1447
1448(define-public potato-make
1449 ;; No releases.
1450 (let ((commit "e8c09ce1f6a33c013b27961b0a07f991db33e6fb")
1451 (revision "0"))
1452 (package
1453 (name "potato-make")
1454 (version (git-version "0" revision commit))
1455 (source
1456 (origin
1457 (method git-fetch)
1458 (uri (git-reference
1459 (url "https://github.com/spk121/potato-make")
1460 (commit commit)))
1461 (file-name (git-file-name name version))
1462 (sha256
1463 (base32 "0axgrkqdfip5f2bp7d2dprd74g58lyc0c7lgg2m93k5jqn1lpbmj"))
1464 ;; Delete files of the seemingly unfinished pmake program.
1465 (snippet '(begin
1466 (delete-file "pmake")
1467 (delete-file "documents/pmake.org")
1468 (delete-file "make/main.scm")
1469 (rmdir "documents")
1470 (rmdir "make")))))
1471 (build-system guile-build-system)
1472 (arguments
1473 (list
1474 #:phases #~(modify-phases %standard-phases
1475 (add-after 'build 'check
1476 (lambda _
1477 ;; Delete test referencing nonexistent file.
1478 (delete-file "tests/parse.sh")
1479 (for-each (lambda (f)
1480 (invoke "guile" "-L" "." "-s" f))
1481 (find-files "tests")))))))
1482 (native-inputs (list guile-3.0))
1483 (home-page "https://github.com/spk121/potato-make")
1484 (synopsis "Library to write makefiles in Guile Scheme")
1485 (description
1486 "Potato Make is a Scheme library that aims to simplify the task of
1487maintaining, updating, and regenerating programs. It is inspired by
1488the POSIX make utility and allows writing a build script in Guile
1489Scheme.")
1490 (license license:expat))))
1491
1492(define-public waf
1493 (package
1494 (name "waf")
1495 (version "2.0.19") ;TODO: newer version brakes API
1496 (source
1497 (origin
1498 (method url-fetch)
1499 (uri (string-append "https://waf.io/" "waf-" version ".tar.bz2"))
1500 (sha256
1501 (base32 "19dvqbsvxz7ch03dh1v0znklrwxlz6yzddc3k9smzrrgny4jch6q"))))
1502 (build-system pyproject-build-system)
1503 (arguments
1504 (list
1505 #:test-backend #~'custom
1506 ;; TODO: Project provides integration tests, see
1507 ;; <.pipelines/Jenkinsfile> how to run them.
1508 #:test-flags #~(list "waf" "--version")
1509 #:phases
1510 #~(modify-phases %standard-phases
1511 (replace 'build
1512 (lambda _
1513 ;; XXX: Find a way to add all extra tools.
1514 (let ((tools '("gccdeps" "clang_compilation_database")))
1515 (invoke "python" "waf-light" "configure" "build"
1516 (string-append "--tools=" (string-join tools ","))))))
1517 (replace 'install
1518 (lambda _
1519 (install-file "waf" (string-append #$output "/bin"))))
1520 ;; waf breaks when it is wrapped.
1521 (delete 'wrap))))
1522 (home-page "https://waf.io/")
1523 (synopsis "Multi-level general purpose build system")
1524 (description
1525 "Waf is a build system framework for configuring, compiling and
1526installing applications.
1527
1528Features:
1529@itemize
1530@item Automatic build order: the build order is computed from input and output
1531files, among others
1532@item Automatic dependencies: tasks to execute are detected by hashing files
1533and commands
1534@item Performance: tasks are executed in parallel automatically, the startup
1535time is meant to be fast (separation between configuration and build)
1536@item Flexibility: new commands and tasks can be added very easily through
1537subclassing, bottlenecks for specific builds can be eliminated through dynamic
1538method replacement
1539@item Extensibility: though many programming languages and compilers are
1540already supported by default, many others are available as extensions
1541@item IDE support: Eclipse, Visual Studio and Xcode project generators
1542(waflib/extras/)
1543@item Documentation: the application is based on a robust model documented in
1544The Waf Book and in the API docs
1545@item Python compatibility: cPython 2.7 to 3.x, Jython 2.7 and PyPy
1546@end itemize")
1547 (license license:bsd-3)))
1548
1549(define-public haredo
1550 (package
1551 (name "haredo")
1552 (version "1.0.6")
1553 (source
1554 (origin
1555 (method git-fetch)
1556 (uri (git-reference
1557 (url "https://git.sr.ht/~autumnull/haredo/")
1558 (commit version)))
1559 (file-name (git-file-name name version))
1560 (sha256 (base32 "1ysm8rgxi0i4zb1q6xj3pf5bwxssjlcc4x158pyd78l8ahz30fn2"))))
1561 (build-system hare-build-system)
1562 (native-inputs
1563 ;; XXX: `harec` and `qbe` are pulled in because Haredo assumes these
1564 ;; programs are present and allows build scripts to rely on them freely.
1565 ;;
1566 ;; See: https://git.sr.ht/~autumnull/haredo/tree/1.0.6/item/doc/haredo.1.scd
1567 ;;
1568 ;; Importing `harec` the usual way results in a circular dependency for
1569 ;; packages that rely on `hare-build-system`. To avoid that, we import
1570 ;; it using delayed evaluation.
1571 (list scdoc
1572 (module-ref (resolve-interface '(gnu packages hare)) 'harec)
1573 qbe))
1574 (supported-systems %hare-supported-systems)
1575 (arguments
1576 (list
1577 #:tests? #f
1578 #:phases
1579 #~(modify-phases %standard-phases
1580 (add-before 'build 'set-prefix
1581 (lambda _ (setenv "PREFIX" #$output)))
1582 (add-before 'build 'override-defaults
1583 (lambda* (#:key inputs #:allow-other-keys)
1584 ;; XXX: To prevent future packagers from needing to do delayed
1585 ;; input evaluation in all subsequent packages that rely on
1586 ;; `haredo` and `hare-build-system`, this package provides the
1587 ;; Guix-packaged `harec` and `qbe` as defaults (which can be
1588 ;; overridden if needed by setting the appropriate environment
1589 ;; variable).
1590 (let ((harec-binary (search-input-file inputs "/bin/harec"))
1591 (qbe-binary (search-input-file inputs "/bin/qbe")))
1592 (substitute* "./src/haredo.ha"
1593 (("(\"HAREC\", \"harec\")")
1594 (format #f "(\"HAREC\", \"~a\")" harec-binary))
1595 (("(\"QBE\", \"qbe\")")
1596 (format #f "(\"QBE\", \"~a\")" qbe-binary))))))
1597 (replace 'build
1598 (lambda _ (invoke "./bootstrap.sh")))
1599 (replace 'install
1600 (lambda _ (invoke "./bootstrap.sh" "install"))))))
1601 (home-page "https://sr.ht/~autumnull/haredo/")
1602 (synopsis "Build automator, alternative to @command{make} and @command{redo}")
1603 (description "@command{haredo} is a build automator.
1604It is an alternative to e.g. @command{make(1)} and @command{redo(1)}. Features:
1605
1606@itemize
1607@item Script syntax is plain shell script,
1608@item Only one command with few extraneous rules,
1609@item .do files are short and modular like in redo,
1610@item Builds its dependency tree on the fly, uses no database,
1611@item Doesn't break the build state when interrupted.
1612@end itemize
1613")
1614 (license license:wtfpl2)))
1615
1616(define-public xmake
1617 (package
1618 (name "xmake")
1619 (version "3.0.8")
1620 (source (origin
1621 (method git-fetch)
1622 (uri (git-reference
1623 (url "https://github.com/xmake-io/xmake.git")
1624 (commit (string-append "v" version))
1625 ;; Requires some dependencies from "xmake-core-*" repos
1626 (recursive? #t)))
1627 (file-name (git-file-name name version))
1628 (sha256
1629 (base32 "1pdjz52w9lzfbcpx9wmzy0bsjg7i19xz43f63czk7jz9v0xba6gi"))))
1630 (build-system gnu-build-system)
1631 (arguments
1632 (list
1633 ;; No check rule in make
1634 ;; TODO: find how to run Lua tests in "test" directory
1635 #:tests? #f))
1636 (home-page "https://xmake.io/")
1637 (synopsis "Cross-platform build utility based on Lua")
1638 (description "@command{xmake} is a cross-platform build utility based on Lua.
1639Features:
1640@itemize
1641@item Built-in caching and parallel compilation,
1642@item Concise Lua syntax,
1643@item Custom rules, plugins and modules,
1644@item Support for C++20 modules and compile_commands.json,
1645@item Support for languages outside C/C++ (e.g. Go, Rust, Zig).
1646@end itemize")
1647 (license license:asl2.0)))
1648
1649(define-public ninja/pinned
1650 (hidden-package
1651 (package
1652 (name "ninja")
1653 (version "1.13.2")
1654 (source (origin
1655 (method git-fetch)
1656 (uri (git-reference
1657 (url "https://github.com/ninja-build/ninja")
1658 (commit (string-append "v" version))))
1659 (file-name (git-file-name name version))
1660 (sha256
1661 (base32
1662 "0lp9dmxbjyjwv089i8mgq3nvnhpbnsn01ifm05m9s47w7cifrl8g"))))
1663 (build-system gnu-build-system)
1664 (inputs (list python-wrapper re2c))
1665 (arguments
1666 '(; Tests now require googletest, which is a circular dependency.
1667 #:tests? #f
1668 #:phases
1669 (modify-phases %standard-phases
1670 (replace 'configure
1671 (lambda _
1672 (substitute* "src/subprocess-posix.cc"
1673 (("/bin/sh") (which "sh")))
1674 (substitute* "src/subprocess_test.cc"
1675 (("/bin/echo") (which "echo")))))
1676 (replace 'build
1677 (lambda _
1678 (invoke "./configure.py" "--bootstrap")))
1679 (replace 'check
1680 (lambda* (#:key tests? #:allow-other-keys)
1681 (when tests?
1682 (invoke "./configure.py")
1683 (invoke "./ninja" "ninja_test")
1684 (invoke "./ninja_test"))))
1685 (replace 'install
1686 (lambda* (#:key outputs #:allow-other-keys)
1687 (let* ((out (assoc-ref outputs "out"))
1688 (bin (string-append out "/bin"))
1689 (doc (string-append out "/share/doc/ninja")))
1690 (install-file "ninja" bin)
1691 (install-file "doc/manual.asciidoc" doc)))))))
1692 (home-page "https://ninja-build.org/")
1693 (synopsis "Small build system")
1694 (description
1695 "Ninja is a small build system with a focus on speed. It differs from
1696other build systems in two major respects: it is designed to have its input
1697files generated by a higher-level build system, and it is designed to run
1698builds as fast as possible.")
1699 (license license:asl2.0))))
1700
1701(define-public ninja
1702 (package/inherit ninja/pinned
1703 (properties (alist-delete 'hidden? (package-properties ninja/pinned)))))
1704
1705(define-public samurai
1706 (package
1707 (name "samurai")
1708 (version "1.3")
1709 (source (origin
1710 (method git-fetch)
1711 (uri (git-reference
1712 (url "https://github.com/michaelforney/samurai")
1713 (commit version)))
1714 (file-name (git-file-name name version))
1715 (sha256
1716 (base32
1717 "0bz75hclhwzyg3q6fwpdalg52rd8qmyyvfaqyv3zgm46hfx9n0nh"))))
1718 (build-system gnu-build-system)
1719 (arguments
1720 (list #:tests? #f ;no test suite
1721 #:make-flags #~(list (string-append "CC=" #$(cc-for-target))
1722 (string-append "PREFIX=" #$output))
1723 #:phases #~(modify-phases %standard-phases
1724 (add-after 'unpack 'patch-/bin/sh
1725 (lambda* (#:key inputs #:allow-other-keys)
1726 (substitute* "build.c"
1727 (("/bin/sh")
1728 (search-input-file inputs "bin/sh")))))
1729 (delete 'configure))))
1730 (inputs (list bash-minimal))
1731 (home-page "https://github.com/michaelforney/samurai")
1732 (synopsis "Ninja-compatible build tool written in C")
1733 (description "@code{samurai} is a ninja-compatible build tool written in
1734C99 with a focus on simplicity, speed, and portability. It is
1735feature-complete and supports most of the same options as ninja. This package
1736provides the command @command{samu}. For a @command{ninja} command
1737replacement, use the @code{samu-as-ninja-wrapper} package.")
1738 (license (list license:asl2.0 ;for the most part
1739 license:expat)))) ;htab.h, htab.c and tree.c
1740
1741(define-public samu-as-ninja-wrapper
1742 (package/inherit samurai
1743 (name "samu-as-ninja-wrapper")
1744 (build-system trivial-build-system)
1745 (arguments
1746 (list #:builder
1747 (with-imported-modules '((guix build utils))
1748 #~(begin
1749 (use-modules (guix build utils))
1750 (let ((bindir (string-append #$output "/bin"))
1751 (samu (string-append #$(this-package-input "samurai")
1752 "/bin/samu")))
1753 (mkdir-p bindir)
1754 (symlink samu (string-append bindir "/ninja")))))))
1755 (inputs (list samurai))
1756 (description "This package provides the @command{ninja} command,
1757implemented as a symbolic link to the @command{samu} command of @code{samurai}
1758package.")))
1759
1760(define-public uv
1761 (package
1762 (name "uv")
1763 (version "0.10.12")
1764 (source
1765 (origin
1766 (method git-fetch)
1767 (uri (git-reference
1768 (url "https://github.com/astral-sh/uv")
1769 (commit version)))
1770 (file-name (git-file-name name version))
1771 (sha256
1772 (base32 "04jk8d6wzxclx16mdg56afy2nqfv06j5kbxdch6977226gw80i0p"))
1773 (modules '((guix build utils)))
1774 (snippet
1775 #~(begin
1776 (for-each delete-file
1777 (cons "test/packages/fake-uv/scripts/uv.exe"
1778 (find-files "crates/uv-trampoline-builder/trampolines"
1779 "\\.exe$")))
1780 ;; Our version of maturin doesn't parse this correctly
1781 (substitute* "pyproject.toml"
1782 (("license-files.*") ""))))))
1783 (build-system pyproject-build-system)
1784 (arguments
1785 (list
1786 #:imported-modules
1787 (append %cargo-build-system-modules
1788 %pyproject-build-system-modules)
1789 #:modules
1790 '((srfi srfi-26)
1791 (ice-9 match)
1792 ((guix build cargo-build-system) #:prefix cargo:)
1793 (guix build pyproject-build-system)
1794 (guix build utils))
1795 #:tests? #f ; Tests require multiple python versions and network access.
1796 #:phases
1797 #~(modify-phases %standard-phases
1798 (add-after 'unpack 'prepare-cargo-build-system
1799 (lambda args
1800 (for-each
1801 (lambda (phase)
1802 (format #t "Running cargo phase: ~a~%" phase)
1803 (apply (assoc-ref cargo:%standard-phases phase)
1804 args))
1805 '(prepare-rust-crates
1806 unpack-rust-crates
1807 configure
1808 check-for-pregenerated-files
1809 patch-cargo-checksums))))
1810 (add-before 'build 'override-jemalloc
1811 (lambda* (#:key inputs #:allow-other-keys)
1812 (let ((jemalloc (assoc-ref inputs "jemalloc")))
1813 ;; This flag is needed when not using the bundled jemalloc.
1814 ;; https://github.com/tikv/jemallocator/issues/19
1815 (setenv "CARGO_FEATURE_UNPREFIXED_MALLOC_ON_SUPPORTED_PLATFORMS" "1")
1816 (setenv "JEMALLOC_OVERRIDE"
1817 (string-append jemalloc "/lib/libjemalloc.so")))))
1818 (replace 'install
1819 ;; We can't use the pyproject install phase because uv is a
1820 ;; binary, not a python script.
1821 (lambda* (#:key inputs outputs #:allow-other-keys)
1822 (let ((out (assoc-ref outputs "out"))
1823 (wheel (car (find-files "dist" "\\.whl$")))
1824 (site-dir (site-packages inputs outputs))
1825 (pyversion
1826 (string-append "python"
1827 (python-version
1828 (assoc-ref inputs "python")))))
1829 (invoke "python" "-m" "zipfile" "-e" wheel site-dir)
1830 (mkdir-p (string-append out "/bin"))
1831 (for-each delete-file
1832 (find-files (string-append out "/lib/" pyversion)
1833 "^uvx?$"))
1834 (for-each (cut install-file <> (string-append out "/bin"))
1835 (find-files "target" "^uvx?$")))))
1836 (replace 'check
1837 (lambda args
1838 (setenv "HOME" (getcwd))
1839 ;; NOTE: ‘#:tests?’ is honored here.
1840 (apply (assoc-ref cargo:%standard-phases 'check) args)))
1841 (add-after 'install 'install-extras
1842 (lambda* (#:key native-inputs #:allow-other-keys)
1843 (let ((uv (if #$(%current-target-system)
1844 (search-input-file native-inputs "/bin/uv")
1845 (string-append #$output "/bin/uv")))
1846 (uvx (if #$(%current-target-system)
1847 (search-input-file native-inputs "/bin/uvx")
1848 (string-append #$output "/bin/uvx"))))
1849 (for-each
1850 (match-lambda
1851 ((shell uv-name uvx-name completions-dir)
1852 (mkdir-p completions-dir)
1853 (with-output-to-file (in-vicinity completions-dir uv-name)
1854 (lambda _
1855 (invoke uv "generate-shell-completion" shell)))
1856 (with-output-to-file (in-vicinity completions-dir uvx-name)
1857 (lambda _
1858 (invoke uvx "--generate-shell-completion" shell)))))
1859 `(("bash" "uv" "uvx"
1860 ,(string-append #$output "/share/bash-completion/completions"))
1861 ("zsh" "_uv" "_uvx"
1862 ,(string-append #$output "/share/zsh/site-functions"))
1863 ("fish" "uv.fish" "uvx.fish"
1864 ,(string-append #$output "/share/fish/vendor_completions.d"))
1865 ("elvish" "uv" "uvx"
1866 ,(string-append #$output "/share/elvish/lib"))
1867 ("nushell" "uv" "uvx"
1868 ,(string-append #$output "/share/nushell/vendor/autoload"))))))))))
1869 (native-inputs
1870 (append
1871 (list maturin pkg-config rust `(,rust "cargo"))
1872 (if (%current-target-system)
1873 (list this-package
1874 (make-rust-sysroot (%current-target-system)))
1875 '())))
1876 (inputs (cons* jemalloc xz `(,zstd "lib") (cargo-inputs 'uv)))
1877 (home-page "https://docs.astral.sh/uv/")
1878 (synopsis "Python package and project manager written in Rust")
1879 (description
1880 "@command{uv} is a high-performance Python package and project manager
1881written in Rust, known for its execution speed and compatibility with existing
1882tools.")
1883 (license (list license:asl2.0 license:expat)))) ;dual-licensed
1884
1885(define-public python-uv-build
1886 (package
1887 (inherit uv)
1888 (name "python-uv-build")
1889 (version "0.11.25")
1890 (source
1891 (origin
1892 (method url-fetch)
1893 (uri (pypi-uri "uv_build" version))
1894 (sha256
1895 (base32 "15v20b8xdkd3jzr8jibvf73kah32wb4xpgiglr9q6jz0hyry6plb"))))
1896 (build-system pyproject-build-system)
1897 (arguments
1898 (list
1899 #:tests? #f ;no test suite
1900 #:phases
1901 #~(modify-phases %standard-phases
1902 (add-after 'unpack 'patch-uv-command
1903 (lambda* (#:key inputs #:allow-other-keys)
1904 ;; This package uses maturin to rebuild a more minimal variant
1905 ;; of 'uv'. Since we already build the whole uv as a separate
1906 ;; package, reuse it directly.
1907 (substitute* "python/uv_build/__init__.py"
1908 (("USE_UV_EXECUTABLE = False")
1909 "USE_UV_EXECUTABLE = True")
1910 (("uv_bin_name = \"uv\"")
1911 (format #f "uv_bin_name = ~s"
1912 (search-input-file inputs "bin/uv"))))))
1913 (delete 'build) ;avoid building uv again
1914 (replace 'install
1915 (lambda* (#:key inputs outputs #:allow-other-keys)
1916 (copy-recursively "python/uv_build"
1917 (string-append (site-packages inputs outputs)
1918 "/uv_build"))))
1919 (delete 'create-entrypoints)))) ;leaves empty bin directory
1920 (inputs (list uv))
1921 (synopsis "Python build backend using uv")
1922 (description "This package provides a Python build backend that uses the
1923@command{uv} command.")))