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