Merge remote-tracking branch 'origin/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 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 ;;;
9 ;;; This file is part of GNU Guix.
10 ;;;
11 ;;; GNU Guix is free software; you can redistribute it and/or modify it
12 ;;; under the terms of the GNU General Public License as published by
13 ;;; the Free Software Foundation; either version 3 of the License, or (at
14 ;;; your option) any later version.
15 ;;;
16 ;;; GNU Guix is distributed in the hope that it will be useful, but
17 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;;; GNU General Public License for more details.
20 ;;;
21 ;;; You should have received a copy of the GNU General Public License
22 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
23
24 (define-module (gnu packages build-tools)
25 #:use-module ((guix licenses) #:prefix license:)
26 #:use-module (guix utils)
27 #:use-module (guix packages)
28 #:use-module (guix download)
29 #:use-module (guix git-download)
30 #:use-module (guix build-system cmake)
31 #:use-module (gnu packages)
32 #:use-module (gnu packages compression)
33 #:use-module (gnu packages python)
34 #:use-module (gnu packages python-crypto)
35 #:use-module (gnu packages python-web)
36 #:use-module (gnu packages ninja)
37 #:use-module (guix build-system gnu)
38 #:use-module (guix build-system python))
39
40 (define-public bam
41 (package
42 (name "bam")
43 (version "0.4.0")
44 (source (origin
45 (method url-fetch)
46 (uri (string-append "http://github.com/downloads/matricks/"
47 "bam/bam-" version ".tar.bz2"))
48 (sha256
49 (base32
50 "0z90wvyd4nfl7mybdrv9dsd4caaikc6fxw801b72gqi1m9q0c0sn"))))
51 (build-system gnu-build-system)
52 (arguments
53 `(#:phases
54 (modify-phases %standard-phases
55 (delete 'configure)
56 (replace 'build
57 (lambda _
58 (zero? (system* "bash" "make_unix.sh"))))
59 (replace 'check
60 (lambda _
61 (zero? (system* "python" "scripts/test.py"))))
62 (replace 'install
63 (lambda* (#:key outputs #:allow-other-keys)
64 (let ((bin (string-append (assoc-ref outputs "out") "/bin")))
65 (mkdir-p bin)
66 (install-file "bam" bin)
67 #t))))))
68 (native-inputs
69 `(("python" ,python-2)))
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.12")
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 "1zzz2yiiny9pm4h6ayb82xzxc2j5djcpf8va2wagcw92m7w6miqw"))))
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 "f73698ebb33e26a0bf120e2b55d12528fd1dbe7d")
104 (revision "1481")) ;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 "078ydwak4424bkqh3hd7q955zxp2c3qlw44lsb29i8jqap140f9d"))
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 #t))
125 (replace 'configure
126 (lambda _
127 (invoke "python" "build/gen.py" "--no-sysroot"
128 "--no-last-commit-position")))
129 (add-after 'configure 'create-last-commit-position
130 (lambda _
131 ;; Create "last_commit_position.h" to avoid a dependency
132 ;; on 'git' (and the checkout..).
133 (call-with-output-file "out/last_commit_position.h"
134 (lambda (port)
135 (format port
136 "#define LAST_COMMIT_POSITION \"~a (~a)\"\n"
137 ,revision ,(string-take commit 8))
138 #t))))
139 (replace 'build
140 (lambda _
141 (invoke "ninja" "-C" "out" "gn"
142 "-j" (number->string (parallel-job-count)))))
143 (replace 'install
144 (lambda* (#:key outputs #:allow-other-keys)
145 (let ((out (assoc-ref outputs "out")))
146 (install-file "out/gn" (string-append out "/bin"))
147 #t))))))
148 (native-inputs
149 `(("ninja" ,ninja)
150 ("python" ,python-2)))
151 (synopsis "Generate Ninja build files")
152 (description
153 "GN is a tool that collects information about a project from @file{.gn}
154 files and generates build instructions for the Ninja build system.")
155 ;; GN is distributed as BSD-3, but bundles some files from ICU using the
156 ;; X11 license.
157 (license (list license:bsd-3 license:x11)))))
158
159 (define-public meson
160 (package
161 (name "meson")
162 (version "0.47.2")
163 (source (origin
164 (method url-fetch)
165 (uri (string-append "https://github.com/mesonbuild/meson/"
166 "releases/download/" version "/meson-"
167 version ".tar.gz"))
168 (sha256
169 (base32
170 "1swmycf6p9p0ag6yiywyyri42ffkxxj38r2ic7in24km47cszn4j"))))
171 (build-system python-build-system)
172 (arguments
173 `(;; FIXME: Tests require many additional inputs, a fix for the RUNPATH
174 ;; patch in meson-for-build, and patching many hard-coded file system
175 ;; locations in "run_unittests.py".
176 #:tests? #f
177 #:phases (modify-phases %standard-phases
178 ;; Meson calls the various executables in out/bin through the
179 ;; Python interpreter, so we cannot use the shell wrapper.
180 (delete 'wrap))))
181 (inputs `(("ninja" ,ninja)))
182 (propagated-inputs `(("python" ,python)))
183 (home-page "https://mesonbuild.com/")
184 (synopsis "Build system designed to be fast and user-friendly")
185 (description
186 "The Meson build system is focused on user-friendliness and speed.
187 It can compile code written in C, C++, Fortran, Java, Rust, and other
188 languages. Meson provides features comparable to those of the
189 Autoconf/Automake/make combo. Build specifications, also known as @dfn{Meson
190 files}, are written in a custom domain-specific language (@dfn{DSL}) that
191 resembles Python.")
192 (license license:asl2.0)))
193
194 (define-public meson-for-build
195 (package
196 (inherit meson)
197 (name "meson-for-build")
198 (source (origin
199 (inherit (package-source meson))
200 (patches (search-patches "meson-for-build-rpath.patch"))))
201
202 ;; People should probably install "meson", not "meson-for-build".
203 (properties `((hidden? . #t)))))
204
205 (define-public premake4
206 (package
207 (name "premake")
208 (version "4.3")
209 (source (origin
210 (method url-fetch)
211 (uri (string-append "mirror://sourceforge/premake/Premake/"
212 version "/premake-" version "-src.zip"))
213 (sha256
214 (base32
215 "1017rd0wsjfyq2jvpjjhpszaa7kmig6q1nimw76qx3cjz2868lrn"))))
216 (build-system gnu-build-system)
217 (native-inputs
218 `(("unzip" ,unzip))) ; for unpacking the source
219 (arguments
220 `(#:make-flags '("CC=gcc")
221 #:tests? #f ; No test suite
222 #:phases
223 (modify-phases %standard-phases
224 (delete 'configure)
225 (add-after 'unpack 'enter-source
226 (lambda _ (chdir "build/gmake.unix") #t))
227 (replace 'install
228 (lambda* (#:key outputs #:allow-other-keys)
229 (install-file "../../bin/release/premake4"
230 (string-append (assoc-ref outputs "out") "/bin"))
231 #t)))))
232 (synopsis "Portable software build tool")
233 (description "@code{premake4} is a command line utility that reads a
234 scripted definition of a software project and outputs @file{Makefile}s or
235 other lower-level build files.")
236 (home-page "https://premake.github.io")
237 (license license:bsd-3)))
238
239 (define-public osc
240 (package
241 (name "osc")
242 (version "0.162.1")
243 (source
244 (origin
245 (method url-fetch)
246 (uri (string-append "https://github.com/openSUSE/" name
247 "/archive/" version ".tar.gz"))
248 (file-name (string-append name "-" version ".tar.gz"))
249 (sha256
250 (base32 "0b4kpm96ns4smqyfjysbk2p78d36x44xprpna8zz85q1y5xn57aj"))))
251 (build-system python-build-system)
252 (arguments
253 `(#:python ,python-2 ; Module is python2 only.
254 #:phases
255 (modify-phases %standard-phases
256 (add-after 'install 'fix-filename-and-remove-unused
257 (lambda* (#:key outputs #:allow-other-keys)
258 (let ((bin (string-append (assoc-ref outputs "out") "/bin/")))
259 ;; Main osc tool is renamed in spec file, not setup.py, let's
260 ;; do that too.
261 (rename-file
262 (string-append bin "osc-wrapper.py")
263 (string-append bin "osc"))
264 ;; Remove unused and broken script.
265 (delete-file (string-append bin "osc_hotshot.py"))
266 #t))))))
267 (inputs
268 `(("python2-m2crypto" ,python2-m2crypto)
269 ("python2-pycurl" ,python2-pycurl)
270 ("python2-urlgrabber" ,python2-urlgrabber)))
271 (home-page "https://github.com/openSUSE/osc")
272 (synopsis "Open Build Service command line tool")
273 (description "@command{osc} is a command line interface to the Open Build
274 Service. It allows you to checkout, commit, perform reviews etc. The vast
275 majority of the OBS functionality is available via commands and the rest can
276 be reached via direct API calls.")
277 (license license:gpl2+)))