Merge branch 'master' into core-updates
[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 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 Marius Bakke <mbakke@fastmail.com>
8 ;;; Copyright © 2018 Alex Vong <alexvong1995@gmail.com>
9 ;;; Copyright © 2019 Brett Gilio <brettg@posteo.net>
10 ;;; Copyright © 2019 Jonathan Brielmaier <jonathan.brielmaier@web.de>
11 ;;;
12 ;;; This file is part of GNU Guix.
13 ;;;
14 ;;; GNU Guix is free software; you can redistribute it and/or modify it
15 ;;; under the terms of the GNU General Public License as published by
16 ;;; the Free Software Foundation; either version 3 of the License, or (at
17 ;;; your option) any later version.
18 ;;;
19 ;;; GNU Guix is distributed in the hope that it will be useful, but
20 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
21 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 ;;; GNU General Public License for more details.
23 ;;;
24 ;;; You should have received a copy of the GNU General Public License
25 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
26
27 (define-module (gnu packages build-tools)
28 #:use-module ((guix licenses) #:prefix license:)
29 #:use-module (guix utils)
30 #:use-module (guix packages)
31 #:use-module (guix download)
32 #:use-module (guix git-download)
33 #:use-module (guix build-system cmake)
34 #:use-module (gnu packages)
35 #:use-module (gnu packages compression)
36 #:use-module (gnu packages lua)
37 #:use-module (gnu packages package-management)
38 #:use-module (gnu packages python)
39 #:use-module (gnu packages python-crypto)
40 #:use-module (gnu packages python-web)
41 #:use-module (gnu packages ninja)
42 #:use-module (guix build-system gnu)
43 #:use-module (guix build-system python))
44
45 (define-public bam
46 (package
47 (name "bam")
48 (version "0.5.1")
49 (source (origin
50 ;; do not use auto-generated tarballs
51 (method git-fetch)
52 (uri (git-reference
53 (url "https://github.com/matricks/bam.git")
54 (commit (string-append "v" version))))
55 (file-name (git-file-name name version))
56 (sha256
57 (base32
58 "13br735ig7lygvzyfd15fc2rdygrqm503j6xj5xkrl1r7w2wipq6"))))
59 (build-system gnu-build-system)
60 (arguments
61 `(#:make-flags `("CC=gcc"
62 ,(string-append "INSTALL_PREFIX="
63 (assoc-ref %outputs "out")))
64 #:test-target "test"
65 #:phases
66 (modify-phases %standard-phases
67 (delete 'configure))))
68 (native-inputs
69 `(("python" ,python-2)))
70 (inputs
71 `(("lua" ,lua)))
72 (home-page "https://matricks.github.io/bam/")
73 (synopsis "Fast and flexible build system")
74 (description "Bam is a fast and flexible build system. Bam uses Lua to
75 describe the build process. It takes its inspiration for the script files
76 from scons. While scons focuses on being 100% correct when building, bam
77 makes a few sacrifices to acquire fast full and incremental build times.")
78 (license license:bsd-3)))
79
80 (define-public bear
81 (package
82 (name "bear")
83 (version "2.3.13")
84 (source (origin
85 (method git-fetch)
86 (uri (git-reference
87 (url "https://github.com/rizsotto/Bear")
88 (commit version)))
89 (file-name (git-file-name name version))
90 (sha256
91 (base32
92 "0imvvs22gyr1v6ydgp5yn2nq8fb8llmz0ra1m733ikjaczl3jm7z"))))
93 (build-system cmake-build-system)
94 (inputs
95 `(("python" ,python-wrapper)))
96 (home-page "https://github.com/rizsotto/Bear")
97 (synopsis "Tool for generating a compilation database")
98 (description "A JSON compilation database is used in the Clang project to
99 provide information on how a given compilation unit is processed. With this,
100 it is easy to re-run the compilation with alternate programs. Bear is used to
101 generate such a compilation database.")
102 (license license:gpl3+)))
103
104 (define-public gn
105 (let ((commit "1ab6fa2cab7ec64840db720a56018ca8939329f9")
106 (revision "1530")) ;as returned by `git describe`, used below
107 (package
108 (name "gn")
109 (version (git-version "0.0" revision commit))
110 (home-page "https://gn.googlesource.com/gn")
111 (source (origin
112 (method git-fetch)
113 (uri (git-reference (url home-page) (commit commit)))
114 (sha256
115 (base32
116 "06h974d1lag3wwsz6s5asmpv0njmf671ag4la2fpnbh494m97lfk"))
117 (file-name (git-file-name name version))))
118 (build-system gnu-build-system)
119 (arguments
120 `(#:tests? #f ;FIXME: How to run?
121 #:phases (modify-phases %standard-phases
122 (add-before 'configure 'set-build-environment
123 (lambda _
124 (setenv "CC" "gcc") (setenv "CXX" "g++")
125 (setenv "AR" "ar")
126 (setenv "LDFLAGS" "-pthread")
127 #t))
128 (replace 'configure
129 (lambda _
130 (invoke "python" "build/gen.py"
131 "--no-last-commit-position")))
132 (add-after 'configure 'create-last-commit-position
133 (lambda _
134 ;; Create "last_commit_position.h" to avoid a dependency
135 ;; on 'git' (and the checkout..).
136 (call-with-output-file "out/last_commit_position.h"
137 (lambda (port)
138 (format port
139 "#define LAST_COMMIT_POSITION \"~a (~a)\"\n"
140 ,revision ,(string-take commit 8))
141 #t))))
142 (replace 'build
143 (lambda _
144 (invoke "ninja" "-C" "out" "gn"
145 "-j" (number->string (parallel-job-count)))))
146 (replace 'install
147 (lambda* (#:key outputs #:allow-other-keys)
148 (let ((out (assoc-ref outputs "out")))
149 (install-file "out/gn" (string-append out "/bin"))
150 #t))))))
151 (native-inputs
152 `(("ninja" ,ninja)
153 ("python" ,python-2)))
154 (synopsis "Generate Ninja build files")
155 (description
156 "GN is a tool that collects information about a project from @file{.gn}
157 files and generates build instructions for the Ninja build system.")
158 ;; GN is distributed as BSD-3, but bundles some files from ICU using the
159 ;; X11 license.
160 (license (list license:bsd-3 license:x11)))))
161
162 (define-public meson
163 (package
164 (name "meson")
165 (version "0.50.1")
166 (source (origin
167 (method url-fetch)
168 (uri (string-append "https://github.com/mesonbuild/meson/"
169 "releases/download/" version "/meson-"
170 version ".tar.gz"))
171 (sha256
172 (base32
173 "1k2fw5qk4mqjcb4j5dhp8xfn0caqphb11yh8zkw7v9w01kb5d3zn"))))
174 (build-system python-build-system)
175 (arguments
176 `(;; FIXME: Tests require many additional inputs, a fix for the RUNPATH
177 ;; patch in meson-for-build, and patching many hard-coded file system
178 ;; locations in "run_unittests.py".
179 #:tests? #f
180 #:phases (modify-phases %standard-phases
181 ;; Meson calls the various executables in out/bin through the
182 ;; Python interpreter, so we cannot use the shell wrapper.
183 (delete 'wrap))))
184 (inputs `(("ninja" ,ninja)))
185 (propagated-inputs `(("python" ,python)))
186 (home-page "https://mesonbuild.com/")
187 (synopsis "Build system designed to be fast and user-friendly")
188 (description
189 "The Meson build system is focused on user-friendliness and speed.
190 It can compile code written in C, C++, Fortran, Java, Rust, and other
191 languages. Meson provides features comparable to those of the
192 Autoconf/Automake/make combo. Build specifications, also known as @dfn{Meson
193 files}, are written in a custom domain-specific language (@dfn{DSL}) that
194 resembles Python.")
195 (license license:asl2.0)))
196
197 (define-public meson-for-build
198 (package
199 (inherit meson)
200 (name "meson-for-build")
201 (source (origin
202 (inherit (package-source meson))
203 (patches (search-patches "meson-for-build-rpath.patch"))))
204
205 ;; People should probably install "meson", not "meson-for-build".
206 (properties `((hidden? . #t)))))
207
208 (define-public premake4
209 (package
210 (name "premake")
211 (version "4.3")
212 (source (origin
213 (method url-fetch)
214 (uri (string-append "mirror://sourceforge/premake/Premake/"
215 version "/premake-" version "-src.zip"))
216 (sha256
217 (base32
218 "1017rd0wsjfyq2jvpjjhpszaa7kmig6q1nimw76qx3cjz2868lrn"))))
219 (build-system gnu-build-system)
220 (native-inputs
221 `(("unzip" ,unzip))) ; for unpacking the source
222 (arguments
223 `(#:make-flags '("CC=gcc")
224 #:tests? #f ; No test suite
225 #:phases
226 (modify-phases %standard-phases
227 (delete 'configure)
228 (add-after 'unpack 'enter-source
229 (lambda _ (chdir "build/gmake.unix") #t))
230 (replace 'install
231 (lambda* (#:key outputs #:allow-other-keys)
232 (install-file "../../bin/release/premake4"
233 (string-append (assoc-ref outputs "out") "/bin"))
234 #t)))))
235 (synopsis "Portable software build tool")
236 (description "@code{premake4} is a command line utility that reads a
237 scripted definition of a software project and outputs @file{Makefile}s or
238 other lower-level build files.")
239 (home-page "https://premake.github.io")
240 (license license:bsd-3)))
241
242 (define-public osc
243 (package
244 (name "osc")
245 (version "0.165.2")
246 (source
247 (origin
248 (method git-fetch)
249 (uri (git-reference
250 (url "https://github.com/openSUSE/osc")
251 (commit version)))
252 (file-name (git-file-name name version))
253 (sha256
254 (base32 "0yjwvbvv9fgkpiyvrag89zxchyn3nbgp9jz0wn5p0z9450zwfyz6"))))
255 (build-system python-build-system)
256 (arguments
257 `(#:phases
258 (modify-phases %standard-phases
259 (add-after 'install 'fix-filename
260 (lambda* (#:key outputs #:allow-other-keys)
261 (let ((bin (string-append (assoc-ref outputs "out") "/bin/")))
262 ;; Main osc tool is renamed in spec file, not setup.py, let's
263 ;; do that too.
264 (rename-file
265 (string-append bin "osc-wrapper.py")
266 (string-append bin "osc"))
267 #t))))))
268 (inputs
269 `(("python-m2crypto" ,python-m2crypto)
270 ("python-pycurl" ,python-pycurl)
271 ("rpm" ,rpm))) ; for python-rpm
272 (home-page "https://github.com/openSUSE/osc")
273 (synopsis "Open Build Service command line tool")
274 (description "@command{osc} is a command line interface to the Open Build
275 Service. It allows you to checkout, commit, perform reviews etc. The vast
276 majority of the OBS functionality is available via commands and the rest can
277 be reached via direct API calls.")
278 (license license:gpl2+)))