1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2017, 2018 Ricardo Wurmus <rekado@elephly.net>
3 ;;; Copyright © 2017 Corentin Bocquillon <corentin@nybble.fr>
4 ;;; Copyright © 2017, 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
5 ;;; Copyright © 2018 Fis Trivial <ybbs.daans@hotmail.com>
6 ;;; Copyright © 2018 Tomáš Čech <sleep_walker@gnu.org>
7 ;;; Copyright © 2018, 2020 Marius Bakke <mbakke@fastmail.com>
8 ;;; Copyright © 2018 Alex Vong <alexvong1995@gmail.com>
9 ;;; Copyright © 2019, 2020 Brett Gilio <brettg@gnu.org>
10 ;;; Copyright © 2019 Jonathan Brielmaier <jonathan.brielmaier@web.de>
11 ;;; Copyright © 2020 Leo Prikler <leo.prikler@student.tugraz.at>
12 ;;; Copyright © 2020 Yuval Kogman <nothingmuch@woobling.org>
13 ;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
14 ;;; Copyright © 2020 Efraim Flashner <efraim@flashner.co.il>
15 ;;; Copyright © 2021 qblade <qblade@protonmail.com>
16 ;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
18 ;;; This file is part of GNU Guix.
20 ;;; GNU Guix is free software; you can redistribute it and/or modify it
21 ;;; under the terms of the GNU General Public License as published by
22 ;;; the Free Software Foundation; either version 3 of the License, or (at
23 ;;; your option) any later version.
25 ;;; GNU Guix is distributed in the hope that it will be useful, but
26 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
27 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 ;;; GNU General Public License for more details.
30 ;;; You should have received a copy of the GNU General Public License
31 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
33 (define-module (gnu packages build-tools)
34 #:use-module ((guix licenses) #:prefix license:)
35 #:use-module (guix utils)
36 #:use-module (guix packages)
37 #:use-module (guix download)
38 #:use-module (guix git-download)
39 #:use-module (guix build-system cmake)
40 #:use-module (gnu packages)
41 #:use-module (gnu packages adns)
42 #:use-module (gnu packages base)
43 #:use-module (gnu packages bash)
44 #:use-module (gnu packages check)
45 #:use-module (gnu packages compression)
46 #:use-module (gnu packages cpp)
47 #:use-module (gnu packages gcc)
48 #:use-module (gnu packages linux)
49 #:use-module (gnu packages logging)
50 #:use-module (gnu packages lua)
51 #:use-module (gnu packages package-management)
52 #:use-module (gnu packages pcre)
53 #:use-module (gnu packages pkg-config)
54 #:use-module (gnu packages pretty-print)
55 #:use-module (gnu packages protobuf)
56 #:use-module (gnu packages python)
57 #:use-module (gnu packages python-crypto)
58 #:use-module (gnu packages python-web)
59 #:use-module (gnu packages python-xyz)
60 #:use-module (gnu packages regex)
61 #:use-module (gnu packages rpc)
62 #:use-module (gnu packages sqlite)
63 #:use-module (gnu packages tls)
64 #:use-module (gnu packages ninja)
65 #:use-module (guix build-system gnu)
66 #:use-module (guix build-system python))
73 ;; do not use auto-generated tarballs
76 (url "https://github.com/matricks/bam")
77 (commit (string-append "v" version))))
78 (file-name (git-file-name name version))
81 "13br735ig7lygvzyfd15fc2rdygrqm503j6xj5xkrl1r7w2wipq6"))))
82 (build-system gnu-build-system)
84 `(#:make-flags `(,(string-append "CC=" ,(cc-for-target))
85 ,(string-append "INSTALL_PREFIX="
86 (assoc-ref %outputs "out")))
89 (modify-phases %standard-phases
90 (delete 'configure))))
92 `(("python" ,python-2)))
95 (home-page "https://matricks.github.io/bam/")
96 (synopsis "Fast and flexible build system")
97 (description "Bam is a fast and flexible build system. Bam uses Lua to
98 describe the build process. It takes its inspiration for the script files
99 from scons. While scons focuses on being 100% correct when building, bam
100 makes a few sacrifices to acquire fast full and incremental build times.")
101 (license license:bsd-3)))
110 (url "https://github.com/rizsotto/Bear")
112 (file-name (git-file-name name version))
113 (patches (search-patches
114 "bear-disable-preinstall-tests.patch"))
117 "15r22sbk5bibrhf54lf0shiqw1gnsik24fr5as96w3hnj6iahgwn"))))
118 (build-system cmake-build-system)
120 `(#:phases (modify-phases %standard-phases
121 (add-before 'check 'set-build-environment
125 ;; TODO: Test Configuration is Incomplete
128 (invoke "ctest"))))))
133 ("json-modern-cxx" ,json-modern-cxx)
134 ("protobuf" ,protobuf)
135 ("python" ,python-wrapper)
139 `(("abseil-cpp" ,abseil-cpp)
140 ("gcc-9" ,gcc-9) ; for <filesystem>, #44896
141 ("googletest" ,googletest)
143 ("pkg-config" ,pkg-config)
144 ("python-lit" ,python-lit)
146 (home-page "https://github.com/rizsotto/Bear")
147 (synopsis "Tool for generating a compilation database")
148 (description "A JSON compilation database is used in the Clang project to
149 provide information on how a given compilation unit is processed. With this,
150 it is easy to re-run the compilation with alternate programs. Bear is used to
151 generate such a compilation database.")
152 (license license:gpl3+)))
162 "http://www.crufty.net/ftp/pub/sjg/bmake-" version ".tar.gz"))
164 (base32 "07n9avzdg6gifrzyddnyzada5s5rzklvbqfpv5drljpxcgpqpvwg"))))
165 (build-system gnu-build-system)
167 `(("bash" ,bash-minimal)))
169 `(("coreutils" ,coreutils)))
171 `(#:tests? #f ; test during build
173 (modify-phases %standard-phases
174 (add-after 'configure 'fix-test ; fix from nixpkgs
176 (substitute* "unit-tests/unexport-env.mk"
177 (("PATH=\t/bin:/usr/bin:/sbin:/usr/sbin")
178 "PATH := ${PATH}"))))
179 (add-after 'configure 'remove-fail-tests
181 (substitute* "unit-tests/Makefile"
182 (("cmd-interrupt") "")
183 (("varmod-localtime") ""))
188 "--with-defshell=" (assoc-ref %build-inputs "bash") "/bin/bash")
190 "--with-default-sys-path=" (assoc-ref %outputs "out") "/share/mk"))
192 (list "INSTALL=install"))) ;; use coreutils install
193 (home-page "http://www.crufty.net/help/sjg/bmake.htm")
194 (synopsis "BSD's make")
196 "bmake is a program designed to simplify the maintenance of other
197 programs. Its input is a list of specifications as to the files upon which
198 programs and other files depend.")
199 (license license:bsd-3)))
202 (let ((commit "e327ffdc503815916db2543ec000226a8df45163")
203 (revision "1819")) ;as returned by `git describe`, used below
206 (version (git-version "0.0" revision commit))
207 (home-page "https://gn.googlesource.com/gn")
210 (uri (git-reference (url home-page) (commit commit)))
213 "0kvlfj3www84zp1vmxh76x8fdjm9hyk8lkh2vdsidafpmm75fphr"))
214 (file-name (git-file-name name version))))
215 (build-system gnu-build-system)
217 `(#:phases (modify-phases %standard-phases
218 (add-before 'configure 'set-build-environment
220 (setenv "CC" "gcc") (setenv "CXX" "g++")
225 (invoke "python" "build/gen.py"
226 "--no-last-commit-position")))
227 (add-after 'configure 'create-last-commit-position
229 ;; Create "last_commit_position.h" to avoid a dependency
230 ;; on 'git' (and the checkout..).
231 (call-with-output-file "out/last_commit_position.h"
235 "#define LAST_COMMIT_POSITION_NUM ~a\n"
236 "#define LAST_COMMIT_POSITION \"~a (~a)\"\n")
237 ,revision ,revision ,(string-take commit 8))
241 (invoke "ninja" "-C" "out" "gn"
242 "-j" (number->string (parallel-job-count)))))
244 (lambda* (#:key (tests? #t) #:allow-other-keys)
247 (invoke "ninja" "-C" "out" "gn_unittests"
248 "-j" (number->string (parallel-job-count)))
249 (invoke "./out/gn_unittests"))
250 (format #t "test suite not run~%"))))
252 (lambda* (#:key outputs #:allow-other-keys)
253 (let ((out (assoc-ref outputs "out")))
254 (install-file "out/gn" (string-append out "/bin"))
258 ("python" ,python-2)))
259 (synopsis "Generate Ninja build files")
261 "GN is a tool that collects information about a project from @file{.gn}
262 files and generates build instructions for the Ninja build system.")
263 ;; GN is distributed as BSD-3, but bundles some files from ICU using the
265 (license (list license:bsd-3 license:x11)))))
273 (uri (string-append "https://github.com/mesonbuild/meson/"
274 "releases/download/" version "/meson-"
278 "07y2hh9dfn1m9g4bsy49nbn3vdmd0b2iwr8bxg19fhqq6c7q73ry"))))
279 (build-system python-build-system)
281 `(;; FIXME: Tests require many additional inputs, a fix for the RUNPATH
282 ;; patch in meson-for-build, and patching many hard-coded file system
283 ;; locations in "run_unittests.py".
285 #:phases (modify-phases %standard-phases
286 ;; Meson calls the various executables in out/bin through the
287 ;; Python interpreter, so we cannot use the shell wrapper.
289 (inputs `(("ninja" ,ninja)))
290 (propagated-inputs `(("python" ,python)))
291 (home-page "https://mesonbuild.com/")
292 (synopsis "Build system designed to be fast and user-friendly")
294 "The Meson build system is focused on user-friendliness and speed.
295 It can compile code written in C, C++, Fortran, Java, Rust, and other
296 languages. Meson provides features comparable to those of the
297 Autoconf/Automake/make combo. Build specifications, also known as @dfn{Meson
298 files}, are written in a custom domain-specific language (@dfn{DSL}) that
300 (license license:asl2.0)))
302 ;; Added temporarily for packages that need it.
303 ;; TODO: Remove when core-updates is merged.
304 (define-public meson-0.55
310 (uri (string-append "https://github.com/mesonbuild/meson/"
311 "releases/download/" version "/meson-"
315 "1070kjiirxxdfppmrhi3wsc6rykay1zlciqrzayjhjg0hkw42mrv"))))))
317 (define-public meson-next
323 (uri (string-append "https://github.com/mesonbuild/meson/"
324 "releases/download/" version "/meson-"
328 "1iac7p99zfgkznq4qlnkk7b8xwwlilcrnkf33sczm56yqnqyg0rs"))))))
330 (define-public meson-for-build
333 (name "meson-for-build")
335 (inherit (package-source meson))
336 (patches (search-patches "meson-for-build-rpath.patch"))))
338 ;; People should probably install "meson", not "meson-for-build".
339 (properties `((hidden? . #t)))))
341 (define-public premake4
347 (uri (string-append "mirror://sourceforge/premake/Premake/"
348 version "/premake-" version "-src.zip"))
351 "1017rd0wsjfyq2jvpjjhpszaa7kmig6q1nimw76qx3cjz2868lrn"))))
352 (build-system gnu-build-system)
354 `(("unzip" ,unzip))) ; for unpacking the source
356 `(#:make-flags (list (string-append "CC=" ,(cc-for-target)))
357 #:tests? #f ; No test suite
359 (modify-phases %standard-phases
361 (add-after 'unpack 'enter-source
362 (lambda _ (chdir "build/gmake.unix") #t))
364 (lambda* (#:key outputs #:allow-other-keys)
365 (install-file "../../bin/release/premake4"
366 (string-append (assoc-ref outputs "out") "/bin"))
368 (synopsis "Portable software build tool")
369 (description "@code{premake4} is a command line utility that reads a
370 scripted definition of a software project and outputs @file{Makefile}s or
371 other lower-level build files.")
372 (home-page "https://premake.github.io")
373 (license license:bsd-3)))
375 (define-public premake5
378 (version "5.0.0-alpha15")
381 (uri (string-append "https://github.com/premake/premake-core/"
382 "releases/download/v" version
383 "/premake-" version "-src.zip"))
386 "0lyxfyqxyhjqsb3kmx1fyrxinb26i68hb7w7rg8lajczrgkmc3w8"))))
388 (substitute-keyword-arguments (package-arguments premake4)
390 `(modify-phases ,phases
391 (replace 'enter-source
392 (lambda _ (chdir "build/gmake2.unix") #t))
394 (lambda* (#:key outputs #:allow-other-keys)
395 (install-file "../../bin/release/premake5"
396 (string-append (assoc-ref outputs "out") "/bin"))
398 (description "@code{premake5} is a command line utility that reads a
399 scripted definition of a software project and outputs @file{Makefile}s or
400 other lower-level build files.")))
408 (uri (string-append "http://gittup.org/tup/releases/tup-v"
412 "0gnd2598xqgwihdkfkx7qn0q6p4n7npam1fy83mp7s04zwj99syc"))
413 (patches (search-patches "tup-unbundle-dependencies.patch"))
414 (modules '((guix build utils)))
417 ;; NOTE: Tup uses a slightly modified Lua, so it cannot be
418 ;; unbundled. See: src/lula/tup-lua.patch
419 (delete-file-recursively "src/pcre")
420 (delete-file-recursively "src/sqlite3")
422 (build-system gnu-build-system)
425 (modify-phases %standard-phases
426 ;; There is a bootstrap script, but it doesn't do what you think - it
431 (substitute* "src/tup/link.sh"
432 (("`git describe`") ,version))
433 (with-output-to-file "tup.config"
435 (format #t "CONFIG_TUP_USE_SYSTEM_SQLITE=y~%")))
440 ;; Based on bootstrap-nofuse.sh, but with a detour to patch-shebang.
441 (invoke "./build.sh")
442 (invoke "./build/tup" "init")
443 (invoke "./build/tup" "generate" "--verbose" "build-nofuse.sh")
444 (patch-shebang "build-nofuse.sh")
445 (invoke "./build-nofuse.sh")))
447 (lambda* (#:key outputs #:allow-other-keys)
448 (let* ((outdir (assoc-ref outputs "out"))
449 (ftdetect (string-append outdir
450 "/share/vim/vimfiles/ftdetect")))
451 (install-file "tup" (string-append outdir "/bin"))
452 (install-file "tup.1" (string-append outdir "/share/man/man1"))
453 (install-file "contrib/syntax/tup.vim"
454 (string-append outdir "/share/vim/vimfiles/syntax"))
456 (with-output-to-file (string-append ftdetect "/tup.vim")
458 (display "au BufNewFile,BufRead Tupfile,*.tup setf tup")))
463 ("pcre" ,pcre "bin") ; pcre-config
466 `(("pkg-config" ,pkg-config)))
467 (home-page "http://gittup.org/tup/")
468 (synopsis "Fast build system that's hard to get wrong")
469 (description "Tup is a generic build system based on a directed acyclic
470 graphs of commands to be executed. Tup instruments your build to detect the
471 exact dependencies of the commands, allowing you to take advantage of ideal
472 parallelism during incremental builds, and detecting any situations where
473 a build worked by accident.")
474 (license license:gpl2)))
484 (url "https://github.com/openSUSE/osc")
486 (file-name (git-file-name name version))
488 (base32 "1sqdnkka3c6b6hwnrmlwrgy7w62cp8raq8mph9pgd2lydzzbvwlp"))))
489 (build-system python-build-system)
492 (modify-phases %standard-phases
493 (add-after 'install 'fix-filename
494 (lambda* (#:key outputs #:allow-other-keys)
495 (let ((bin (string-append (assoc-ref outputs "out") "/bin/")))
496 ;; Main osc tool is renamed in spec file, not setup.py, let's
499 (string-append bin "osc-wrapper.py")
500 (string-append bin "osc"))
503 `(("python-chardet" ,python-chardet)))
505 `(("python-m2crypto" ,python-m2crypto)
506 ("python-pycurl" ,python-pycurl)
507 ("rpm" ,rpm))) ; for python-rpm
508 (home-page "https://github.com/openSUSE/osc")
509 (synopsis "Open Build Service command line tool")
510 (description "@command{osc} is a command line interface to the Open Build
511 Service. It allows you to checkout, commit, perform reviews etc. The vast
512 majority of the OBS functionality is available via commands and the rest can
513 be reached via direct API calls.")
514 (license license:gpl2+)))
516 (define-public compiledb
523 (uri (pypi-uri "compiledb" version))
525 (base32 "0vlngsdxfakyl8b7rnvn8h3l216lhbrrydr04yhy6kd03zflgfq6"))))
526 (build-system python-build-system)
529 (modify-phases %standard-phases
530 (add-after 'unpack 'no-compat-shim-dependency
531 ;; shutilwhich is only needed for python 3.3 and earlier
533 (substitute* "setup.py" (("^ *'shutilwhich'\n") ""))
534 (substitute* "compiledb/compiler.py" (("shutilwhich") "shutil")))))))
536 `(("python-bashlex" ,python-bashlex)
537 ("python-click" ,python-click)))
539 `(("python-pytest" ,python-pytest)))
541 "https://github.com/nickdiego/compiledb")
543 "Generate Clang JSON Compilation Database files for make-based build systems")
545 "@code{compiledb} provides a @code{make} python wrapper script which,
546 besides executing the make build command, updates the JSON compilation
547 database file corresponding to that build, resulting in a command-line
548 interface similar to Bear.")
549 (license license:gpl3)))
558 (uri (string-append "https://www.codesynthesis.com/download/"
559 "build/" (version-major+minor version)
560 "/build-" version ".tar.bz2"))
562 (base32 "1lx5rpnmsbip43zpp0a57sl5rm7pjb0y6i2si6rfglfp4p9d3z76"))))
563 (build-system gnu-build-system)
565 `(#:make-flags (list (string-append "install_prefix=" %output))
567 #:phases (modify-phases %standard-phases
569 (delete 'configure))))
570 (home-page "https://www.codesynthesis.com/projects/build/")
571 (synopsis "Massively-parallel build system implemented on top of GNU make")
572 (description "Build is a massively-parallel software build system
573 implemented on top of GNU Make, designed with the following tasks in mind:
580 Build has features such as:
582 @item Position-independent makefiles.
583 @item Non-recursive multi-makefile include-based structure.
584 @item Leaf makefiles are full-fledged GNU makefiles, not just variable definitions.
585 @item Complete dependency graph.
586 @item Inter-project dependency tracking.
587 @item Extensible language/compiler framework.
589 (license license:gpl2+)))