projects/guix·blob ruby-team · refs

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