projects/guix·blob java-team · refs

1901 lines · 80.0 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 "20260824")
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 "0wnbs8vhzci4iybnl504412bh3kykxdq050bpr0mgm9db4x2bikn"))
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 meson-documentation
586 (package
587 (inherit meson)
588 (version (package-version meson))
589 (name "meson-documentation")
590 (source (origin
591 ;; XXX: The documentation is not included in the release
592 ;; tarball; use git-fetch, preserving the version of our meson
593 ;; package to have the matching documentation.
594 (method git-fetch)
595 (uri (git-reference
596 (url "https://github.com/mesonbuild/meson")
597 (commit version)))
598 (file-name (git-file-name name version))
599 (sha256
600 (base32
601 "0f9pvc1p2z51qh4i6yd8cydbpcdkkblsv68zxdgcvk9j4akaaqb9"))))
602 (name "meson-documentation")
603 (build-system meson-build-system)
604 (arguments
605 ;; Disable the HTML documentation, which requires hotdoc, which itself
606 ;; has multiple Node.js dependencies, and is thus difficult to package in
607 ;; Guix.
608 (list #:configure-flags #~(list "-Dhtml=false")
609 #:phases #~(modify-phases %standard-phases
610 (add-after 'unpack 'chdir
611 (lambda _
612 (chdir "docs"))))))
613 (native-inputs (list python python-strictyaml))
614 (synopsis "Meson reference manual")
615 (description "This package provides the reference manual of
616Meson (@samp{meson-reference(3)}).")))
617
618(define-public muon
619 (package
620 (name "muon")
621 (version "0.6.0")
622 (source (origin
623 (method git-fetch)
624 (uri (git-reference
625 (url "https://github.com/muon-build/muon")
626 (commit version)))
627 (file-name (git-file-name name version))
628 (sha256
629 (base32
630 "1j5xw3i3z4v0hhlsxy1f8lqddlrr0i5h5yxz8mlxdfcn40d1sfn0"))))
631 (build-system meson-build-system)
632 (arguments
633 (list #:meson (computed-file "null-package" #~(mkdir #$output))
634 #:ninja samu-as-ninja-wrapper
635 #:configure-flags #~(list "-Dsamurai=disabled")
636 #:tests? #f ;to avoid extra dependencies
637 #:phases
638 #~(modify-phases %standard-phases
639 (add-after 'patch-source-shebangs 'build-muon-bootstrap
640 (lambda _
641 (setenv "CC" #$(cc-for-target))
642 (setenv "CFLAGS" "-DBOOTSTRAP_NO_SAMU")
643 (invoke "./bootstrap.sh" "build")))
644 (add-after 'build-muon-bootstrap 'setup-muon-bootstrap-as-meson
645 (lambda _
646 (mkdir "bin")
647 (symlink "../build/muon-bootstrap" "bin/meson")
648 (setenv "PATH" (string-append (getcwd) "/bin:"
649 (getenv "PATH"))))))))
650 (native-inputs (list samurai))
651 (inputs (list bash-minimal pkgconf))
652 (native-search-paths (list $PKG_CONFIG_PATH))
653 (home-page "https://muon.build/")
654 (synopsis "Meson build system alternative implementation in C99")
655 (description "Muon is an implementation of the meson build system in c99
656with minimal dependencies.")
657 (license license:gpl3))) ;for the combined work
658
659(define-public muon-as-meson-wrapper
660 (package/inherit muon
661 (name "muon-as-meson-wrapper")
662 (build-system trivial-build-system)
663 (arguments
664 (list #:builder
665 (with-imported-modules '((guix build utils))
666 #~(begin
667 (use-modules (guix build utils))
668 (let ((bindir (string-append #$output "/bin"))
669 (samu (string-append #$(this-package-input "muon")
670 "/bin/muon")))
671 (mkdir-p bindir)
672 (symlink samu (string-append bindir "/meson")))))))
673 (inputs (list muon))
674 (description "This package provides the @command{meson} command,
675implemented as a symbolic link to the @command{muon} command of @code{muon}
676package.")))
677
678(define-public premake4
679 (package
680 (name "premake")
681 (version "4.3")
682 (source (origin
683 (method url-fetch)
684 (uri (string-append "mirror://sourceforge/premake/Premake/"
685 version "/premake-" version "-src.zip"))
686 (sha256
687 (base32
688 "1017rd0wsjfyq2jvpjjhpszaa7kmig6q1nimw76qx3cjz2868lrn"))))
689 (build-system gnu-build-system)
690 (native-inputs
691 (list unzip)) ; for unpacking the source
692 (arguments
693 `(#:make-flags (list (string-append "CC=" ,(cc-for-target)))
694 #:tests? #f ; No test suite
695 #:phases
696 (modify-phases %standard-phases
697 (delete 'configure)
698 (add-after 'unpack 'enter-source
699 (lambda _ (chdir "build/gmake.unix") #t))
700 (replace 'install
701 (lambda* (#:key outputs #:allow-other-keys)
702 (install-file "../../bin/release/premake4"
703 (string-append (assoc-ref outputs "out") "/bin"))
704 #t)))))
705 (synopsis "Portable software build tool")
706 (description "@code{premake4} is a command line utility that reads a
707scripted definition of a software project and outputs @file{Makefile}s or
708other lower-level build files.")
709 (home-page "https://premake.github.io")
710 (license license:bsd-3)))
711
712(define-public premake5
713 (package
714 (inherit premake4)
715 (version "5.0.0-beta7")
716 (source (origin
717 (method url-fetch)
718 (uri (string-append "https://github.com/premake/premake-core/"
719 "releases/download/v" version
720 "/premake-" version "-src.zip"))
721 (sha256
722 (base32
723 "0q287af75d6w3c7dbfq7rmbh9isqzs9v30fjpm37lcafs2p7966k"))))
724 (arguments
725 (substitute-keyword-arguments arguments
726 ((#:phases phases)
727 `(modify-phases ,phases
728 (replace 'enter-source
729 ;; For some reason we end up in the .github subdir of the source,
730 ;; which is why we first go back a dir unlike in premake4.
731 (lambda _ (chdir "..") #t))
732 (add-after 'enter-source 'enter-build-dir
733 (lambda _ (chdir "build/gmake.unix") #t))
734 (add-after 'enter-source 'patch-builtin-uuidgen
735 ;; Use built-in UUID generation
736 (lambda _
737 (substitute* "src/host/os_uuid.c"
738 (("#elif PLATFORM_LINUX")
739 "#elif 0"))
740 (substitute* "build/gmake.unix/Premake5.make"
741 (("-luuid")
742 ""))
743 (substitute* "premake5.lua"
744 (("filter \"system:linux or macosx\"")
745 "filter \"system:macosx\""))))
746 (replace 'install
747 (lambda* (#:key outputs #:allow-other-keys)
748 (install-file "../../bin/release/premake5"
749 (string-append (assoc-ref outputs "out") "/bin"))
750 #t))))))
751 (description "@code{premake5} is a command line utility that reads a
752scripted definition of a software project and outputs @file{Makefile}s or
753other lower-level build files.")))
754
755(define-public scons
756 (package
757 (name "scons")
758 (version "4.9.1")
759 (source (origin
760 (method git-fetch)
761 (uri (git-reference
762 (url "https://github.com/SCons/scons")
763 (commit version)))
764 (file-name (git-file-name name version))
765 (patches (search-patches "scons-test-environment.patch"))
766 (sha256
767 (base32
768 "1h9653965bqf8zab4gbsilsmnhp6nxn5b5b9yvm6pf401qjx8n4x"))))
769 (build-system pyproject-build-system)
770 (arguments
771 (list
772 #:modules (append %pyproject-build-system-modules
773 '((ice-9 ftw) (srfi srfi-26)))
774 #:phases
775 #~(modify-phases (@ (guix build pyproject-build-system) %standard-phases)
776 (add-after 'unpack 'adjust-hard-coded-paths
777 (lambda _
778 (substitute* "SCons/Script/Main.py"
779 (("/usr/share/scons")
780 (string-append #$output "/share/scons")))))
781 (replace 'check
782 (lambda* (#:key tests? #:allow-other-keys)
783 (when tests?
784 ;; remove these tests as they require a read/write filesystem
785 (delete-file "SCons/Variables/PathVariableTests.py")
786 (invoke "python" "runtest.py" "--all" "--unit-only" ))))
787 (add-after 'install 'move-manuals
788 (lambda _
789 ;; XXX: For some reason manuals get installed to the top-level
790 ;; #$output directory.
791 (with-directory-excursion #$output
792 (let ((man1 (string-append #$output "/share/man/man1"))
793 (stray-manuals (scandir "."
794 (cut string-suffix? ".1" <>))))
795 (mkdir-p man1)
796 (for-each (lambda (manual)
797 (link manual (string-append man1 "/" manual))
798 (delete-file manual))
799 stray-manuals))))))))
800 (native-inputs
801 ;; TODO: Add 'fop' when available in Guix to generate manuals.
802 (list python-setuptools python-lxml python-wheel
803 ;;For tests.
804 python-psutil))
805 (home-page "https://scons.org/")
806 (synopsis "Software construction tool written in Python")
807 (description
808 "SCons is a software construction tool. Think of SCons as an improved,
809cross-platform substitute for the classic Make utility with integrated
810functionality similar to autoconf/automake and compiler caches such as ccache.
811In short, SCons is an easier, more reliable and faster way to build
812software.")
813 (license license:x11)))
814
815(define-public tup
816 (package
817 (name "tup")
818 (version "0.8")
819 (source (origin
820 (method url-fetch)
821 (uri (string-append "https://gittup.org/tup/releases/tup-v"
822 version ".tar.gz"))
823 (sha256
824 (base32
825 "1yv60apd8dsigb74cjw1nzvqqqpjbsxz1i9dhq24jdkjwgsra3w4"))
826 (modules '((guix build utils)))
827 (snippet
828 '(begin
829 ;; NOTE: Tup uses a slightly modified Lua, so it cannot be
830 ;; unbundled. See: src/lua/tup-lua.patch
831 (delete-file-recursively "src/pcre")
832 (delete-file-recursively "src/sqlite3")
833 (delete-file-recursively "src/inih")
834 ;; ldpreload Used only on BSD. Deleting to avoid putting
835 ;; license:bsd-2 in the licenses field
836 (delete-file-recursively "src/ldpreload")))))
837 (build-system gnu-build-system)
838 (arguments
839 (list
840 #:phases
841 #~(modify-phases %standard-phases
842 ;; There is a bootstrap script, but it doesn't do what you think - it
843 ;; builds tup.
844 (delete 'bootstrap)
845 (replace 'configure
846 (lambda* (#:key inputs #:allow-other-keys)
847 (substitute* "build.sh"
848 ;; LDFLAGS
849 (("-lm") "-lm -lsqlite3 -linih `pcre2-config --libs8`")
850 ;; CFLAGS
851 (("-DHAVE_CONFIG_H") "-DHAVE_CONFIG_H `pcre2-config --cflags`")
852 ;; Don't build bundled inih and pcre
853 (("\\.\\./src/inih/ini\\.c \\.\\./src/pcre/\\*\\.c") "")
854 ;; Don't build bundled sqlite3
855 (("\\$CC \\$CFLAGS -c \\.\\./src/sqlite3/sqlite3\\.c.*") ""))
856 (substitute* "src/tup/option.c"
857 (("\"ini.h\"") "<ini.h>"))
858 (substitute* '("src/tup/tupid.h"
859 "src/tup/db.c")
860 (("sqlite3/sqlite3.h")
861 (search-input-file inputs "include/sqlite3.h")))
862 (with-output-to-file "tup.config"
863 (lambda _
864 (format #t (string-append "CONFIG_TUP_USE_SYSTEM_SQLITE=y~%"
865 "CONFIG_TUP_USE_SYSTEM_PCRE=y~%"
866 "CONFIG_TUP_USE_SYSTEM_INIH=y~%"))))))
867 (delete 'check) ; Most tests require fuse to be setup
868 (replace 'build
869 (lambda _
870 ;; Based on bootstrap-nofuse.sh, but with a detour to patch-shebang.
871 (invoke "./build.sh")
872 (invoke "./build/tup" "init")
873 (invoke "./build/tup" "generate" "--verbose" "build-nofuse.sh")
874 (patch-shebang "build-nofuse.sh")
875 (invoke "./build-nofuse.sh")))
876 (replace 'install
877 (lambda* (#:key outputs #:allow-other-keys)
878 (let* ((outdir (assoc-ref outputs "out"))
879 (ftdetect (string-append outdir
880 "/share/vim/vimfiles/ftdetect")))
881 (install-file "tup" (string-append outdir "/bin"))
882 (install-file "tup.1" (string-append outdir "/share/man/man1"))
883 (install-file "contrib/syntax/tup.vim"
884 (string-append outdir "/share/vim/vimfiles/syntax"))
885 (mkdir-p ftdetect)
886 (with-output-to-file (string-append ftdetect "/tup.vim")
887 (lambda _
888 (display "au BufNewFile,BufRead Tupfile,*.tup setf tup")))))))))
889 (inputs
890 (list fuse libinih pcre2 sqlite))
891 (native-inputs
892 (list pkg-config))
893 (home-page "https://gittup.org/tup/")
894 (synopsis "Fast build system that's hard to get wrong")
895 (description "Tup is a generic build system based on a directed acyclic
896graphs of commands to be executed. Tup instruments your build to detect the
897exact dependencies of the commands, allowing you to take advantage of ideal
898parallelism during incremental builds, and detecting any situations where
899a build worked by accident.")
900 (license (list
901 license:gpl2
902 license:x11)))) ; src/lua
903
904(define-public osc
905 (package
906 (name "osc")
907 (version "1.19.0")
908 (source
909 (origin
910 (method git-fetch)
911 (uri (git-reference
912 (url "https://github.com/openSUSE/osc")
913 (commit version)))
914 (file-name (git-file-name name version))
915 (sha256
916 (base32 "09an4c5gjc99a6bfy4ax5yyng14v7b4fknkdzwl0hn89q5990xab"))))
917 (build-system pyproject-build-system)
918 (arguments
919 (list
920 #:tests? #f ; XXX: Fix tests.
921 #:phases
922 #~(modify-phases %standard-phases
923 (add-before 'check 'check-setup
924 (lambda* (#:key tests? #:allow-other-keys)
925 (when tests?
926 (setenv "HOME" (getcwd))))))))
927 (native-inputs
928 (list python-setuptools
929 python-wheel
930 diffstat))
931 (inputs
932 (list python-urllib3
933 python-ruamel.yaml
934 python-m2crypto
935 python-pycurl
936 rpm)) ; for python-rpm
937 (home-page "https://github.com/openSUSE/osc")
938 (synopsis "Open Build Service command line tool")
939 (description "@command{osc} is a command line interface to the Open Build
940Service. It allows you to checkout, commit, perform reviews etc. The vast
941majority of the OBS functionality is available via commands and the rest can
942be reached via direct API calls.")
943 (license license:gpl2+)))
944
945(define-public compdb
946 (package
947 (name "compdb")
948 (version "0.2.0")
949 (source
950 (origin
951 (method git-fetch)
952 (uri (git-reference
953 (url "https://github.com/Sarcasm/compdb")
954 (commit (string-append "v" version))))
955 (file-name (git-file-name name version))
956 (sha256
957 (base32 "0f4x0gm5n1mr87dx3gzn5da16a1qhd2y3kz22dl5xsd9pd720l4w"))))
958 (build-system pyproject-build-system)
959 (arguments
960 (list
961 #:test-backend ''unittest))
962 (native-inputs (list python-setuptools))
963 (propagated-inputs (list python-configparser))
964 (home-page "https://github.com/Sarcasm/compdb")
965 (synopsis "Compilation database Swiss army knife")
966 (description
967 "@command{compdb} is a command line tool to manipulate compilation
968databases. It eases the usage of tooling in a codebase by spoon-feeding the
969right compilation options.")
970 (license license:expat)))
971
972(define-public compiledb
973 (package
974 (name "compiledb")
975 (version "0.10.1")
976 (source
977 (origin
978 (method git-fetch)
979 (uri (git-reference
980 (url "https://github.com/nickdiego/compiledb")
981 (commit (string-append "v" version))))
982 (file-name (git-file-name name version))
983 (sha256
984 (base32 "0qricdgqzry7j3rmgwyd43av3c2kxpzkh6f9zcqbzrjkn78qbpd4"))))
985 (build-system pyproject-build-system)
986 (arguments
987 (list
988 #:phases
989 #~(modify-phases %standard-phases
990 (add-after 'unpack 'no-compat-shim-dependency
991 ;; shutilwhich is only needed for python 3.3 and earlier
992 (lambda* (#:key inputs #:allow-other-keys)
993 (substitute* "setup.py"
994 (("^ *'shutilwhich'\n")
995 ""))
996 (substitute* "compiledb/compiler.py"
997 (("shutilwhich")
998 "shutil"))
999 (substitute* "tests/data/multiple_commands_oneline.txt"
1000 (("/bin/echo")
1001 (search-input-file inputs "bin/echo"))))))))
1002 (propagated-inputs (list python-bashlex python-click))
1003 (native-inputs (list python-pytest python-setuptools python-wheel))
1004 (home-page "https://github.com/nickdiego/compiledb")
1005 (synopsis
1006 "Generate Clang JSON Compilation Database files for make-based build systems")
1007 (description
1008 "@code{compiledb} provides a @code{make} python wrapper script which,
1009besides executing the make build command, updates the JSON compilation
1010database file corresponding to that build, resulting in a command-line
1011interface similar to Bear.")
1012 (license license:gpl3)))
1013
1014(define-public build
1015 (package
1016 (name "build")
1017 (version "0.3.10")
1018 (source
1019 (origin
1020 (method url-fetch)
1021 (uri (string-append "https://www.codesynthesis.com/download/"
1022 "build/" (version-major+minor version)
1023 "/build-" version ".tar.bz2"))
1024 (sha256
1025 (base32 "1lx5rpnmsbip43zpp0a57sl5rm7pjb0y6i2si6rfglfp4p9d3z76"))))
1026 (build-system gnu-build-system)
1027 (arguments
1028 `(#:make-flags (list (string-append "install_prefix=" %output))
1029 #:tests? #f
1030 #:phases (modify-phases %standard-phases
1031 (delete 'build)
1032 (delete 'configure))))
1033 (home-page "https://www.codesynthesis.com/projects/build/")
1034 (synopsis "Massively-parallel build system implemented on top of GNU make")
1035 (description "Build is a massively-parallel software build system
1036implemented on top of GNU Make, designed with the following tasks in mind:
1037@itemize
1038@item configuration
1039@item building
1040@item testing
1041@item installation
1042@end itemize
1043Build has features such as:
1044@itemize
1045@item Position-independent makefiles.
1046@item Non-recursive multi-makefile include-based structure.
1047@item Leaf makefiles are full-fledged GNU makefiles, not just variable definitions.
1048@item Complete dependency graph.
1049@item Inter-project dependency tracking.
1050@item Extensible language/compiler framework.
1051@end itemize")
1052 (license license:gpl2+)))
1053
1054(define-public genie
1055 (let ((commit "22cc907a4351db46c55f73e6aa901f1b2f0c52ad")
1056 (revision "0"))
1057 (package
1058 (name "genie")
1059 (version (git-version "1170" revision commit))
1060 (source (origin
1061 (method git-fetch)
1062 (uri (git-reference
1063 (url "https://github.com/bkaradzic/genie")
1064 (commit commit)))
1065 (file-name (git-file-name name version))
1066 (sha256
1067 (base32
1068 "1wxhbdnr52qa2xr1i83577mwr25fxr5vby4r7m5brp9z5a08fwry"))))
1069 (build-system gnu-build-system)
1070 (arguments
1071 (list #:phases #~(modify-phases %standard-phases
1072 (delete 'configure)
1073 (replace 'install
1074 (lambda _
1075 (install-file "bin/linux/genie"
1076 (string-append #$output "/bin")))))
1077 #:tests? #f)) ;no tests
1078 (home-page "https://github.com/bkaradzic/genie")
1079 (synopsis "Project generator")
1080 (description
1081 "GENie generates projects from Lua scripts, making it easy to apply the
1082same settings to multiple projects. It supports generating projects using GNU
1083Makefiles, JSON Compilation Database, and experimentally Ninja.")
1084 (license license:bsd-3))))
1085
1086(define*-public (gnulib-checkout #:key
1087 version
1088 (revision "1")
1089 commit
1090 hash)
1091 "Return as a package the exact gnulib checkout."
1092 (package
1093 (name "gnulib")
1094 (version (git-version version revision commit))
1095 (source
1096 (origin
1097 (method git-fetch)
1098 (uri (git-reference
1099 (url "https://git.savannah.gnu.org/git/gnulib.git/")
1100 (commit commit)))
1101 (file-name (git-file-name name version))
1102 (sha256 hash)
1103 (snippet
1104 (with-imported-modules (source-module-closure '((guix build utils)))
1105 #~(begin
1106 (use-modules (guix build utils)
1107 (ice-9 ftw)
1108 (ice-9 rdelim))
1109 ;; .c, .h and .gperf files whose first line is /* DO NOT EDIT!
1110 ;; GENERATED AUTOMATICALLY! */ are generated automatically based
1111 ;; on the unicode database. Since we replace the unicode
1112 ;; database with our own, we need to regenerate them. So, they
1113 ;; are removed from the source. They are sprinkled all over the
1114 ;; place unfortunately, so we can’t exclude whole directories.
1115 (let ((generated-automatically?
1116 (lambda (filename . unused)
1117 (and (or (string-suffix? ".c" filename)
1118 (string-suffix? ".h" filename)
1119 (string-suffix? ".gperf" filename))
1120 (call-with-input-file filename
1121 (lambda (port)
1122 (let ((first-line (read-line port)))
1123 (equal?
1124 first-line
1125 "/* DO NOT EDIT! GENERATED AUTOMATICALLY! */"))))))))
1126 (for-each delete-file (find-files (getcwd) generated-automatically?)))
1127 ;; Other files are copied from UCD.
1128 (for-each delete-file
1129 '("tests/unigbrk/GraphemeBreakTest.txt"
1130 "tests/uninorm/NormalizationTest.txt"
1131 "tests/uniname/UnicodeData.txt"
1132 "tests/uniname/NameAliases.txt"
1133 ;; FIXME: tests/uniname/HangulSyllableNames.txt
1134 ;; seems like a UCD file but it is not distributed
1135 ;; with UCD.
1136 "tests/uniwbrk/WordBreakTest.txt")))))
1137 (patches (search-patches "gnulib-bootstrap.patch"))))
1138 (build-system copy-build-system)
1139 (arguments
1140 (list
1141 #:install-plan
1142 #~'(("./gnulib-tool" "bin/")
1143 ("./gnulib-tool.py" "bin/")
1144 ("./gnulib-tool.sh" "bin/")
1145 ("." "src/gnulib" #:exclude-regexp ("\\.git.*")))
1146 #:modules '((ice-9 match)
1147 (guix build utils)
1148 (guix build copy-build-system)
1149 ((guix build gnu-build-system) #:prefix gnu:))
1150 #:phases
1151 #~(modify-phases %standard-phases
1152 ;; Since this package is intended to be used in source form, it
1153 ;; should not retain references to tools (with the exception for the
1154 ;; commands we install, which should be wrapper for proper
1155 ;; execution).
1156 (delete 'patch-source-shebangs)
1157 (delete 'patch-generated-file-shebangs)
1158 (delete 'patch-usr-bin-file)
1159 (add-before 'install 'check
1160 (assoc-ref gnu:%standard-phases 'check))
1161 (add-before 'check 'fix-tests
1162 (lambda _
1163 (substitute* "Makefile"
1164 (("-f maint.mk syntax-check")
1165 "_gl-Makefile=yes -f maint.mk syntax-check"))
1166 (invoke "git" "init")
1167 (invoke "git" "config" "user.name" "Guix")
1168 (invoke "git" "config" "user.email" "guix@localhost")
1169 (invoke "git" "add" ".")
1170 ;; Syntax checks are only run against committed files.
1171 (invoke "git" "commit" "-m" "Prepare for tests.")))
1172 (add-before 'check 'disable-failing-tests
1173 (lambda _
1174 (substitute* "cfg.mk"
1175 (("local-checks-to-skip =")
1176 ;; sc_copyright_check fails because the fake commit date may
1177 ;; be later than the copyright year.
1178 "local-checks-to-skip = \\
1179 sc_Wundef_boolean \\
1180 sc_copyright_check \\
1181 sc_file_system \\
1182 sc_error_message_warn_fatal \\
1183 sc_indent \\
1184 sc_keep_gnulib_texi_files_mostly_ascii \\
1185 sc_prefer_angle_bracket_headers \\
1186 sc_prohibit_assert_without_use \\
1187 sc_prohibit_close_stream_without_use \\
1188 sc_prohibit_defined_have_decl_tests \\
1189 sc_prohibit_doubled_word \\
1190 sc_prohibit_empty_lines_at_EOF \\
1191 sc_prohibit_intprops_without_use \\
1192 sc_prohibit_openat_without_use \\
1193 sc_prohibit_test_minus_ao \\
1194 sc_readme_link_copying \\
1195 sc_readme_link_install \\
1196 sc_unportable_grep_q \\
1197 sc_unsigned_char \\
1198 sc_unsigned_int \\
1199 sc_unsigned_long \\
1200 sc_unsigned_short"))
1201 (substitute* "Makefile"
1202 (("sc_check_(sym_list|copyright|config_h_reminder)" rule)
1203 (string-append "disabled_check_" rule))
1204 (("sc_cpp_indent_check")
1205 "disabled_cpp_indent_check")
1206 (("sc_prefer_ac_check_funcs_once")
1207 "disabled_prefer_ac_check_funcs_once")
1208 (("sc_prohibit_(AC_LIBOBJ_in_m4|leading_TABs\
1209|sc_omitted_at)" rule)
1210 (string-append "disabled_prohibit_" rule)))))
1211 (add-before 'check 'regenerate-unicode
1212 (lambda* (#:key inputs #:allow-other-keys)
1213 (define (find-ucd-file name)
1214 (search-input-file inputs (string-append "share/ucd/" name)))
1215 (define (find-ucd-files . names)
1216 (map find-ucd-file names))
1217 (with-directory-excursion "lib"
1218 ;; See the compile-command buffer-local variable in
1219 ;; lib/gen-uni-tables.c
1220 (invoke "gcc" "-O" "-Wall" "gen-uni-tables.c"
1221 "-Iunictype" "-o" "gen-uni-tables")
1222 (apply invoke
1223 "./gen-uni-tables"
1224 (append
1225 (find-ucd-files "UnicodeData.txt"
1226 "PropList.txt"
1227 "DerivedCoreProperties.txt"
1228 "emoji/emoji-data.txt"
1229 "ArabicShaping.txt"
1230 "Scripts.txt"
1231 "Blocks.txt")
1232 (list
1233 #$(this-package-native-input "PropList.txt"))
1234 (find-ucd-files "BidiMirroring.txt"
1235 "EastAsianWidth.txt"
1236 "LineBreak.txt"
1237 "auxiliary/WordBreakProperty.txt"
1238 "auxiliary/GraphemeBreakProperty.txt"
1239 "CompositionExclusions.txt"
1240 "SpecialCasing.txt"
1241 "CaseFolding.txt")
1242 (list #$(package-version (this-package-native-input "ucd")))))
1243 (invoke "clisp" "-C" "uniname/gen-uninames.lisp"
1244 (find-ucd-file "UnicodeData.txt") ;input file
1245 (find-ucd-file "NameAliases.txt") ;alias file
1246 "uniname/uninames.h") ;output file
1247 (for-each
1248 (match-lambda
1249 ((ucd-file . directory)
1250 (copy-file (find-ucd-file ucd-file)
1251 (string-append "../tests/" directory "/"
1252 (basename ucd-file)))))
1253 '(("NameAliases.txt" . "uniname")
1254 ("UnicodeData.txt" . "uniname")
1255 ("NormalizationTest.txt" . "uninorm")
1256 ("auxiliary/GraphemeBreakTest.txt" . "unigbrk")
1257 ("auxiliary/WordBreakTest.txt" . "uniwbrk")))
1258 (delete-file "gen-uni-tables")))))))
1259 (inputs
1260 (list bash-minimal)) ;shebang for gnulib-tool
1261 (native-inputs
1262 (list
1263 bash-minimal python perl clisp
1264 ;; Unicode data:
1265 ucd
1266 (origin
1267 (method url-fetch)
1268 (uri (string-append
1269 "https://www.unicode.org/Public/"
1270 "3.0-Update1/PropList-3.0.1.txt"))
1271 (file-name "PropList.txt")
1272 (sha256
1273 (base32
1274 "0k6wyijyzdl5g3nibcwfm898kfydx1pqaz28v7fdvnzdvd5fz7lh")))
1275 ;; Programs for the tests:
1276 cppi indent git-minimal/pinned autoconf))
1277 (home-page "https://www.gnu.org/software/gnulib/")
1278 (synopsis "Source files to share among distributions")
1279 (description
1280 "Gnulib is a central location for common infrastructure needed by GNU
1281packages. It provides a wide variety of functionality, e.g., portability
1282across many systems, working with Unicode strings, cryptographic computation,
1283and much more. The code is intended to be shared at the level of source
1284files, rather than being a standalone library that is distributed, built, and
1285installed. The included @command{gnulib-tool} script helps with using Gnulib
1286code in other packages. Gnulib also includes copies of licensing and
1287maintenance-related files, for convenience.")
1288 (native-search-paths
1289 (list (search-path-specification
1290 (variable "GNULIB_SRCDIR")
1291 (files (list "src/gnulib"))
1292 (separator #f))))
1293 (license (list license:lgpl2.0+ license:gpl3+))))
1294
1295(define-public gnulib
1296 (gnulib-checkout
1297 #:version "2025-06-30" ;date from last commit on stable-202507 branch
1298 #:commit "9297749090b01720888dceeb5f6dab3d52dcef40"
1299 #:hash (base32 "10qyhji7q71fhq2956aszj6bipbf11hn0xcrrpkwj9azwindw7ch")))
1300
1301(define-public maak
1302 (package
1303 (name "maak")
1304 (version "0.8.3")
1305 (source
1306 (origin
1307 (method git-fetch)
1308 (uri (git-reference
1309 (url "https://codeberg.org/jjba23/maak.git")
1310 (commit (string-append "v" version))))
1311 (file-name (git-file-name name version))
1312 (sha256
1313 (base32 "0rlb643hqysyfpdgg91n0h6p1m78l9pmbf17xh4fqqzvsgng0dms"))))
1314 (build-system guile-build-system)
1315 (arguments
1316 (list
1317 #:source-directory "src"
1318 #:modules '((guix build guile-build-system)
1319 (guix build utils)
1320 (ice-9 match))
1321 #:phases
1322 #~(modify-phases %standard-phases
1323 (add-before 'build 'install-program-files
1324 (lambda _
1325 (let ((bin (string-append #$output "/bin"))
1326 (share (string-append #$output "/share")))
1327 (install-file "resources/help.txt"
1328 (string-append share "/resources"))
1329 (install-file "scripts/maak" bin)
1330 (chmod (string-append bin "/maak") #o755))))
1331 (add-after 'unpack 'fix-paths
1332 (lambda* (#:key inputs #:allow-other-keys)
1333 (for-each (match-lambda
1334 ((pattern program format-string)
1335 (substitute* "scripts/maak"
1336 ((pattern)
1337 (format #f format-string
1338 (search-input-file inputs
1339 (string-append "bin/"
1340 program)))))))
1341 '(("readlink -f " "readlink" "~s -f ")
1342 ("realpath " "realpath" "~s ")
1343 ("dirname " "dirname" "~s ")
1344 ("getopt " "getopt" "~s ")
1345 ("exec guile " "guile" "exec ~s ")))))
1346 (add-after 'build 'install-completions
1347 (lambda _
1348 (for-each (match-lambda
1349 ((src-file dest-dir dest-name)
1350 (let ((target-dir (string-append #$output dest-dir)))
1351 (mkdir-p target-dir)
1352 (copy-file src-file
1353 (string-append target-dir "/"
1354 dest-name)))))
1355 '(("scripts/maak-completion.bash"
1356 "/share/bash-completion/completions" "maak")
1357 ("scripts/maak-completion.fish"
1358 "/share/fish/vendor_completions.d" "maak.fish")
1359 ("scripts/maak-completion.zsh"
1360 "/share/zsh/site-functions" "_maak"))))))))
1361 (inputs (list guile-3.0 bash-minimal coreutils util-linux))
1362 (home-page "https://codeberg.org/jjba23/maak")
1363 (synopsis "Command runner à la Make using Guile Scheme")
1364 (description
1365 "Maak is a command runner and control plane for your
1366projects. It allows you to use the power of Lisp (Guile Scheme) to define
1367your tasks, build steps, repetitive tasks or other automation.
1368
1369With Maak you can easily call external shell commands and integrate with
1370your existing scripts and tools. It is inspired by the GNU Make utility
1371but it does away with a lot of the complexity that comes with its history.")
1372 (license license:gpl3+)))
1373
1374(define-public pdpmake
1375 (package
1376 (name "pdpmake")
1377 (version "2.0.4")
1378 (source
1379 (origin
1380 (method git-fetch)
1381 (uri (git-reference
1382 (url "git://git.frippery.org/pdpmake")
1383 (commit version)))
1384 (file-name (git-file-name name version))
1385 (sha256
1386 (base32
1387 "13qfvn0kw1fkpmjdpk0cscmvj5iycdq68kqfiml1slf1936pllb9"))))
1388 (build-system gnu-build-system)
1389 (arguments
1390 (list
1391 #:phases
1392 #~(modify-phases %standard-phases
1393 (delete 'configure)
1394 ;; pdpmake can be built easily without relying on a previous Make
1395 ;; implementation; let's do this for the sake of bootstrappability.
1396 (replace 'build
1397 (lambda _
1398 (let ((args (append (find-files "." "\\.c$")
1399 (list "-o" "make"))))
1400 (apply invoke #$(cc-for-target) args))))
1401 (replace 'check
1402 (lambda* (#:key tests? #:allow-other-keys)
1403 (when tests?
1404 (with-directory-excursion "testsuite"
1405 (invoke "./runtest" "-v")))))
1406 (replace 'install
1407 (lambda _
1408 (let ((bindir (string-append #$output "/bin"))
1409 (mandir (string-append #$output "/share/man/man1")))
1410 (mkdir-p bindir)
1411 (mkdir-p mandir)
1412 (install-file "make" bindir)
1413 (install-file "pdpmake.1" mandir)))))))
1414 (home-page "https://frippery.org/make/")
1415 (synopsis "Public domain POSIX make")
1416 (description
1417 "This package contains an implementation of POSIX make. The default
1418configuration enables extensions. Generally these extensions are compatible
1419with GNU make.")
1420 ;; pdpmake is distributed under the public domain, but the sources include
1421 ;; tests under the GPL license version 2.
1422 (license
1423 (list license:gpl2
1424 license:public-domain))))
1425
1426(define-public potato-make
1427 ;; No releases.
1428 (let ((commit "e8c09ce1f6a33c013b27961b0a07f991db33e6fb")
1429 (revision "0"))
1430 (package
1431 (name "potato-make")
1432 (version (git-version "0" revision commit))
1433 (source
1434 (origin
1435 (method git-fetch)
1436 (uri (git-reference
1437 (url "https://github.com/spk121/potato-make")
1438 (commit commit)))
1439 (file-name (git-file-name name version))
1440 (sha256
1441 (base32 "0axgrkqdfip5f2bp7d2dprd74g58lyc0c7lgg2m93k5jqn1lpbmj"))
1442 ;; Delete files of the seemingly unfinished pmake program.
1443 (snippet '(begin
1444 (delete-file "pmake")
1445 (delete-file "documents/pmake.org")
1446 (delete-file "make/main.scm")
1447 (rmdir "documents")
1448 (rmdir "make")))))
1449 (build-system guile-build-system)
1450 (arguments
1451 (list
1452 #:phases #~(modify-phases %standard-phases
1453 (add-after 'build 'check
1454 (lambda _
1455 ;; Delete test referencing nonexistent file.
1456 (delete-file "tests/parse.sh")
1457 (for-each (lambda (f)
1458 (invoke "guile" "-L" "." "-s" f))
1459 (find-files "tests")))))))
1460 (native-inputs (list guile-3.0))
1461 (home-page "https://github.com/spk121/potato-make")
1462 (synopsis "Library to write makefiles in Guile Scheme")
1463 (description
1464 "Potato Make is a Scheme library that aims to simplify the task of
1465maintaining, updating, and regenerating programs. It is inspired by
1466the POSIX make utility and allows writing a build script in Guile
1467Scheme.")
1468 (license license:expat))))
1469
1470(define-public waf
1471 (package
1472 (name "waf")
1473 (version "2.0.19") ;TODO: newer version brakes API
1474 (source
1475 (origin
1476 (method url-fetch)
1477 (uri (string-append "https://waf.io/" "waf-" version ".tar.bz2"))
1478 (sha256
1479 (base32 "19dvqbsvxz7ch03dh1v0znklrwxlz6yzddc3k9smzrrgny4jch6q"))))
1480 (build-system pyproject-build-system)
1481 (arguments
1482 (list
1483 #:test-backend #~'custom
1484 ;; TODO: Project provides integration tests, see
1485 ;; <.pipelines/Jenkinsfile> how to run them.
1486 #:test-flags #~(list "waf" "--version")
1487 #:phases
1488 #~(modify-phases %standard-phases
1489 (replace 'build
1490 (lambda _
1491 ;; XXX: Find a way to add all extra tools.
1492 (let ((tools '("gccdeps" "clang_compilation_database")))
1493 (invoke "python" "waf-light" "configure" "build"
1494 (string-append "--tools=" (string-join tools ","))))))
1495 (replace 'install
1496 (lambda _
1497 (install-file "waf" (string-append #$output "/bin"))))
1498 ;; waf breaks when it is wrapped.
1499 (delete 'wrap))))
1500 (home-page "https://waf.io/")
1501 (synopsis "Multi-level general purpose build system")
1502 (description
1503 "Waf is a build system framework for configuring, compiling and
1504installing applications.
1505
1506Features:
1507@itemize
1508@item Automatic build order: the build order is computed from input and output
1509files, among others
1510@item Automatic dependencies: tasks to execute are detected by hashing files
1511and commands
1512@item Performance: tasks are executed in parallel automatically, the startup
1513time is meant to be fast (separation between configuration and build)
1514@item Flexibility: new commands and tasks can be added very easily through
1515subclassing, bottlenecks for specific builds can be eliminated through dynamic
1516method replacement
1517@item Extensibility: though many programming languages and compilers are
1518already supported by default, many others are available as extensions
1519@item IDE support: Eclipse, Visual Studio and Xcode project generators
1520(waflib/extras/)
1521@item Documentation: the application is based on a robust model documented in
1522The Waf Book and in the API docs
1523@item Python compatibility: cPython 2.7 to 3.x, Jython 2.7 and PyPy
1524@end itemize")
1525 (license license:bsd-3)))
1526
1527(define-public haredo
1528 (package
1529 (name "haredo")
1530 (version "1.0.6")
1531 (source
1532 (origin
1533 (method git-fetch)
1534 (uri (git-reference
1535 (url "https://git.sr.ht/~autumnull/haredo/")
1536 (commit version)))
1537 (file-name (git-file-name name version))
1538 (sha256 (base32 "1ysm8rgxi0i4zb1q6xj3pf5bwxssjlcc4x158pyd78l8ahz30fn2"))))
1539 (build-system hare-build-system)
1540 (native-inputs
1541 ;; XXX: `harec` and `qbe` are pulled in because Haredo assumes these
1542 ;; programs are present and allows build scripts to rely on them freely.
1543 ;;
1544 ;; See: https://git.sr.ht/~autumnull/haredo/tree/1.0.6/item/doc/haredo.1.scd
1545 ;;
1546 ;; Importing `harec` the usual way results in a circular dependency for
1547 ;; packages that rely on `hare-build-system`. To avoid that, we import
1548 ;; it using delayed evaluation.
1549 (list scdoc
1550 (module-ref (resolve-interface '(gnu packages hare)) 'harec)
1551 qbe))
1552 (supported-systems %hare-supported-systems)
1553 (arguments
1554 (list
1555 #:tests? #f
1556 #:phases
1557 #~(modify-phases %standard-phases
1558 (add-before 'build 'set-prefix
1559 (lambda _ (setenv "PREFIX" #$output)))
1560 (add-before 'build 'override-defaults
1561 (lambda* (#:key inputs #:allow-other-keys)
1562 ;; XXX: To prevent future packagers from needing to do delayed
1563 ;; input evaluation in all subsequent packages that rely on
1564 ;; `haredo` and `hare-build-system`, this package provides the
1565 ;; Guix-packaged `harec` and `qbe` as defaults (which can be
1566 ;; overridden if needed by setting the appropriate environment
1567 ;; variable).
1568 (let ((harec-binary (search-input-file inputs "/bin/harec"))
1569 (qbe-binary (search-input-file inputs "/bin/qbe")))
1570 (substitute* "./src/haredo.ha"
1571 (("(\"HAREC\", \"harec\")")
1572 (format #f "(\"HAREC\", \"~a\")" harec-binary))
1573 (("(\"QBE\", \"qbe\")")
1574 (format #f "(\"QBE\", \"~a\")" qbe-binary))))))
1575 (replace 'build
1576 (lambda _ (invoke "./bootstrap.sh")))
1577 (replace 'install
1578 (lambda _ (invoke "./bootstrap.sh" "install"))))))
1579 (home-page "https://sr.ht/~autumnull/haredo/")
1580 (synopsis "Build automator, alternative to @command{make} and @command{redo}")
1581 (description "@command{haredo} is a build automator.
1582It is an alternative to e.g. @command{make(1)} and @command{redo(1)}. Features:
1583
1584@itemize
1585@item Script syntax is plain shell script,
1586@item Only one command with few extraneous rules,
1587@item .do files are short and modular like in redo,
1588@item Builds its dependency tree on the fly, uses no database,
1589@item Doesn't break the build state when interrupted.
1590@end itemize
1591")
1592 (license license:wtfpl2)))
1593
1594(define-public xmake
1595 (package
1596 (name "xmake")
1597 (version "3.0.8")
1598 (source (origin
1599 (method git-fetch)
1600 (uri (git-reference
1601 (url "https://github.com/xmake-io/xmake.git")
1602 (commit (string-append "v" version))
1603 ;; Requires some dependencies from "xmake-core-*" repos
1604 (recursive? #t)))
1605 (file-name (git-file-name name version))
1606 (sha256
1607 (base32 "1pdjz52w9lzfbcpx9wmzy0bsjg7i19xz43f63czk7jz9v0xba6gi"))))
1608 (build-system gnu-build-system)
1609 (arguments
1610 (list
1611 ;; No check rule in make
1612 ;; TODO: find how to run Lua tests in "test" directory
1613 #:tests? #f))
1614 (home-page "https://xmake.io/")
1615 (synopsis "Cross-platform build utility based on Lua")
1616 (description "@command{xmake} is a cross-platform build utility based on Lua.
1617Features:
1618@itemize
1619@item Built-in caching and parallel compilation,
1620@item Concise Lua syntax,
1621@item Custom rules, plugins and modules,
1622@item Support for C++20 modules and compile_commands.json,
1623@item Support for languages outside C/C++ (e.g. Go, Rust, Zig).
1624@end itemize")
1625 (license license:asl2.0)))
1626
1627(define-public ninja/pinned
1628 (hidden-package
1629 (package
1630 (name "ninja")
1631 (version "1.13.2")
1632 (source (origin
1633 (method git-fetch)
1634 (uri (git-reference
1635 (url "https://github.com/ninja-build/ninja")
1636 (commit (string-append "v" version))))
1637 (file-name (git-file-name name version))
1638 (sha256
1639 (base32
1640 "0lp9dmxbjyjwv089i8mgq3nvnhpbnsn01ifm05m9s47w7cifrl8g"))))
1641 (build-system gnu-build-system)
1642 (inputs (list python-wrapper re2c))
1643 (arguments
1644 '(; Tests now require googletest, which is a circular dependency.
1645 #:tests? #f
1646 #:phases
1647 (modify-phases %standard-phases
1648 (replace 'configure
1649 (lambda _
1650 (substitute* "src/subprocess-posix.cc"
1651 (("/bin/sh") (which "sh")))
1652 (substitute* "src/subprocess_test.cc"
1653 (("/bin/echo") (which "echo")))))
1654 (replace 'build
1655 (lambda _
1656 (invoke "./configure.py" "--bootstrap")))
1657 (replace 'check
1658 (lambda* (#:key tests? #:allow-other-keys)
1659 (when tests?
1660 (invoke "./configure.py")
1661 (invoke "./ninja" "ninja_test")
1662 (invoke "./ninja_test"))))
1663 (replace 'install
1664 (lambda* (#:key outputs #:allow-other-keys)
1665 (let* ((out (assoc-ref outputs "out"))
1666 (bin (string-append out "/bin"))
1667 (doc (string-append out "/share/doc/ninja")))
1668 (install-file "ninja" bin)
1669 (install-file "doc/manual.asciidoc" doc)))))))
1670 (home-page "https://ninja-build.org/")
1671 (synopsis "Small build system")
1672 (description
1673 "Ninja is a small build system with a focus on speed. It differs from
1674other build systems in two major respects: it is designed to have its input
1675files generated by a higher-level build system, and it is designed to run
1676builds as fast as possible.")
1677 (license license:asl2.0))))
1678
1679(define-public ninja
1680 (package/inherit ninja/pinned
1681 (properties (alist-delete 'hidden? (package-properties ninja/pinned)))))
1682
1683(define-public samurai
1684 (package
1685 (name "samurai")
1686 (version "1.3")
1687 (source (origin
1688 (method git-fetch)
1689 (uri (git-reference
1690 (url "https://github.com/michaelforney/samurai")
1691 (commit version)))
1692 (file-name (git-file-name name version))
1693 (sha256
1694 (base32
1695 "0bz75hclhwzyg3q6fwpdalg52rd8qmyyvfaqyv3zgm46hfx9n0nh"))))
1696 (build-system gnu-build-system)
1697 (arguments
1698 (list #:tests? #f ;no test suite
1699 #:make-flags #~(list (string-append "CC=" #$(cc-for-target))
1700 (string-append "PREFIX=" #$output))
1701 #:phases #~(modify-phases %standard-phases
1702 (add-after 'unpack 'patch-/bin/sh
1703 (lambda* (#:key inputs #:allow-other-keys)
1704 (substitute* "build.c"
1705 (("/bin/sh")
1706 (search-input-file inputs "bin/sh")))))
1707 (delete 'configure))))
1708 (inputs (list bash-minimal))
1709 (home-page "https://github.com/michaelforney/samurai")
1710 (synopsis "Ninja-compatible build tool written in C")
1711 (description "@code{samurai} is a ninja-compatible build tool written in
1712C99 with a focus on simplicity, speed, and portability. It is
1713feature-complete and supports most of the same options as ninja. This package
1714provides the command @command{samu}. For a @command{ninja} command
1715replacement, use the @code{samu-as-ninja-wrapper} package.")
1716 (license (list license:asl2.0 ;for the most part
1717 license:expat)))) ;htab.h, htab.c and tree.c
1718
1719(define-public samu-as-ninja-wrapper
1720 (package/inherit samurai
1721 (name "samu-as-ninja-wrapper")
1722 (build-system trivial-build-system)
1723 (arguments
1724 (list #:builder
1725 (with-imported-modules '((guix build utils))
1726 #~(begin
1727 (use-modules (guix build utils))
1728 (let ((bindir (string-append #$output "/bin"))
1729 (samu (string-append #$(this-package-input "samurai")
1730 "/bin/samu")))
1731 (mkdir-p bindir)
1732 (symlink samu (string-append bindir "/ninja")))))))
1733 (inputs (list samurai))
1734 (description "This package provides the @command{ninja} command,
1735implemented as a symbolic link to the @command{samu} command of @code{samurai}
1736package.")))
1737
1738(define-public uv
1739 (package
1740 (name "uv")
1741 (version "0.10.12")
1742 (source
1743 (origin
1744 (method git-fetch)
1745 (uri (git-reference
1746 (url "https://github.com/astral-sh/uv")
1747 (commit version)))
1748 (file-name (git-file-name name version))
1749 (sha256
1750 (base32 "04jk8d6wzxclx16mdg56afy2nqfv06j5kbxdch6977226gw80i0p"))
1751 (modules '((guix build utils)))
1752 (snippet
1753 #~(begin
1754 (for-each delete-file
1755 (cons "test/packages/fake-uv/scripts/uv.exe"
1756 (find-files "crates/uv-trampoline-builder/trampolines"
1757 "\\.exe$")))
1758 ;; Our version of maturin doesn't parse this correctly
1759 (substitute* "pyproject.toml"
1760 (("license-files.*") ""))))))
1761 (build-system pyproject-build-system)
1762 (arguments
1763 (list
1764 #:imported-modules
1765 (append %cargo-build-system-modules
1766 %pyproject-build-system-modules)
1767 #:modules
1768 '((srfi srfi-26)
1769 (ice-9 match)
1770 ((guix build cargo-build-system) #:prefix cargo:)
1771 (guix build pyproject-build-system)
1772 (guix build utils))
1773 #:tests? #f ; Tests require multiple python versions and network access.
1774 #:phases
1775 #~(modify-phases %standard-phases
1776 (add-after 'unpack 'prepare-cargo-build-system
1777 (lambda args
1778 (for-each
1779 (lambda (phase)
1780 (format #t "Running cargo phase: ~a~%" phase)
1781 (apply (assoc-ref cargo:%standard-phases phase)
1782 args))
1783 '(prepare-rust-crates
1784 unpack-rust-crates
1785 configure
1786 check-for-pregenerated-files
1787 patch-cargo-checksums))))
1788 (add-before 'build 'override-jemalloc
1789 (lambda* (#:key inputs #:allow-other-keys)
1790 (let ((jemalloc (assoc-ref inputs "jemalloc")))
1791 ;; This flag is needed when not using the bundled jemalloc.
1792 ;; https://github.com/tikv/jemallocator/issues/19
1793 (setenv "CARGO_FEATURE_UNPREFIXED_MALLOC_ON_SUPPORTED_PLATFORMS" "1")
1794 (setenv "JEMALLOC_OVERRIDE"
1795 (string-append jemalloc "/lib/libjemalloc.so")))))
1796 (replace 'install
1797 ;; We can't use the pyproject install phase because uv is a
1798 ;; binary, not a python script.
1799 (lambda* (#:key inputs outputs #:allow-other-keys)
1800 (let ((out (assoc-ref outputs "out"))
1801 (wheel (car (find-files "dist" "\\.whl$")))
1802 (site-dir (site-packages inputs outputs))
1803 (pyversion
1804 (string-append "python"
1805 (python-version
1806 (assoc-ref inputs "python")))))
1807 (invoke "python" "-m" "zipfile" "-e" wheel site-dir)
1808 (mkdir-p (string-append out "/bin"))
1809 (for-each delete-file
1810 (find-files (string-append out "/lib/" pyversion)
1811 "^uvx?$"))
1812 (for-each (cut install-file <> (string-append out "/bin"))
1813 (find-files "target" "^uvx?$")))))
1814 (replace 'check
1815 (lambda args
1816 (setenv "HOME" (getcwd))
1817 ;; NOTE: ‘#:tests?’ is honored here.
1818 (apply (assoc-ref cargo:%standard-phases 'check) args)))
1819 (add-after 'install 'install-extras
1820 (lambda* (#:key native-inputs #:allow-other-keys)
1821 (let ((uv (if #$(%current-target-system)
1822 (search-input-file native-inputs "/bin/uv")
1823 (string-append #$output "/bin/uv")))
1824 (uvx (if #$(%current-target-system)
1825 (search-input-file native-inputs "/bin/uvx")
1826 (string-append #$output "/bin/uvx"))))
1827 (for-each
1828 (match-lambda
1829 ((shell uv-name uvx-name completions-dir)
1830 (mkdir-p completions-dir)
1831 (with-output-to-file (in-vicinity completions-dir uv-name)
1832 (lambda _
1833 (invoke uv "generate-shell-completion" shell)))
1834 (with-output-to-file (in-vicinity completions-dir uvx-name)
1835 (lambda _
1836 (invoke uvx "--generate-shell-completion" shell)))))
1837 `(("bash" "uv" "uvx"
1838 ,(string-append #$output "/share/bash-completion/completions"))
1839 ("zsh" "_uv" "_uvx"
1840 ,(string-append #$output "/share/zsh/site-functions"))
1841 ("fish" "uv.fish" "uvx.fish"
1842 ,(string-append #$output "/share/fish/vendor_completions.d"))
1843 ("elvish" "uv" "uvx"
1844 ,(string-append #$output "/share/elvish/lib"))
1845 ("nushell" "uv" "uvx"
1846 ,(string-append #$output "/share/nushell/vendor/autoload"))))))))))
1847 (native-inputs
1848 (append
1849 (list maturin pkg-config rust `(,rust "cargo"))
1850 (if (%current-target-system)
1851 (list this-package
1852 (make-rust-sysroot (%current-target-system)))
1853 '())))
1854 (inputs (cons* jemalloc xz `(,zstd "lib") (cargo-inputs 'uv)))
1855 (home-page "https://docs.astral.sh/uv/")
1856 (synopsis "Python package and project manager written in Rust")
1857 (description
1858 "@command{uv} is a high-performance Python package and project manager
1859written in Rust, known for its execution speed and compatibility with existing
1860tools.")
1861 (license (list license:asl2.0 license:expat)))) ;dual-licensed
1862
1863(define-public python-uv-build
1864 (package
1865 (inherit uv)
1866 (name "python-uv-build")
1867 (version "0.11.25")
1868 (source
1869 (origin
1870 (method url-fetch)
1871 (uri (pypi-uri "uv_build" version))
1872 (sha256
1873 (base32 "15v20b8xdkd3jzr8jibvf73kah32wb4xpgiglr9q6jz0hyry6plb"))))
1874 (build-system pyproject-build-system)
1875 (arguments
1876 (list
1877 #:tests? #f ;no test suite
1878 #:phases
1879 #~(modify-phases %standard-phases
1880 (add-after 'unpack 'patch-uv-command
1881 (lambda* (#:key inputs #:allow-other-keys)
1882 ;; This package uses maturin to rebuild a more minimal variant
1883 ;; of 'uv'. Since we already build the whole uv as a separate
1884 ;; package, reuse it directly.
1885 (substitute* "python/uv_build/__init__.py"
1886 (("USE_UV_EXECUTABLE = False")
1887 "USE_UV_EXECUTABLE = True")
1888 (("uv_bin_name = \"uv\"")
1889 (format #f "uv_bin_name = ~s"
1890 (search-input-file inputs "bin/uv"))))))
1891 (delete 'build) ;avoid building uv again
1892 (replace 'install
1893 (lambda* (#:key inputs outputs #:allow-other-keys)
1894 (copy-recursively "python/uv_build"
1895 (string-append (site-packages inputs outputs)
1896 "/uv_build"))))
1897 (delete 'create-entrypoints)))) ;leaves empty bin directory
1898 (inputs (list uv))
1899 (synopsis "Python build backend using uv")
1900 (description "This package provides a Python build backend that uses the
1901@command{uv} command.")))