gnu: bear: Update to 3.0.4.
[jackhill/guix/guix.git] / gnu / packages / build-tools.scm
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 ;;;
16 ;;; This file is part of GNU Guix.
17 ;;;
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.
22 ;;;
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.
27 ;;;
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/>.
30
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))
63
64 (define-public bam
65 (package
66 (name "bam")
67 (version "0.5.1")
68 (source (origin
69 ;; do not use auto-generated tarballs
70 (method git-fetch)
71 (uri (git-reference
72 (url "https://github.com/matricks/bam")
73 (commit (string-append "v" version))))
74 (file-name (git-file-name name version))
75 (sha256
76 (base32
77 "13br735ig7lygvzyfd15fc2rdygrqm503j6xj5xkrl1r7w2wipq6"))))
78 (build-system gnu-build-system)
79 (arguments
80 `(#:make-flags `(,(string-append "CC=" ,(cc-for-target))
81 ,(string-append "INSTALL_PREFIX="
82 (assoc-ref %outputs "out")))
83 #:test-target "test"
84 #:phases
85 (modify-phases %standard-phases
86 (delete 'configure))))
87 (native-inputs
88 `(("python" ,python-2)))
89 (inputs
90 `(("lua" ,lua)))
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)))
98
99 (define-public bear
100 (package
101 (name "bear")
102 (version "3.0.4")
103 (source (origin
104 (method git-fetch)
105 (uri (git-reference
106 (url "https://github.com/rizsotto/Bear")
107 (commit version)))
108 (file-name (git-file-name name version))
109 (patches (search-patches
110 "bear-disable-preinstall-tests.patch"))
111 (sha256
112 (base32
113 "15r22sbk5bibrhf54lf0shiqw1gnsik24fr5as96w3hnj6iahgwn"))))
114 (build-system cmake-build-system)
115 (arguments
116 `(#:phases (modify-phases %standard-phases
117 (add-before 'check 'set-build-environment
118 (lambda _
119 (setenv "CC" "gcc")
120 #t))
121 ;; TODO: Test Configuration is Incomplete
122 (replace 'check
123 (lambda _
124 (invoke "ctest"))))))
125 (inputs
126 `(("c-ares" ,c-ares)
127 ("fmt" ,fmt)
128 ("grpc" ,grpc)
129 ("json-modern-cxx" ,json-modern-cxx)
130 ("protobuf" ,protobuf)
131 ("python" ,python-wrapper)
132 ("re2" ,re2)
133 ("spdlog" ,spdlog)))
134 (native-inputs
135 `(("abseil-cpp" ,abseil-cpp)
136 ("gcc-9" ,gcc-9) ; for <filesystem>, #44896
137 ("googletest" ,googletest)
138 ("openssl" ,openssl)
139 ("pkg-config" ,pkg-config)
140 ("python-lit" ,python-lit)
141 ("zlib" ,zlib)))
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+)))
149
150 (define-public gn
151 (let ((commit "e327ffdc503815916db2543ec000226a8df45163")
152 (revision "1819")) ;as returned by `git describe`, used below
153 (package
154 (name "gn")
155 (version (git-version "0.0" revision commit))
156 (home-page "https://gn.googlesource.com/gn")
157 (source (origin
158 (method git-fetch)
159 (uri (git-reference (url home-page) (commit commit)))
160 (sha256
161 (base32
162 "0kvlfj3www84zp1vmxh76x8fdjm9hyk8lkh2vdsidafpmm75fphr"))
163 (file-name (git-file-name name version))))
164 (build-system gnu-build-system)
165 (arguments
166 `(#:phases (modify-phases %standard-phases
167 (add-before 'configure 'set-build-environment
168 (lambda _
169 (setenv "CC" "gcc") (setenv "CXX" "g++")
170 (setenv "AR" "ar")
171 #t))
172 (replace 'configure
173 (lambda _
174 (invoke "python" "build/gen.py"
175 "--no-last-commit-position")))
176 (add-after 'configure 'create-last-commit-position
177 (lambda _
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"
181 (lambda (port)
182 (format port
183 (string-append
184 "#define LAST_COMMIT_POSITION_NUM ~a\n"
185 "#define LAST_COMMIT_POSITION \"~a (~a)\"\n")
186 ,revision ,revision ,(string-take commit 8))
187 #t))))
188 (replace 'build
189 (lambda _
190 (invoke "ninja" "-C" "out" "gn"
191 "-j" (number->string (parallel-job-count)))))
192 (replace 'check
193 (lambda* (#:key (tests? #t) #:allow-other-keys)
194 (if tests?
195 (lambda ()
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~%"))))
200 (replace 'install
201 (lambda* (#:key outputs #:allow-other-keys)
202 (let ((out (assoc-ref outputs "out")))
203 (install-file "out/gn" (string-append out "/bin"))
204 #t))))))
205 (native-inputs
206 `(("ninja" ,ninja)
207 ("python" ,python-2)))
208 (synopsis "Generate Ninja build files")
209 (description
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
213 ;; X11 license.
214 (license (list license:bsd-3 license:x11)))))
215
216 (define-public meson
217 (package
218 (name "meson")
219 (version "0.53.2")
220 (source (origin
221 (method url-fetch)
222 (uri (string-append "https://github.com/mesonbuild/meson/"
223 "releases/download/" version "/meson-"
224 version ".tar.gz"))
225 (sha256
226 (base32
227 "07y2hh9dfn1m9g4bsy49nbn3vdmd0b2iwr8bxg19fhqq6c7q73ry"))))
228 (build-system python-build-system)
229 (arguments
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".
233 #:tests? #f
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.
237 (delete 'wrap))))
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")
242 (description
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
248 resembles Python.")
249 (license license:asl2.0)))
250
251 ;; Added temporarily for packages that need it.
252 ;; TODO: Remove when core-updates is merged.
253 (define-public meson-0.55
254 (package
255 (inherit meson)
256 (version "0.55.1")
257 (source (origin
258 (method url-fetch)
259 (uri (string-append "https://github.com/mesonbuild/meson/"
260 "releases/download/" version "/meson-"
261 version ".tar.gz"))
262 (sha256
263 (base32
264 "1070kjiirxxdfppmrhi3wsc6rykay1zlciqrzayjhjg0hkw42mrv"))))))
265
266 (define-public meson-for-build
267 (package
268 (inherit meson)
269 (name "meson-for-build")
270 (source (origin
271 (inherit (package-source meson))
272 (patches (search-patches "meson-for-build-rpath.patch"))))
273
274 ;; People should probably install "meson", not "meson-for-build".
275 (properties `((hidden? . #t)))))
276
277 (define-public premake4
278 (package
279 (name "premake")
280 (version "4.3")
281 (source (origin
282 (method url-fetch)
283 (uri (string-append "mirror://sourceforge/premake/Premake/"
284 version "/premake-" version "-src.zip"))
285 (sha256
286 (base32
287 "1017rd0wsjfyq2jvpjjhpszaa7kmig6q1nimw76qx3cjz2868lrn"))))
288 (build-system gnu-build-system)
289 (native-inputs
290 `(("unzip" ,unzip))) ; for unpacking the source
291 (arguments
292 `(#:make-flags (list (string-append "CC=" ,(cc-for-target)))
293 #:tests? #f ; No test suite
294 #:phases
295 (modify-phases %standard-phases
296 (delete 'configure)
297 (add-after 'unpack 'enter-source
298 (lambda _ (chdir "build/gmake.unix") #t))
299 (replace 'install
300 (lambda* (#:key outputs #:allow-other-keys)
301 (install-file "../../bin/release/premake4"
302 (string-append (assoc-ref outputs "out") "/bin"))
303 #t)))))
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)))
310
311 (define-public premake5
312 (package
313 (inherit premake4)
314 (version "5.0.0-alpha15")
315 (source (origin
316 (method url-fetch)
317 (uri (string-append "https://github.com/premake/premake-core/"
318 "releases/download/v" version
319 "/premake-" version "-src.zip"))
320 (sha256
321 (base32
322 "0lyxfyqxyhjqsb3kmx1fyrxinb26i68hb7w7rg8lajczrgkmc3w8"))))
323 (arguments
324 (substitute-keyword-arguments (package-arguments premake4)
325 ((#:phases phases)
326 `(modify-phases ,phases
327 (replace 'enter-source
328 (lambda _ (chdir "build/gmake2.unix") #t))
329 (replace 'install
330 (lambda* (#:key outputs #:allow-other-keys)
331 (install-file "../../bin/release/premake5"
332 (string-append (assoc-ref outputs "out") "/bin"))
333 #t))))))
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.")))
337
338 (define-public tup
339 (package
340 (name "tup")
341 (version "0.7.9")
342 (source (origin
343 (method url-fetch)
344 (uri (string-append "http://gittup.org/tup/releases/tup-v"
345 version ".tar.gz"))
346 (sha256
347 (base32
348 "0gnd2598xqgwihdkfkx7qn0q6p4n7npam1fy83mp7s04zwj99syc"))
349 (patches (search-patches "tup-unbundle-dependencies.patch"))
350 (modules '((guix build utils)))
351 (snippet
352 '(begin
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")
357 #t))))
358 (build-system gnu-build-system)
359 (arguments
360 `(#:phases
361 (modify-phases %standard-phases
362 ;; There is a bootstrap script, but it doesn't do what you think - it
363 ;; builds tup.
364 (delete 'bootstrap)
365 (replace 'configure
366 (lambda _
367 (substitute* "src/tup/link.sh"
368 (("`git describe`") ,version))
369 (with-output-to-file "tup.config"
370 (lambda _
371 (format #t "CONFIG_TUP_USE_SYSTEM_SQLITE=y~%")))
372 #t))
373 (delete 'check)
374 (replace 'build
375 (lambda _
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")))
382 (replace 'install
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"))
391 (mkdir-p ftdetect)
392 (with-output-to-file (string-append ftdetect "/tup.vim")
393 (lambda _
394 (display "au BufNewFile,BufRead Tupfile,*.tup setf tup")))
395 #t))))))
396 (inputs
397 `(("fuse" ,fuse)
398 ("pcre" ,pcre)
399 ("pcre" ,pcre "bin") ; pcre-config
400 ("sqlite" ,sqlite)))
401 (native-inputs
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)))
411
412 (define-public osc
413 (package
414 (name "osc")
415 (version "0.165.2")
416 (source
417 (origin
418 (method git-fetch)
419 (uri (git-reference
420 (url "https://github.com/openSUSE/osc")
421 (commit version)))
422 (file-name (git-file-name name version))
423 (sha256
424 (base32 "0yjwvbvv9fgkpiyvrag89zxchyn3nbgp9jz0wn5p0z9450zwfyz6"))))
425 (build-system python-build-system)
426 (arguments
427 `(#:phases
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
433 ;; do that too.
434 (rename-file
435 (string-append bin "osc-wrapper.py")
436 (string-append bin "osc"))
437 #t))))))
438 (inputs
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+)))
449
450 (define-public compiledb
451 (package
452 (name "compiledb")
453 (version "0.10.1")
454 (source
455 (origin
456 (method url-fetch)
457 (uri (pypi-uri "compiledb" version))
458 (sha256
459 (base32 "0vlngsdxfakyl8b7rnvn8h3l216lhbrrydr04yhy6kd03zflgfq6"))))
460 (build-system python-build-system)
461 (arguments
462 `(#:phases
463 (modify-phases %standard-phases
464 (add-after 'unpack 'no-compat-shim-dependency
465 ;; shutilwhich is only needed for python 3.3 and earlier
466 (lambda _
467 (substitute* "setup.py" (("^ *'shutilwhich'\n") ""))
468 (substitute* "compiledb/compiler.py" (("shutilwhich") "shutil")))))))
469 (propagated-inputs
470 `(("python-bashlex" ,python-bashlex)
471 ("python-click" ,python-click)))
472 (native-inputs
473 `(("python-pytest" ,python-pytest)))
474 (home-page
475 "https://github.com/nickdiego/compiledb")
476 (synopsis
477 "Generate Clang JSON Compilation Database files for make-based build systems")
478 (description
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)))