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