Commit | Line | Data |
---|---|---|
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> |
d57748e3 | 6 | ;;; Copyright © 2017, 2019 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 |
74 | edit-compile-link-run or edit-make-run cycle to a rapid edit-run cycle. Like |
75 | make and other tools, rdmd uses the relative dates of the files involved to | |
76 | minimize the amount of work necessary. Unlike make, rdmd tracks dependencies | |
77 | and 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") | |
d57748e3 TGR |
84 | (source |
85 | (origin | |
86 | (method git-fetch) | |
87 | (uri (git-reference | |
88 | (url "https://github.com/ldc-developers/ldc.git") | |
89 | (commit (string-append "v" version)))) | |
90 | (file-name (git-file-name name version)) | |
91 | (sha256 | |
92 | (base32 "0nnrjavfmpfp7bib04isqlxvyzh6mlvsdan0gxysdz96hlg4hcq8")))) | |
5144c044 DM |
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) | |
d57748e3 TGR |
104 | (let ((unpack (lambda (input target) |
105 | (let ((source (assoc-ref inputs input))) | |
106 | ;; Git checkouts are directories as long as | |
107 | ;; there are no patches; tarballs otherwise. | |
108 | (if (file-is-directory? source) | |
109 | (copy-recursively source target) | |
110 | (with-directory-excursion target | |
111 | (invoke "tar" "xvf" source | |
112 | "--strip-components=1"))))))) | |
4b81d5c4 RW |
113 | (unpack "phobos-src" "runtime/phobos") |
114 | (unpack "druntime-src" "runtime/druntime") | |
115 | (unpack "dmd-testsuite-src" "tests/d2/dmd-testsuite") | |
116 | #t))) | |
5144c044 DM |
117 | (add-after 'unpack-submodule-sources 'patch-dmd2 |
118 | (lambda* (#:key inputs #:allow-other-keys) | |
119 | (substitute* "dmd2/root/port.c" | |
120 | ((" ::isnan") " isnan") | |
121 | ((" ::isinf") " isinf") | |
122 | (("#undef isnan") "") | |
123 | (("#undef isinf") "")) | |
124 | #t)) | |
125 | (add-after 'unpack-submodule-sources 'patch-phobos | |
126 | (lambda* (#:key inputs #:allow-other-keys) | |
127 | (substitute* "runtime/phobos/std/process.d" | |
128 | (("/bin/sh") (which "sh")) | |
129 | (("echo") (which "echo"))) | |
130 | (substitute* "runtime/phobos/std/datetime.d" | |
131 | (("/usr/share/zoneinfo/") | |
1b541c3e PP |
132 | (string-append (assoc-ref inputs "tzdata") "/share/zoneinfo")) |
133 | (("tzName == \"[+]VERSION\"") | |
134 | "(tzName == \"+VERSION\" || std.algorithm.endsWith(tzName, \"/leapseconds\"))")) | |
5144c044 DM |
135 | (substitute* "tests/d2/dmd-testsuite/Makefile" |
136 | (("/bin/bash") (which "bash"))) | |
137 | ;; FIXME: this test cannot be linked. | |
138 | (delete-file "tests/d2/dmd-testsuite/runnable/cppa.d") | |
1b541c3e PP |
139 | ;; the following two tests fail on i686 |
140 | (for-each delete-file '("tests/ir/attributes.d" "tests/ir/align.d"))))))) | |
5144c044 DM |
141 | (inputs |
142 | `(("libconfig" ,libconfig) | |
143 | ("libedit" ,libedit) | |
144 | ("tzdata" ,tzdata) | |
145 | ("zlib" ,zlib))) | |
146 | (native-inputs | |
67b5785e MB |
147 | `(("llvm" ,llvm-3.8) |
148 | ("clang" ,clang-3.8) | |
5144c044 DM |
149 | ("python-lit" ,python-lit) |
150 | ("python-wrapper" ,python-wrapper) | |
151 | ("unzip" ,unzip) | |
152 | ("phobos-src" | |
153 | ,(origin | |
d57748e3 TGR |
154 | (method git-fetch) |
155 | (uri (git-reference | |
156 | (url "https://github.com/ldc-developers/phobos.git") | |
157 | (commit (string-append "ldc-v" version)))) | |
158 | (file-name (git-file-name "phobos" version)) | |
5144c044 | 159 | (sha256 |
d57748e3 | 160 | (base32 "0i7gh99w4mi0hdv16261jcdiqyv1nkjdcwy9prw32s0lvplx8fdy")) |
1b541c3e | 161 | (patches (search-patches "ldc-bootstrap-disable-tests.patch")))) |
5144c044 DM |
162 | ("druntime-src" |
163 | ,(origin | |
d57748e3 TGR |
164 | (method git-fetch) |
165 | (uri (git-reference | |
166 | (url "https://github.com/ldc-developers/druntime.git") | |
167 | (commit (string-append "ldc-v" version)))) | |
168 | (file-name (git-file-name "druntime" version)) | |
5144c044 | 169 | (sha256 |
d57748e3 | 170 | (base32 "0alabm3bbvs94msvxz5psiwk4f51cw9h82z1p5hhsnf8ja6d0am7")))) |
5144c044 DM |
171 | ("dmd-testsuite-src" |
172 | ,(origin | |
d57748e3 TGR |
173 | (method git-fetch) |
174 | (uri (git-reference | |
175 | (url "https://github.com/ldc-developers/dmd-testsuite.git") | |
176 | (commit (string-append "ldc-v" version)))) | |
177 | (file-name (git-file-name "dmd-testsuite" version)) | |
5144c044 | 178 | (sha256 |
d57748e3 | 179 | (base32 "05qr4cgb4scfqzbw1l5pk72kil074mvj9d55b165ljyr51sgwgbl")))))) |
5144c044 | 180 | (home-page "http://wiki.dlang.org/LDC") |
633e8aab | 181 | (synopsis "LLVM-based compiler for the D programming language") |
5144c044 | 182 | (description |
633e8aab | 183 | "LDC is an LLVM compiler for the D programming language. It is based on |
1b541c3e PP |
184 | the latest DMD compiler that was written in C and is used for |
185 | bootstrapping more recent compilers written in D.") | |
5144c044 DM |
186 | ;; Most of the code is released under BSD-3, except for code originally |
187 | ;; written for GDC, which is released under GPLv2+, and the DMD frontend, | |
188 | ;; which is released under the "Boost Software License version 1.0". | |
189 | (license (list license:bsd-3 | |
190 | license:gpl2+ | |
1b541c3e | 191 | license:boost1.0)))) |
2429dde5 | 192 | |
836cbd9f | 193 | (define-public ldc |
1b541c3e PP |
194 | ;; Phobos, druntime and dmd-testsuite library dependencies do |
195 | ;; not always have a newer release than the compiler, hence we | |
196 | ;; retain this variable. | |
633e8aab | 197 | (let ((older-version "1.10.0")) ;; retain this because sometimes the libs are older |
2429dde5 | 198 | (package |
beffaf9a | 199 | (inherit ldc-bootstrap) |
2429dde5 | 200 | (name "ldc") |
633e8aab | 201 | (version "1.10.0") |
2429dde5 MFM |
202 | (source (origin |
203 | (method url-fetch) | |
204 | (uri (string-append | |
205 | "https://github.com/ldc-developers/ldc/archive/v" | |
206 | version ".tar.gz")) | |
207 | (file-name (string-append name "-" version ".tar.gz")) | |
208 | (sha256 | |
209 | (base32 | |
633e8aab | 210 | "16b1h9kwfggjw6ykc6sfs26ak6vypylsx9wmvp5m6x3cvi6g70yi")))) |
2429dde5 MFM |
211 | (arguments |
212 | `(#:phases | |
213 | (modify-phases %standard-phases | |
214 | (add-after 'unpack 'unpack-submodule-sources | |
215 | (lambda* (#:key inputs #:allow-other-keys) | |
216 | (let ((unpack (lambda (source target) | |
217 | (with-directory-excursion target | |
68631e03 RW |
218 | (invoke "tar" "xvf" |
219 | (assoc-ref inputs source) | |
220 | "--strip-components=1"))))) | |
221 | (unpack "phobos-src" "runtime/phobos") | |
222 | (unpack "druntime-src" "runtime/druntime") | |
223 | (unpack "dmd-testsuite-src" "tests/d2/dmd-testsuite")))) | |
2429dde5 MFM |
224 | (add-after 'unpack-submodule-sources 'patch-phobos |
225 | (lambda* (#:key inputs #:allow-other-keys) | |
1b541c3e PP |
226 | (substitute* '("runtime/phobos/std/process.d" |
227 | "tests/linking/linker_switches.d") | |
2429dde5 MFM |
228 | (("/bin/sh") (which "sh")) |
229 | (("echo") (which "echo"))) | |
2429dde5 | 230 | (substitute* "tests/d2/dmd-testsuite/Makefile" |
1b541c3e PP |
231 | (("/bin/bash") (which "bash"))) |
232 | ;; disable unittests in the following files. We are discussing with | |
233 | ;; upstream | |
234 | (substitute* '("runtime/phobos/std/net/curl.d" | |
235 | "runtime/phobos/std/datetime/systime.d" | |
236 | "runtime/phobos/std/datetime/timezone.d" | |
237 | ) | |
238 | (("version(unittest)") "version(skipunittest)") | |
239 | ((" unittest") " version(skipunittest) unittest")) | |
240 | ;; the following tests require a more recent LLVM | |
241 | (delete-file "tests/compilable/ctfe_math.d") | |
242 | (delete-file "tests/debuginfo/nested_gdb.d") | |
243 | (delete-file "tests/debuginfo/classtypes_gdb.d") | |
633e8aab PP |
244 | ;; the following tests plugins we don't have. |
245 | (delete-file "tests/plugins/addFuncEntryCall/testPlugin.d") | |
781d721a | 246 | ;; the following tests requires AVX instruction set in the CPU. |
1b541c3e PP |
247 | (substitute* "tests/d2/dmd-testsuite/runnable/test_cdvecfill.d" |
248 | (("^// DISABLED: ") "^// DISABLED: linux64 ")) | |
249 | #t)) | |
250 | (replace 'check | |
251 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
252 | ;; some tests call into gdb binary which needs SHELL and CC set | |
253 | (setenv "SHELL" (which "sh")) | |
254 | (setenv "CC" (string-append (assoc-ref inputs "gcc") "/bin/gcc")) | |
255 | (invoke "make" "test" "-j" (number->string (parallel-job-count)))))))) | |
2429dde5 | 256 | (native-inputs |
d199a4c7 MB |
257 | `(("llvm" ,llvm-6) |
258 | ("clang" ,clang-6) | |
beffaf9a | 259 | ("ldc" ,ldc-bootstrap) |
2429dde5 MFM |
260 | ("python-lit" ,python-lit) |
261 | ("python-wrapper" ,python-wrapper) | |
262 | ("unzip" ,unzip) | |
263 | ("gdb" ,gdb) | |
264 | ("phobos-src" | |
265 | ,(origin | |
266 | (method url-fetch) | |
267 | (uri (string-append | |
268 | "https://github.com/ldc-developers/phobos/archive/ldc-v" | |
269 | older-version ".tar.gz")) | |
270 | (sha256 | |
271 | (base32 | |
633e8aab | 272 | "0cpmrww00xf1qx38bcc22rr05qw41p00p45yb5fbwnfaccfwdn0s")) |
2429dde5 MFM |
273 | ;; This patch deactivates some tests that depend on network access |
274 | ;; to pass. It also deactivates some tests that have some reliance | |
275 | ;; on timezone. | |
276 | ;; | |
277 | ;; For the network tests, there's an effort to get a version flag | |
278 | ;; added to deactivate these tests for distribution packagers | |
279 | ;; that is being pursued at | |
280 | ;; <https://forum.dlang.org/post/zmdbdgnzrxyvtpqafvyg@forum.dlang.org>. | |
281 | ;; It also deactivates a test that requires /root | |
633e8aab | 282 | (patches (search-patches "ldc-disable-phobos-tests.patch")))) |
2429dde5 MFM |
283 | ("druntime-src" |
284 | ,(origin | |
285 | (method url-fetch) | |
286 | (uri (string-append | |
287 | "https://github.com/ldc-developers/druntime/archive/ldc-v" | |
288 | older-version ".tar.gz")) | |
289 | (sha256 | |
290 | (base32 | |
633e8aab | 291 | "1akh2vdi98jih8642yjbvv2vavxzrmq24kz8i3kfidg5ndqyv222")))) |
2429dde5 MFM |
292 | ("dmd-testsuite-src" |
293 | ,(origin | |
294 | (method url-fetch) | |
295 | (uri (string-append | |
296 | "https://github.com/ldc-developers/dmd-testsuite/archive/ldc-v" | |
297 | older-version ".tar.gz")) | |
298 | (sha256 | |
299 | (base32 | |
633e8aab | 300 | "0z5x07qrbkpksshaymp11ir6jlmg9wjicxn6zhp8cya6i1ha9p99"))))))))) |
4fdcc502 DM |
301 | |
302 | (define-public dub | |
303 | (package | |
304 | (name "dub") | |
1b541c3e | 305 | (version "1.7.2") |
4fdcc502 DM |
306 | (source (origin |
307 | (method url-fetch) | |
308 | (uri (string-append "https://github.com/dlang/dub/archive/" | |
309 | "v" version ".tar.gz")) | |
310 | (file-name (string-append name "-" version ".tar.gz")) | |
311 | (sha256 | |
312 | (base32 | |
1b541c3e | 313 | "1jvr1mmq8j77wnsrsg7x2xv8yfljqd6x8gn6yy7dd6h6y3cf408q")))) |
4fdcc502 DM |
314 | (build-system gnu-build-system) |
315 | (arguments | |
316 | `(#:tests? #f ; it would have tested itself by installing some packages (vibe etc) | |
317 | #:phases | |
318 | (modify-phases %standard-phases | |
cd12f922 | 319 | (delete 'configure) ; no configure script |
4fdcc502 DM |
320 | (replace 'build |
321 | (lambda _ | |
a4960a20 | 322 | (invoke "./build.sh"))) |
4fdcc502 DM |
323 | (replace 'install |
324 | (lambda* (#:key outputs #:allow-other-keys) | |
325 | (let* ((out (assoc-ref outputs "out")) | |
cd12f922 TGR |
326 | (bin (string-append out "/bin"))) |
327 | (install-file "bin/dub" bin) | |
4fdcc502 DM |
328 | #t)))))) |
329 | (inputs | |
330 | `(("curl" ,curl))) | |
331 | (native-inputs | |
332 | `(("ldc" ,ldc))) | |
333 | (home-page "https://code.dlang.org/getting_started") | |
27a5c604 TGR |
334 | (synopsis "Package and build manager for D projects") |
335 | (description | |
1b541c3e PP |
336 | "DUB is a package and build manager for applications and |
337 | libraries written in the D programming language. It can | |
338 | automatically retrieve a project's dependencies and integrate | |
339 | them in the build process. | |
27a5c604 | 340 | |
1b541c3e PP |
341 | The design emphasis is on maximum simplicity for simple projects, |
342 | while providing the opportunity to customize things when | |
343 | needed.") | |
4fdcc502 | 344 | (license license:expat))) |