gnu: igt-gpu-tools: Don't use NAME in source URI.
[jackhill/guix/guix.git] / gnu / packages / dlang.scm
CommitLineData
a7ec569c 1;;; GNU Guix --- Functional package management for GNU
c1fc7a67 2;;; Copyright © 2015, 2016 Roel Janssen <roel@gnu.org>
633e8aab 3;;; Copyright © 2015, 2018 Pjotr Prins <pjotr.guix@thebird.nl>
2429dde5 4;;; Copyright © 2017 Frederick Muriithi <fredmanglis@gmail.com>
538bce24 5;;; Copyright © 2017 Ricardo Wurmus <rekado@elephly.net>
27a5c604 6;;; Copyright © 2017 Tobias Geerinckx-Rice <me@tobias.gr>
a7ec569c
RJ
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
98d6543f 23(define-module (gnu packages dlang)
a7ec569c
RJ
24 #:use-module ((guix licenses) #:prefix license:)
25 #:use-module (guix packages)
26 #:use-module (guix download)
c1fc7a67
RJ
27 #:use-module (guix git-download)
28 #:use-module (guix build-system gnu)
a7ec569c
RJ
29 #:use-module (guix build-system cmake)
30 #:use-module (gnu packages)
31 #:use-module (gnu packages base)
ac257f12 32 #:use-module (gnu packages check)
812b3c1f 33 #:use-module (gnu packages compression)
4fdcc502 34 #:use-module (gnu packages curl)
2429dde5 35 #:use-module (gnu packages gdb)
a7ec569c
RJ
36 #:use-module (gnu packages libedit)
37 #:use-module (gnu packages llvm)
0959478c 38 #:use-module (gnu packages python)
44d10b1f 39 #:use-module (gnu packages python-xyz)
148585c2 40 #:use-module (gnu packages textutils))
a7ec569c 41
c1fc7a67 42(define-public rdmd
55330714
DM
43 (package
44 (name "rdmd")
1b541c3e 45 (version "2.077.1")
55330714
DM
46 (source (origin
47 (method url-fetch)
48 (uri (string-append "https://github.com/dlang/tools/archive/v" version ".tar.gz"))
49 (file-name (string-append name "-" version ".tar.gz"))
50 (sha256
51 (base32
1b541c3e 52 "0c8w373rv6iz3xfid94w40ncv2lr2ncxi662qsr4lda4aghczmq7"))))
55330714
DM
53 (build-system gnu-build-system)
54 (arguments
55 '(#:phases
56 (modify-phases %standard-phases
57 (delete 'configure)
58 (delete 'check) ; There is no Makefile, so there's no 'make check'.
59 (replace
60 'build
61 (lambda _
12479d58 62 (invoke "ldc2" "rdmd.d")))
55330714
DM
63 (replace
64 'install
65 (lambda* (#:key outputs #:allow-other-keys)
66 (let ((bin (string-append (assoc-ref outputs "out") "/bin")))
67 (install-file "rdmd" bin)))))))
68 (native-inputs
69 `(("ldc" ,ldc)))
70 (home-page "https://github.com/D-Programming-Language/tools/")
71 (synopsis "Specialized equivalent to 'make' for the D language")
72 (description
73 "rdmd is a companion to the dmd compiler that simplifies the typical
c1fc7a67
RJ
74edit-compile-link-run or edit-make-run cycle to a rapid edit-run cycle. Like
75make and other tools, rdmd uses the relative dates of the files involved to
76minimize the amount of work necessary. Unlike make, rdmd tracks dependencies
77and freshness without requiring additional information from the user.")
55330714 78 (license license:boost1.0)))
c1fc7a67 79
beffaf9a 80(define-public ldc-bootstrap
5144c044
DM
81 (package
82 (name "ldc")
83 (version "0.17.4")
84 (source (origin
85 (method url-fetch)
86 (uri (string-append
87 "https://github.com/ldc-developers/ldc/archive/v"
88 version ".tar.gz"))
89 (file-name (string-append name "-" version ".tar.gz"))
90 (sha256
91 (base32
92 "1kw0j378k6bh0k66dvx99bjq8ilp8bb24w3jrmibn8rhmqv0d5q8"))))
93 (build-system cmake-build-system)
94 (supported-systems '("x86_64-linux" "i686-linux" "armhf-linux"))
1b541c3e
PP
95 (properties
96 ;; Some of the tests take a very long time on ARMv7. See
97 ;; <https://lists.gnu.org/archive/html/guix-devel/2018-02/msg00312.html>.
98 `((max-silent-time . ,(* 3600 3))))
5144c044
DM
99 (arguments
100 `(#:phases
101 (modify-phases %standard-phases
102 (add-after 'unpack 'unpack-submodule-sources
103 (lambda* (#:key inputs #:allow-other-keys)
104 (let ((unpack (lambda (source target)
105 (with-directory-excursion target
106 (zero? (system* "tar" "xvf"
107 (assoc-ref inputs source)
108 "--strip-components=1"))))))
109 (and (unpack "phobos-src" "runtime/phobos")
110 (unpack "druntime-src" "runtime/druntime")
111 (unpack "dmd-testsuite-src" "tests/d2/dmd-testsuite")))))
112 (add-after 'unpack-submodule-sources 'patch-dmd2
113 (lambda* (#:key inputs #:allow-other-keys)
114 (substitute* "dmd2/root/port.c"
115 ((" ::isnan") " isnan")
116 ((" ::isinf") " isinf")
117 (("#undef isnan") "")
118 (("#undef isinf") ""))
119 #t))
120 (add-after 'unpack-submodule-sources 'patch-phobos
121 (lambda* (#:key inputs #:allow-other-keys)
122 (substitute* "runtime/phobos/std/process.d"
123 (("/bin/sh") (which "sh"))
124 (("echo") (which "echo")))
125 (substitute* "runtime/phobos/std/datetime.d"
126 (("/usr/share/zoneinfo/")
1b541c3e
PP
127 (string-append (assoc-ref inputs "tzdata") "/share/zoneinfo"))
128 (("tzName == \"[+]VERSION\"")
129 "(tzName == \"+VERSION\" || std.algorithm.endsWith(tzName, \"/leapseconds\"))"))
5144c044
DM
130 (substitute* "tests/d2/dmd-testsuite/Makefile"
131 (("/bin/bash") (which "bash")))
132 ;; FIXME: this test cannot be linked.
133 (delete-file "tests/d2/dmd-testsuite/runnable/cppa.d")
1b541c3e
PP
134 ;; the following two tests fail on i686
135 (for-each delete-file '("tests/ir/attributes.d" "tests/ir/align.d")))))))
5144c044
DM
136 (inputs
137 `(("libconfig" ,libconfig)
138 ("libedit" ,libedit)
139 ("tzdata" ,tzdata)
140 ("zlib" ,zlib)))
141 (native-inputs
67b5785e
MB
142 `(("llvm" ,llvm-3.8)
143 ("clang" ,clang-3.8)
5144c044
DM
144 ("python-lit" ,python-lit)
145 ("python-wrapper" ,python-wrapper)
146 ("unzip" ,unzip)
147 ("phobos-src"
148 ,(origin
149 (method url-fetch)
150 (uri (string-append
151 "https://github.com/ldc-developers/phobos/archive/ldc-v"
1b541c3e 152 version ".tar.gz"))
5144c044
DM
153 (sha256
154 (base32
1b541c3e
PP
155 "16x36kp46mqiihxx7jvr1d3mv3b96yfmhinb9lzinh2m4clr85wz"))
156 (patches (search-patches "ldc-bootstrap-disable-tests.patch"))))
5144c044
DM
157 ("druntime-src"
158 ,(origin
159 (method url-fetch)
160 (uri (string-append
161 "https://github.com/ldc-developers/druntime/archive/ldc-v"
1b541c3e 162 version ".tar.gz"))
5144c044
DM
163 (sha256
164 (base32
1b541c3e 165 "0iw2xxhcbsc5f1707dgdzhff528363l4faqdk513gaxs2dhfx8vx"))))
5144c044
DM
166 ("dmd-testsuite-src"
167 ,(origin
168 (method url-fetch)
169 (uri (string-append
170 "https://github.com/ldc-developers/dmd-testsuite/archive/ldc-v"
1b541c3e 171 version ".tar.gz"))
5144c044
DM
172 (sha256
173 (base32
1b541c3e 174 "0z6ch930wjkg2vlnqkbliwxxxifad6ydsdpwdxwnajkb2kaxsjx4"))))))
5144c044 175 (home-page "http://wiki.dlang.org/LDC")
633e8aab 176 (synopsis "LLVM-based compiler for the D programming language")
5144c044 177 (description
633e8aab 178 "LDC is an LLVM compiler for the D programming language. It is based on
1b541c3e
PP
179the latest DMD compiler that was written in C and is used for
180bootstrapping more recent compilers written in D.")
5144c044
DM
181 ;; Most of the code is released under BSD-3, except for code originally
182 ;; written for GDC, which is released under GPLv2+, and the DMD frontend,
183 ;; which is released under the "Boost Software License version 1.0".
184 (license (list license:bsd-3
185 license:gpl2+
1b541c3e 186 license:boost1.0))))
2429dde5 187
836cbd9f 188(define-public ldc
1b541c3e
PP
189 ;; Phobos, druntime and dmd-testsuite library dependencies do
190 ;; not always have a newer release than the compiler, hence we
191 ;; retain this variable.
633e8aab 192 (let ((older-version "1.10.0")) ;; retain this because sometimes the libs are older
2429dde5 193 (package
beffaf9a 194 (inherit ldc-bootstrap)
2429dde5 195 (name "ldc")
633e8aab 196 (version "1.10.0")
2429dde5
MFM
197 (source (origin
198 (method url-fetch)
199 (uri (string-append
200 "https://github.com/ldc-developers/ldc/archive/v"
201 version ".tar.gz"))
202 (file-name (string-append name "-" version ".tar.gz"))
203 (sha256
204 (base32
633e8aab 205 "16b1h9kwfggjw6ykc6sfs26ak6vypylsx9wmvp5m6x3cvi6g70yi"))))
2429dde5
MFM
206 (arguments
207 `(#:phases
208 (modify-phases %standard-phases
209 (add-after 'unpack 'unpack-submodule-sources
210 (lambda* (#:key inputs #:allow-other-keys)
211 (let ((unpack (lambda (source target)
212 (with-directory-excursion target
213 (zero? (system* "tar" "xvf"
214 (assoc-ref inputs source)
215 "--strip-components=1"))))))
216 (and (unpack "phobos-src" "runtime/phobos")
217 (unpack "druntime-src" "runtime/druntime")
218 (unpack "dmd-testsuite-src" "tests/d2/dmd-testsuite")))))
2429dde5
MFM
219 (add-after 'unpack-submodule-sources 'patch-phobos
220 (lambda* (#:key inputs #:allow-other-keys)
1b541c3e
PP
221 (substitute* '("runtime/phobos/std/process.d"
222 "tests/linking/linker_switches.d")
2429dde5
MFM
223 (("/bin/sh") (which "sh"))
224 (("echo") (which "echo")))
2429dde5 225 (substitute* "tests/d2/dmd-testsuite/Makefile"
1b541c3e
PP
226 (("/bin/bash") (which "bash")))
227 ;; disable unittests in the following files. We are discussing with
228 ;; upstream
229 (substitute* '("runtime/phobos/std/net/curl.d"
230 "runtime/phobos/std/datetime/systime.d"
231 "runtime/phobos/std/datetime/timezone.d"
232 )
233 (("version(unittest)") "version(skipunittest)")
234 ((" unittest") " version(skipunittest) unittest"))
235 ;; the following tests require a more recent LLVM
236 (delete-file "tests/compilable/ctfe_math.d")
237 (delete-file "tests/debuginfo/nested_gdb.d")
238 (delete-file "tests/debuginfo/classtypes_gdb.d")
633e8aab
PP
239 ;; the following tests plugins we don't have.
240 (delete-file "tests/plugins/addFuncEntryCall/testPlugin.d")
781d721a 241 ;; the following tests requires AVX instruction set in the CPU.
1b541c3e
PP
242 (substitute* "tests/d2/dmd-testsuite/runnable/test_cdvecfill.d"
243 (("^// DISABLED: ") "^// DISABLED: linux64 "))
244 #t))
245 (replace 'check
246 (lambda* (#:key inputs outputs #:allow-other-keys)
247 ;; some tests call into gdb binary which needs SHELL and CC set
248 (setenv "SHELL" (which "sh"))
249 (setenv "CC" (string-append (assoc-ref inputs "gcc") "/bin/gcc"))
250 (invoke "make" "test" "-j" (number->string (parallel-job-count))))))))
2429dde5 251 (native-inputs
633e8aab
PP
252 `(("llvm" ,llvm)
253 ("clang" ,clang)
beffaf9a 254 ("ldc" ,ldc-bootstrap)
2429dde5
MFM
255 ("python-lit" ,python-lit)
256 ("python-wrapper" ,python-wrapper)
257 ("unzip" ,unzip)
258 ("gdb" ,gdb)
259 ("phobos-src"
260 ,(origin
261 (method url-fetch)
262 (uri (string-append
263 "https://github.com/ldc-developers/phobos/archive/ldc-v"
264 older-version ".tar.gz"))
265 (sha256
266 (base32
633e8aab 267 "0cpmrww00xf1qx38bcc22rr05qw41p00p45yb5fbwnfaccfwdn0s"))
2429dde5
MFM
268 ;; This patch deactivates some tests that depend on network access
269 ;; to pass. It also deactivates some tests that have some reliance
270 ;; on timezone.
271 ;;
272 ;; For the network tests, there's an effort to get a version flag
273 ;; added to deactivate these tests for distribution packagers
274 ;; that is being pursued at
275 ;; <https://forum.dlang.org/post/zmdbdgnzrxyvtpqafvyg@forum.dlang.org>.
276 ;; It also deactivates a test that requires /root
633e8aab 277 (patches (search-patches "ldc-disable-phobos-tests.patch"))))
2429dde5
MFM
278 ("druntime-src"
279 ,(origin
280 (method url-fetch)
281 (uri (string-append
282 "https://github.com/ldc-developers/druntime/archive/ldc-v"
283 older-version ".tar.gz"))
284 (sha256
285 (base32
633e8aab 286 "1akh2vdi98jih8642yjbvv2vavxzrmq24kz8i3kfidg5ndqyv222"))))
2429dde5
MFM
287 ("dmd-testsuite-src"
288 ,(origin
289 (method url-fetch)
290 (uri (string-append
291 "https://github.com/ldc-developers/dmd-testsuite/archive/ldc-v"
292 older-version ".tar.gz"))
293 (sha256
294 (base32
633e8aab 295 "0z5x07qrbkpksshaymp11ir6jlmg9wjicxn6zhp8cya6i1ha9p99")))))))))
4fdcc502
DM
296
297(define-public dub
298 (package
299 (name "dub")
1b541c3e 300 (version "1.7.2")
4fdcc502
DM
301 (source (origin
302 (method url-fetch)
303 (uri (string-append "https://github.com/dlang/dub/archive/"
304 "v" version ".tar.gz"))
305 (file-name (string-append name "-" version ".tar.gz"))
306 (sha256
307 (base32
1b541c3e 308 "1jvr1mmq8j77wnsrsg7x2xv8yfljqd6x8gn6yy7dd6h6y3cf408q"))))
4fdcc502
DM
309 (build-system gnu-build-system)
310 (arguments
311 `(#:tests? #f ; it would have tested itself by installing some packages (vibe etc)
312 #:phases
313 (modify-phases %standard-phases
cd12f922 314 (delete 'configure) ; no configure script
4fdcc502
DM
315 (replace 'build
316 (lambda _
a4960a20 317 (invoke "./build.sh")))
4fdcc502
DM
318 (replace 'install
319 (lambda* (#:key outputs #:allow-other-keys)
320 (let* ((out (assoc-ref outputs "out"))
cd12f922
TGR
321 (bin (string-append out "/bin")))
322 (install-file "bin/dub" bin)
4fdcc502
DM
323 #t))))))
324 (inputs
325 `(("curl" ,curl)))
326 (native-inputs
327 `(("ldc" ,ldc)))
328 (home-page "https://code.dlang.org/getting_started")
27a5c604
TGR
329 (synopsis "Package and build manager for D projects")
330 (description
1b541c3e
PP
331 "DUB is a package and build manager for applications and
332libraries written in the D programming language. It can
333automatically retrieve a project's dependencies and integrate
334them in the build process.
27a5c604 335
1b541c3e
PP
336The design emphasis is on maximum simplicity for simple projects,
337while providing the opportunity to customize things when
338needed.")
4fdcc502 339 (license license:expat)))