gnu: dealii: Update to 8.5.0.
[jackhill/guix/guix.git] / gnu / packages / ldc.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2015, 2016 Roel Janssen <roel@gnu.org>
3 ;;; Copyright © 2015 Pjotr Prins <pjotr.guix@thebird.nl>
4 ;;; Copyright © 2017 Frederick Muriithi <fredmanglis@gmail.com>
5 ;;; Copyright © 2017 Ricardo Wurmus <rekado@elephly.net>
6 ;;; Copyright © 2017 Tobias Geerinckx-Rice <me@tobias.gr>
7 ;;;
8 ;;; This file is part of GNU Guix.
9 ;;;
10 ;;; GNU Guix is free software; you can redistribute it and/or modify it
11 ;;; under the terms of the GNU General Public License as published by
12 ;;; the Free Software Foundation; either version 3 of the License, or (at
13 ;;; your option) any later version.
14 ;;;
15 ;;; GNU Guix is distributed in the hope that it will be useful, but
16 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;;; GNU General Public License for more details.
19 ;;;
20 ;;; You should have received a copy of the GNU General Public License
21 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
22
23 (define-module (gnu packages ldc)
24 #:use-module ((guix licenses) #:prefix license:)
25 #:use-module (guix packages)
26 #:use-module (guix download)
27 #:use-module (guix git-download)
28 #:use-module (guix build-system gnu)
29 #:use-module (guix build-system cmake)
30 #:use-module (gnu packages)
31 #:use-module (gnu packages base)
32 #:use-module (gnu packages compression)
33 #:use-module (gnu packages curl)
34 #:use-module (gnu packages gdb)
35 #:use-module (gnu packages libedit)
36 #:use-module (gnu packages llvm)
37 #:use-module (gnu packages python)
38 #:use-module (gnu packages textutils))
39
40 (define-public rdmd
41 (package
42 (name "rdmd")
43 (version "2.073.0")
44 (source (origin
45 (method url-fetch)
46 (uri (string-append "https://github.com/dlang/tools/archive/v" version ".tar.gz"))
47 (file-name (string-append name "-" version ".tar.gz"))
48 (sha256
49 (base32
50 "01if3ivnb7g2myfhymp4d9346s4vmvcl82i1kxfs5iza45almh7v"))))
51 (build-system gnu-build-system)
52 (arguments
53 '(#:phases
54 (modify-phases %standard-phases
55 (delete 'configure)
56 (delete 'check) ; There is no Makefile, so there's no 'make check'.
57 (replace
58 'build
59 (lambda _
60 (zero? (system* "ldc2" "rdmd.d"))))
61 (replace
62 'install
63 (lambda* (#:key outputs #:allow-other-keys)
64 (let ((bin (string-append (assoc-ref outputs "out") "/bin")))
65 (install-file "rdmd" bin)))))))
66 (native-inputs
67 `(("ldc" ,ldc)))
68 (home-page "https://github.com/D-Programming-Language/tools/")
69 (synopsis "Specialized equivalent to 'make' for the D language")
70 (description
71 "rdmd is a companion to the dmd compiler that simplifies the typical
72 edit-compile-link-run or edit-make-run cycle to a rapid edit-run cycle. Like
73 make and other tools, rdmd uses the relative dates of the files involved to
74 minimize the amount of work necessary. Unlike make, rdmd tracks dependencies
75 and freshness without requiring additional information from the user.")
76 (license license:boost1.0)))
77
78 (define-public ldc-bootstrap
79 (let ((runtime-version "0.17.3"))
80 (package
81 (name "ldc")
82 (version "0.17.4")
83 (source (origin
84 (method url-fetch)
85 (uri (string-append
86 "https://github.com/ldc-developers/ldc/archive/v"
87 version ".tar.gz"))
88 (file-name (string-append name "-" version ".tar.gz"))
89 (sha256
90 (base32
91 "1kw0j378k6bh0k66dvx99bjq8ilp8bb24w3jrmibn8rhmqv0d5q8"))))
92 (build-system cmake-build-system)
93 (supported-systems '("x86_64-linux" "i686-linux" "armhf-linux"))
94 (arguments
95 `(#:phases
96 (modify-phases %standard-phases
97 (add-after 'unpack 'unpack-submodule-sources
98 (lambda* (#:key inputs #:allow-other-keys)
99 (let ((unpack (lambda (source target)
100 (with-directory-excursion target
101 (zero? (system* "tar" "xvf"
102 (assoc-ref inputs source)
103 "--strip-components=1"))))))
104 (and (unpack "phobos-src" "runtime/phobos")
105 (unpack "druntime-src" "runtime/druntime")
106 (unpack "dmd-testsuite-src" "tests/d2/dmd-testsuite")))))
107 (add-after 'unpack-submodule-sources 'patch-dmd2
108 (lambda* (#:key inputs #:allow-other-keys)
109 (substitute* "dmd2/root/port.c"
110 ((" ::isnan") " isnan")
111 ((" ::isinf") " isinf")
112 (("#undef isnan") "")
113 (("#undef isinf") ""))
114 #t))
115 (add-after 'unpack-submodule-sources 'patch-phobos
116 (lambda* (#:key inputs #:allow-other-keys)
117 (substitute* "runtime/phobos/std/process.d"
118 (("/bin/sh") (which "sh"))
119 (("echo") (which "echo")))
120 (substitute* "runtime/phobos/std/datetime.d"
121 (("/usr/share/zoneinfo/")
122 (string-append (assoc-ref inputs "tzdata") "/share/zoneinfo")))
123 (substitute* "tests/d2/dmd-testsuite/Makefile"
124 (("/bin/bash") (which "bash")))
125 ;; FIXME: this test cannot be linked.
126 (delete-file "tests/d2/dmd-testsuite/runnable/cppa.d")
127 #t)))))
128 (inputs
129 `(("libconfig" ,libconfig)
130 ("libedit" ,libedit)
131 ("tzdata" ,tzdata)
132 ("zlib" ,zlib)))
133 (native-inputs
134 `(("llvm" ,llvm)
135 ("clang" ,clang)
136 ("python-lit" ,python-lit)
137 ("python-wrapper" ,python-wrapper)
138 ("unzip" ,unzip)
139 ("phobos-src"
140 ,(origin
141 (method url-fetch)
142 (uri (string-append
143 "https://github.com/ldc-developers/phobos/archive/ldc-v"
144 runtime-version ".tar.gz"))
145 (sha256
146 (base32
147 "0qywnvnp019mmmr74aw90ir9f03iz0hc7cgzna609agsar0b27jl"))
148 (patches (search-patches "ldc-disable-tests.patch"))))
149 ("druntime-src"
150 ,(origin
151 (method url-fetch)
152 (uri (string-append
153 "https://github.com/ldc-developers/druntime/archive/ldc-v"
154 runtime-version ".tar.gz"))
155 (sha256
156 (base32
157 "0z418n6x2fxac07sxpi4rl69069qiym4w6r9sjppn91q58qh8hjs"))))
158 ("dmd-testsuite-src"
159 ,(origin
160 (method url-fetch)
161 (uri (string-append
162 "https://github.com/ldc-developers/dmd-testsuite/archive/ldc-v"
163 runtime-version ".tar.gz"))
164 (sha256
165 (base32
166 "196mkfax5y3yqm3gz7jhqhnkjwrvr2m4a8nc9k41l0511ldzsk9x"))))))
167 (home-page "http://wiki.dlang.org/LDC")
168 (synopsis "LLVM compiler for the D programming language")
169 (description
170 "LDC is a compiler for the D programming language. It is based on the
171 latest DMD frontend and uses LLVM as backend.")
172 ;; Most of the code is released under BSD-3, except for code originally
173 ;; written for GDC, which is released under GPLv2+, and the DMD frontend,
174 ;; which is released under the "Boost Software License version 1.0".
175 (license (list license:bsd-3
176 license:gpl2+
177 license:boost1.0)))))
178
179 (define-public ldc
180 ;; The phobos, druntime and dmd-testsuite dependencies do not have a newer
181 ;; release than 1.1.0-beta4, hence the need to make use of the older-version
182 ;; variable to hold this variable.
183 (let ((older-version "1.1.0"))
184 (package
185 (inherit ldc-bootstrap)
186 (name "ldc")
187 (version "1.1.1")
188 ;; Beta version needed to compile various scientific tools that require
189 ;; the newer beta versions, and won't compile successfully with the
190 ;; older stable version.
191 (source (origin
192 (method url-fetch)
193 (uri (string-append
194 "https://github.com/ldc-developers/ldc/archive/v"
195 version ".tar.gz"))
196 (file-name (string-append name "-" version ".tar.gz"))
197 (sha256
198 (base32
199 "0yjiwg8pnlm2286bwdkwasaqw6ys7lymrqvhh5xyb1adha1ndcav"))))
200 (arguments
201 `(#:phases
202 (modify-phases %standard-phases
203 (add-after 'unpack 'unpack-submodule-sources
204 (lambda* (#:key inputs #:allow-other-keys)
205 (let ((unpack (lambda (source target)
206 (with-directory-excursion target
207 (zero? (system* "tar" "xvf"
208 (assoc-ref inputs source)
209 "--strip-components=1"))))))
210 (and (unpack "phobos-src" "runtime/phobos")
211 (unpack "druntime-src" "runtime/druntime")
212 (unpack "dmd-testsuite-src" "tests/d2/dmd-testsuite")))))
213 ;; The 'patch-dmd2 step in ldc causes the build to fail since
214 ;; dmd2/root/port.c no longer exists. Arguments needed to have
215 ;; 'patch-dmd2 step removed, but retain everything else.
216 (add-after 'unpack-submodule-sources 'patch-phobos
217 (lambda* (#:key inputs #:allow-other-keys)
218 (substitute* "runtime/phobos/std/process.d"
219 (("/bin/sh") (which "sh"))
220 (("echo") (which "echo")))
221 (substitute* "runtime/phobos/std/datetime.d"
222 (("/usr/share/zoneinfo/")
223 (string-append (assoc-ref inputs "tzdata") "/share/zoneinfo")))
224 (substitute* "tests/d2/dmd-testsuite/Makefile"
225 (("/bin/bash") (which "bash")))
226 #t)))))
227 (native-inputs
228 `(("llvm" ,llvm)
229 ("clang" ,clang)
230 ("ldc" ,ldc-bootstrap)
231 ("python-lit" ,python-lit)
232 ("python-wrapper" ,python-wrapper)
233 ("unzip" ,unzip)
234 ("gdb" ,gdb)
235 ("phobos-src"
236 ,(origin
237 (method url-fetch)
238 (uri (string-append
239 "https://github.com/ldc-developers/phobos/archive/ldc-v"
240 older-version ".tar.gz"))
241 (sha256
242 (base32
243 "0z5v55b9s1ppf0c2ivjq7sbmq688c37c92ihc3qwrbxnqvkkvrlk"))
244 ;; This patch deactivates some tests that depend on network access
245 ;; to pass. It also deactivates some tests that have some reliance
246 ;; on timezone.
247 ;;
248 ;; For the network tests, there's an effort to get a version flag
249 ;; added to deactivate these tests for distribution packagers
250 ;; that is being pursued at
251 ;; <https://forum.dlang.org/post/zmdbdgnzrxyvtpqafvyg@forum.dlang.org>.
252 ;; It also deactivates a test that requires /root
253 (patches (search-patches "ldc-1.1.0-disable-phobos-tests.patch"))))
254 ("druntime-src"
255 ,(origin
256 (method url-fetch)
257 (uri (string-append
258 "https://github.com/ldc-developers/druntime/archive/ldc-v"
259 older-version ".tar.gz"))
260 (sha256
261 (base32
262 "07qvrqj6vgakd6qr4x5f70w6zwkzd1li5x8i1b5ywnds1z5lnfp6"))))
263 ("dmd-testsuite-src"
264 ,(origin
265 (method url-fetch)
266 (uri (string-append
267 "https://github.com/ldc-developers/dmd-testsuite/archive/ldc-v"
268 older-version ".tar.gz"))
269 (sha256
270 (base32
271 "12cak7yqmsgjlflx0dp6fwmwb9dac25amgi86n0bb95ard3547wy"))
272 ;; Remove the gdb tests that fails with a "Error: No such file or
273 ;; directory" error, despite the files being present in the debug
274 ;; files left with the --keep-failed flag to guix build.
275 (patches (search-patches "ldc-1.1.0-disable-dmd-tests.patch")))))))))
276
277 (define-public ldc-beta ldc)
278
279 (define-public dub
280 (package
281 (name "dub")
282 (version "1.4.0")
283 (source (origin
284 (method url-fetch)
285 (uri (string-append "https://github.com/dlang/dub/archive/"
286 "v" version ".tar.gz"))
287 (file-name (string-append name "-" version ".tar.gz"))
288 (sha256
289 (base32
290 "1w3pznyjnmsmasrvv93f82l0sr31fpwg2zcj8hh1b2gvc5761qhi"))))
291 (build-system gnu-build-system)
292 (arguments
293 `(#:tests? #f ; it would have tested itself by installing some packages (vibe etc)
294 #:phases
295 (modify-phases %standard-phases
296 (delete 'configure) ; no configure script
297 (replace 'build
298 (lambda _
299 (zero? (system* "./build.sh"))))
300 (replace 'install
301 (lambda* (#:key outputs #:allow-other-keys)
302 (let* ((out (assoc-ref outputs "out"))
303 (bin (string-append out "/bin")))
304 (install-file "bin/dub" bin)
305 #t))))))
306 (inputs
307 `(("curl" ,curl)))
308 (native-inputs
309 `(("ldc" ,ldc)))
310 (home-page "https://code.dlang.org/getting_started")
311 (synopsis "Package and build manager for D projects")
312 (description
313 "DUB is a package and build manager for applications and libraries written
314 in the D programming language. It can automatically retrieve a project's
315 dependencies and integrate them in the build process.
316
317 The design emphasis is on maximum simplicity for simple projects, while
318 providing the opportunity to customize things when needed. ")
319 (license license:expat)))