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>
16 ;;; This file is part of GNU Guix.
18 ;;; GNU Guix is free software; you can redistribute it and/or modify it
19 ;;; under the terms of the GNU General Public License as published by
20 ;;; the Free Software Foundation; either version 3 of the License, or (at
21 ;;; your option) any later version.
23 ;;; GNU Guix is distributed in the hope that it will be useful, but
24 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
25 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 ;;; GNU General Public License for more details.
28 ;;; You should have received a copy of the GNU General Public License
29 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
31 (define-module (gnu packages build-tools)
32 #:use-module ((guix licenses) #:prefix license:)
33 #:use-module (guix utils)
34 #:use-module (guix packages)
35 #:use-module (guix download)
36 #:use-module (guix git-download)
37 #:use-module (guix build-system cmake)
38 #:use-module (gnu packages)
39 #:use-module (gnu packages adns)
40 #:use-module (gnu packages check)
41 #:use-module (gnu packages compression)
42 #:use-module (gnu packages cpp)
43 #:use-module (gnu packages gcc)
44 #:use-module (gnu packages linux)
45 #:use-module (gnu packages logging)
46 #:use-module (gnu packages lua)
47 #:use-module (gnu packages package-management)
48 #:use-module (gnu packages pcre)
49 #:use-module (gnu packages pkg-config)
50 #:use-module (gnu packages pretty-print)
51 #:use-module (gnu packages protobuf)
52 #:use-module (gnu packages python)
53 #:use-module (gnu packages python-crypto)
54 #:use-module (gnu packages python-web)
55 #:use-module (gnu packages python-xyz)
56 #:use-module (gnu packages regex)
57 #:use-module (gnu packages rpc)
58 #:use-module (gnu packages sqlite)
59 #:use-module (gnu packages tls)
60 #:use-module (gnu packages ninja)
61 #:use-module (guix build-system gnu)
62 #:use-module (guix build-system python))
69 ;; do not use auto-generated tarballs
72 (url "https://github.com/matricks/bam")
73 (commit (string-append "v" version))))
74 (file-name (git-file-name name version))
77 "13br735ig7lygvzyfd15fc2rdygrqm503j6xj5xkrl1r7w2wipq6"))))
78 (build-system gnu-build-system)
80 `(#:make-flags `(,(string-append "CC=" ,(cc-for-target))
81 ,(string-append "INSTALL_PREFIX="
82 (assoc-ref %outputs "out")))
85 (modify-phases %standard-phases
86 (delete 'configure))))
88 `(("python" ,python-2)))
91 (home-page "https://matricks.github.io/bam/")
92 (synopsis "Fast and flexible build system")
93 (description "Bam is a fast and flexible build system. Bam uses Lua to
94 describe the build process. It takes its inspiration for the script files
95 from scons. While scons focuses on being 100% correct when building, bam
96 makes a few sacrifices to acquire fast full and incremental build times.")
97 (license license:bsd-3)))
106 (url "https://github.com/rizsotto/Bear")
108 (file-name (git-file-name name version))
109 (patches (search-patches
110 "bear-disable-preinstall-tests.patch"))
113 "15r22sbk5bibrhf54lf0shiqw1gnsik24fr5as96w3hnj6iahgwn"))))
114 (build-system cmake-build-system)
116 `(#:phases (modify-phases %standard-phases
117 (add-before 'check 'set-build-environment
121 ;; TODO: Test Configuration is Incomplete
124 (invoke "ctest"))))))
129 ("json-modern-cxx" ,json-modern-cxx)
130 ("protobuf" ,protobuf)
131 ("python" ,python-wrapper)
135 `(("abseil-cpp" ,abseil-cpp)
136 ("gcc-9" ,gcc-9) ; for <filesystem>, #44896
137 ("googletest" ,googletest)
139 ("pkg-config" ,pkg-config)
140 ("python-lit" ,python-lit)
142 (home-page "https://github.com/rizsotto/Bear")
143 (synopsis "Tool for generating a compilation database")
144 (description "A JSON compilation database is used in the Clang project to
145 provide information on how a given compilation unit is processed. With this,
146 it is easy to re-run the compilation with alternate programs. Bear is used to
147 generate such a compilation database.")
148 (license license:gpl3+)))
151 (let ((commit "e327ffdc503815916db2543ec000226a8df45163")
152 (revision "1819")) ;as returned by `git describe`, used below
155 (version (git-version "0.0" revision commit))
156 (home-page "https://gn.googlesource.com/gn")
159 (uri (git-reference (url home-page) (commit commit)))
162 "0kvlfj3www84zp1vmxh76x8fdjm9hyk8lkh2vdsidafpmm75fphr"))
163 (file-name (git-file-name name version))))
164 (build-system gnu-build-system)
166 `(#:phases (modify-phases %standard-phases
167 (add-before 'configure 'set-build-environment
169 (setenv "CC" "gcc") (setenv "CXX" "g++")
174 (invoke "python" "build/gen.py"
175 "--no-last-commit-position")))
176 (add-after 'configure 'create-last-commit-position
178 ;; Create "last_commit_position.h" to avoid a dependency
179 ;; on 'git' (and the checkout..).
180 (call-with-output-file "out/last_commit_position.h"
184 "#define LAST_COMMIT_POSITION_NUM ~a\n"
185 "#define LAST_COMMIT_POSITION \"~a (~a)\"\n")
186 ,revision ,revision ,(string-take commit 8))
190 (invoke "ninja" "-C" "out" "gn"
191 "-j" (number->string (parallel-job-count)))))
193 (lambda* (#:key (tests? #t) #:allow-other-keys)
196 (invoke "ninja" "-C" "out" "gn_unittests"
197 "-j" (number->string (parallel-job-count)))
198 (invoke "./out/gn_unittests"))
199 (format #t "test suite not run~%"))))
201 (lambda* (#:key outputs #:allow-other-keys)
202 (let ((out (assoc-ref outputs "out")))
203 (install-file "out/gn" (string-append out "/bin"))
207 ("python" ,python-2)))
208 (synopsis "Generate Ninja build files")
210 "GN is a tool that collects information about a project from @file{.gn}
211 files and generates build instructions for the Ninja build system.")
212 ;; GN is distributed as BSD-3, but bundles some files from ICU using the
214 (license (list license:bsd-3 license:x11)))))
222 (uri (string-append "https://github.com/mesonbuild/meson/"
223 "releases/download/" version "/meson-"
227 "07y2hh9dfn1m9g4bsy49nbn3vdmd0b2iwr8bxg19fhqq6c7q73ry"))))
228 (build-system python-build-system)
230 `(;; FIXME: Tests require many additional inputs, a fix for the RUNPATH
231 ;; patch in meson-for-build, and patching many hard-coded file system
232 ;; locations in "run_unittests.py".
234 #:phases (modify-phases %standard-phases
235 ;; Meson calls the various executables in out/bin through the
236 ;; Python interpreter, so we cannot use the shell wrapper.
238 (inputs `(("ninja" ,ninja)))
239 (propagated-inputs `(("python" ,python)))
240 (home-page "https://mesonbuild.com/")
241 (synopsis "Build system designed to be fast and user-friendly")
243 "The Meson build system is focused on user-friendliness and speed.
244 It can compile code written in C, C++, Fortran, Java, Rust, and other
245 languages. Meson provides features comparable to those of the
246 Autoconf/Automake/make combo. Build specifications, also known as @dfn{Meson
247 files}, are written in a custom domain-specific language (@dfn{DSL}) that
249 (license license:asl2.0)))
251 ;; Added temporarily for packages that need it.
252 ;; TODO: Remove when core-updates is merged.
253 (define-public meson-0.55
259 (uri (string-append "https://github.com/mesonbuild/meson/"
260 "releases/download/" version "/meson-"
264 "1070kjiirxxdfppmrhi3wsc6rykay1zlciqrzayjhjg0hkw42mrv"))))))
266 (define-public meson-for-build
269 (name "meson-for-build")
271 (inherit (package-source meson))
272 (patches (search-patches "meson-for-build-rpath.patch"))))
274 ;; People should probably install "meson", not "meson-for-build".
275 (properties `((hidden? . #t)))))
277 (define-public premake4
283 (uri (string-append "mirror://sourceforge/premake/Premake/"
284 version "/premake-" version "-src.zip"))
287 "1017rd0wsjfyq2jvpjjhpszaa7kmig6q1nimw76qx3cjz2868lrn"))))
288 (build-system gnu-build-system)
290 `(("unzip" ,unzip))) ; for unpacking the source
292 `(#:make-flags (list (string-append "CC=" ,(cc-for-target)))
293 #:tests? #f ; No test suite
295 (modify-phases %standard-phases
297 (add-after 'unpack 'enter-source
298 (lambda _ (chdir "build/gmake.unix") #t))
300 (lambda* (#:key outputs #:allow-other-keys)
301 (install-file "../../bin/release/premake4"
302 (string-append (assoc-ref outputs "out") "/bin"))
304 (synopsis "Portable software build tool")
305 (description "@code{premake4} is a command line utility that reads a
306 scripted definition of a software project and outputs @file{Makefile}s or
307 other lower-level build files.")
308 (home-page "https://premake.github.io")
309 (license license:bsd-3)))
311 (define-public premake5
314 (version "5.0.0-alpha15")
317 (uri (string-append "https://github.com/premake/premake-core/"
318 "releases/download/v" version
319 "/premake-" version "-src.zip"))
322 "0lyxfyqxyhjqsb3kmx1fyrxinb26i68hb7w7rg8lajczrgkmc3w8"))))
324 (substitute-keyword-arguments (package-arguments premake4)
326 `(modify-phases ,phases
327 (replace 'enter-source
328 (lambda _ (chdir "build/gmake2.unix") #t))
330 (lambda* (#:key outputs #:allow-other-keys)
331 (install-file "../../bin/release/premake5"
332 (string-append (assoc-ref outputs "out") "/bin"))
334 (description "@code{premake5} is a command line utility that reads a
335 scripted definition of a software project and outputs @file{Makefile}s or
336 other lower-level build files.")))
344 (uri (string-append "http://gittup.org/tup/releases/tup-v"
348 "0gnd2598xqgwihdkfkx7qn0q6p4n7npam1fy83mp7s04zwj99syc"))
349 (patches (search-patches "tup-unbundle-dependencies.patch"))
350 (modules '((guix build utils)))
353 ;; NOTE: Tup uses a slightly modified Lua, so it cannot be
354 ;; unbundled. See: src/lula/tup-lua.patch
355 (delete-file-recursively "src/pcre")
356 (delete-file-recursively "src/sqlite3")
358 (build-system gnu-build-system)
361 (modify-phases %standard-phases
362 ;; There is a bootstrap script, but it doesn't do what you think - it
367 (substitute* "src/tup/link.sh"
368 (("`git describe`") ,version))
369 (with-output-to-file "tup.config"
371 (format #t "CONFIG_TUP_USE_SYSTEM_SQLITE=y~%")))
376 ;; Based on bootstrap-nofuse.sh, but with a detour to patch-shebang.
377 (invoke "./build.sh")
378 (invoke "./build/tup" "init")
379 (invoke "./build/tup" "generate" "--verbose" "build-nofuse.sh")
380 (patch-shebang "build-nofuse.sh")
381 (invoke "./build-nofuse.sh")))
383 (lambda* (#:key outputs #:allow-other-keys)
384 (let* ((outdir (assoc-ref outputs "out"))
385 (ftdetect (string-append outdir
386 "/share/vim/vimfiles/ftdetect")))
387 (install-file "tup" (string-append outdir "/bin"))
388 (install-file "tup.1" (string-append outdir "/share/man/man1"))
389 (install-file "contrib/syntax/tup.vim"
390 (string-append outdir "/share/vim/vimfiles/syntax"))
392 (with-output-to-file (string-append ftdetect "/tup.vim")
394 (display "au BufNewFile,BufRead Tupfile,*.tup setf tup")))
399 ("pcre" ,pcre "bin") ; pcre-config
402 `(("pkg-config" ,pkg-config)))
403 (home-page "http://gittup.org/tup/")
404 (synopsis "Fast build system that's hard to get wrong")
405 (description "Tup is a generic build system based on a directed acyclic
406 graphs of commands to be executed. Tup instruments your build to detect the
407 exact dependencies of the commands, allowing you to take advantage of ideal
408 parallelism during incremental builds, and detecting any situations where
409 a build worked by accident.")
410 (license license:gpl2)))
420 (url "https://github.com/openSUSE/osc")
422 (file-name (git-file-name name version))
424 (base32 "0yjwvbvv9fgkpiyvrag89zxchyn3nbgp9jz0wn5p0z9450zwfyz6"))))
425 (build-system python-build-system)
428 (modify-phases %standard-phases
429 (add-after 'install 'fix-filename
430 (lambda* (#:key outputs #:allow-other-keys)
431 (let ((bin (string-append (assoc-ref outputs "out") "/bin/")))
432 ;; Main osc tool is renamed in spec file, not setup.py, let's
435 (string-append bin "osc-wrapper.py")
436 (string-append bin "osc"))
439 `(("python-m2crypto" ,python-m2crypto)
440 ("python-pycurl" ,python-pycurl)
441 ("rpm" ,rpm))) ; for python-rpm
442 (home-page "https://github.com/openSUSE/osc")
443 (synopsis "Open Build Service command line tool")
444 (description "@command{osc} is a command line interface to the Open Build
445 Service. It allows you to checkout, commit, perform reviews etc. The vast
446 majority of the OBS functionality is available via commands and the rest can
447 be reached via direct API calls.")
448 (license license:gpl2+)))
450 (define-public compiledb
457 (uri (pypi-uri "compiledb" version))
459 (base32 "0vlngsdxfakyl8b7rnvn8h3l216lhbrrydr04yhy6kd03zflgfq6"))))
460 (build-system python-build-system)
463 (modify-phases %standard-phases
464 (add-after 'unpack 'no-compat-shim-dependency
465 ;; shutilwhich is only needed for python 3.3 and earlier
467 (substitute* "setup.py" (("^ *'shutilwhich'\n") ""))
468 (substitute* "compiledb/compiler.py" (("shutilwhich") "shutil")))))))
470 `(("python-bashlex" ,python-bashlex)
471 ("python-click" ,python-click)))
473 `(("python-pytest" ,python-pytest)))
475 "https://github.com/nickdiego/compiledb")
477 "Generate Clang JSON Compilation Database files for make-based build systems")
479 "@code{compiledb} provides a @code{make} python wrapper script which,
480 besides executing the make build command, updates the JSON compilation
481 database file corresponding to that build, resulting in a command-line
482 interface similar to Bear.")
483 (license license:gpl3)))