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>
8 ;;; This file is part of GNU Guix.
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.
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.
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/>.
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 check)
33 #:use-module (gnu packages compression)
34 #:use-module (gnu packages curl)
35 #:use-module (gnu packages gdb)
36 #:use-module (gnu packages libedit)
37 #:use-module (gnu packages llvm)
38 #:use-module (gnu packages python)
39 #:use-module (gnu packages textutils))
47 (uri (string-append "https://github.com/dlang/tools/archive/v" version ".tar.gz"))
48 (file-name (string-append name "-" version ".tar.gz"))
51 "0c8w373rv6iz3xfid94w40ncv2lr2ncxi662qsr4lda4aghczmq7"))))
52 (build-system gnu-build-system)
55 (modify-phases %standard-phases
57 (delete 'check) ; There is no Makefile, so there's no 'make check'.
61 (invoke "ldc2" "rdmd.d")))
64 (lambda* (#:key outputs #:allow-other-keys)
65 (let ((bin (string-append (assoc-ref outputs "out") "/bin")))
66 (install-file "rdmd" bin)))))))
69 (home-page "https://github.com/D-Programming-Language/tools/")
70 (synopsis "Specialized equivalent to 'make' for the D language")
72 "rdmd is a companion to the dmd compiler that simplifies the typical
73 edit-compile-link-run or edit-make-run cycle to a rapid edit-run cycle. Like
74 make and other tools, rdmd uses the relative dates of the files involved to
75 minimize the amount of work necessary. Unlike make, rdmd tracks dependencies
76 and freshness without requiring additional information from the user.")
77 (license license:boost1.0)))
79 (define-public ldc-bootstrap
86 "https://github.com/ldc-developers/ldc/archive/v"
88 (file-name (string-append name "-" version ".tar.gz"))
91 "1kw0j378k6bh0k66dvx99bjq8ilp8bb24w3jrmibn8rhmqv0d5q8"))))
92 (build-system cmake-build-system)
93 (supported-systems '("x86_64-linux" "i686-linux" "armhf-linux"))
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))))
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") ""))
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/")
126 (string-append (assoc-ref inputs "tzdata") "/share/zoneinfo"))
127 (("tzName == \"[+]VERSION\"")
128 "(tzName == \"+VERSION\" || std.algorithm.endsWith(tzName, \"/leapseconds\"))"))
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")
133 ;; the following two tests fail on i686
134 (for-each delete-file '("tests/ir/attributes.d" "tests/ir/align.d")))))))
136 `(("libconfig" ,libconfig)
143 ("python-lit" ,python-lit)
144 ("python-wrapper" ,python-wrapper)
150 "https://github.com/ldc-developers/phobos/archive/ldc-v"
154 "16x36kp46mqiihxx7jvr1d3mv3b96yfmhinb9lzinh2m4clr85wz"))
155 (patches (search-patches "ldc-bootstrap-disable-tests.patch"))))
160 "https://github.com/ldc-developers/druntime/archive/ldc-v"
164 "0iw2xxhcbsc5f1707dgdzhff528363l4faqdk513gaxs2dhfx8vx"))))
169 "https://github.com/ldc-developers/dmd-testsuite/archive/ldc-v"
173 "0z6ch930wjkg2vlnqkbliwxxxifad6ydsdpwdxwnajkb2kaxsjx4"))))))
174 (home-page "http://wiki.dlang.org/LDC")
175 (synopsis "LLVM compiler for the D programming language")
177 "LDC is a compiler for the D programming language. It is based on
178 the latest DMD compiler that was written in C and is used for
179 bootstrapping more recent compilers written in D.")
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
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.
191 (let ((older-version "1.7.0"))
193 (inherit ldc-bootstrap)
199 "https://github.com/ldc-developers/ldc/archive/v"
201 (file-name (string-append name "-" version ".tar.gz"))
204 "0rqchmlbhz1pd8ksl1vfhfd5s3cp9h9pqi4k4w2np9sq0zr7abwn"))))
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")))))
218 (add-after 'unpack-submodule-sources 'patch-phobos
219 (lambda* (#:key inputs #:allow-other-keys)
220 (substitute* '("runtime/phobos/std/process.d"
221 "tests/linking/linker_switches.d")
222 (("/bin/sh") (which "sh"))
223 (("echo") (which "echo")))
224 (substitute* "tests/d2/dmd-testsuite/Makefile"
225 (("/bin/bash") (which "bash")))
226 ;; disable unittests in the following files. We are discussing with
228 (substitute* '("runtime/phobos/std/net/curl.d"
229 "runtime/phobos/std/datetime/systime.d"
230 "runtime/phobos/std/datetime/timezone.d"
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")
238 ;; the following tests requires AVX instruction set in the CPU.
239 (substitute* "tests/d2/dmd-testsuite/runnable/test_cdvecfill.d"
240 (("^// DISABLED: ") "^// DISABLED: linux64 "))
243 (lambda* (#:key inputs outputs #:allow-other-keys)
244 ;; some tests call into gdb binary which needs SHELL and CC set
245 (setenv "SHELL" (which "sh"))
246 (setenv "CC" (string-append (assoc-ref inputs "gcc") "/bin/gcc"))
247 (invoke "make" "test" "-j" (number->string (parallel-job-count))))))))
251 ("ldc" ,ldc-bootstrap)
252 ("python-lit" ,python-lit)
253 ("python-wrapper" ,python-wrapper)
260 "https://github.com/ldc-developers/phobos/archive/ldc-v"
261 older-version ".tar.gz"))
264 "042hn3v0zk353r0h6yclq56z86hi437y969bckyb2qsnv00h60hi"))
265 ;; This patch deactivates some tests that depend on network access
266 ;; to pass. It also deactivates some tests that have some reliance
269 ;; For the network tests, there's an effort to get a version flag
270 ;; added to deactivate these tests for distribution packagers
271 ;; that is being pursued at
272 ;; <https://forum.dlang.org/post/zmdbdgnzrxyvtpqafvyg@forum.dlang.org>.
273 ;; It also deactivates a test that requires /root
274 (patches (search-patches "ldc-1.7.0-disable-phobos-tests.patch"))))
279 "https://github.com/ldc-developers/druntime/archive/ldc-v"
280 older-version ".tar.gz"))
283 "0pvabk70zw8c1gbmvy2i486bg22bn0l5nbacjz0qwmhf0w9y9ylh"))))
288 "https://github.com/ldc-developers/dmd-testsuite/archive/ldc-v"
289 older-version ".tar.gz"))
292 "1i8j1raah7b26bprwkdick443ivdsihgi1l14sn9rh4a95rnrpd9")))))))))
300 (uri (string-append "https://github.com/dlang/dub/archive/"
301 "v" version ".tar.gz"))
302 (file-name (string-append name "-" version ".tar.gz"))
305 "1jvr1mmq8j77wnsrsg7x2xv8yfljqd6x8gn6yy7dd6h6y3cf408q"))))
306 (build-system gnu-build-system)
308 `(#:tests? #f ; it would have tested itself by installing some packages (vibe etc)
310 (modify-phases %standard-phases
311 (delete 'configure) ; no configure script
314 (invoke "./build.sh")))
316 (lambda* (#:key outputs #:allow-other-keys)
317 (let* ((out (assoc-ref outputs "out"))
318 (bin (string-append out "/bin")))
319 (install-file "bin/dub" bin)
325 (home-page "https://code.dlang.org/getting_started")
326 (synopsis "Package and build manager for D projects")
328 "DUB is a package and build manager for applications and
329 libraries written in the D programming language. It can
330 automatically retrieve a project's dependencies and integrate
331 them in the build process.
333 The design emphasis is on maximum simplicity for simple projects,
334 while providing the opportunity to customize things when
336 (license license:expat)))