1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2015, 2016 Roel Janssen <roel@gnu.org>
3 ;;; Copyright © 2015, 2018 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, 2019 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 dlang)
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 python-xyz)
40 #:use-module (gnu packages textutils))
48 (uri (string-append "https://github.com/dlang/tools/archive/v" version ".tar.gz"))
49 (file-name (string-append name "-" version ".tar.gz"))
52 "0c8w373rv6iz3xfid94w40ncv2lr2ncxi662qsr4lda4aghczmq7"))))
53 (build-system gnu-build-system)
56 (modify-phases %standard-phases
58 (delete 'check) ; There is no Makefile, so there's no 'make check'.
62 (invoke "ldc2" "rdmd.d")))
65 (lambda* (#:key outputs #:allow-other-keys)
66 (let ((bin (string-append (assoc-ref outputs "out") "/bin")))
67 (install-file "rdmd" bin)))))))
70 (home-page "https://github.com/D-Programming-Language/tools/")
71 (synopsis "Specialized equivalent to 'make' for the D language")
73 "rdmd is a companion to the dmd compiler that simplifies the typical
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.")
78 (license license:boost1.0)))
80 (define-public ldc-bootstrap
88 (url "https://github.com/ldc-developers/ldc.git")
89 (commit (string-append "v" version))))
90 (file-name (git-file-name name version))
92 (base32 "0nnrjavfmpfp7bib04isqlxvyzh6mlvsdan0gxysdz96hlg4hcq8"))))
93 (build-system cmake-build-system)
94 (supported-systems '("x86_64-linux" "i686-linux" "armhf-linux"))
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))))
101 (modify-phases %standard-phases
102 (add-after 'unpack 'unpack-submodule-sources
103 (lambda* (#:key inputs #:allow-other-keys)
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")))))))
113 (unpack "phobos-src" "runtime/phobos")
114 (unpack "druntime-src" "runtime/druntime")
115 (unpack "dmd-testsuite-src" "tests/d2/dmd-testsuite")
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") ""))
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/")
132 (string-append (assoc-ref inputs "tzdata") "/share/zoneinfo"))
133 (("tzName == \"[+]VERSION\"")
134 "(tzName == \"+VERSION\" || std.algorithm.endsWith(tzName, \"/leapseconds\"))"))
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")
139 ;; the following two tests fail on i686
140 (for-each delete-file '("tests/ir/attributes.d" "tests/ir/align.d")))))))
142 `(("libconfig" ,libconfig)
149 ("python-lit" ,python-lit)
150 ("python-wrapper" ,python-wrapper)
156 (url "https://github.com/ldc-developers/phobos.git")
157 (commit (string-append "ldc-v" version))))
158 (file-name (git-file-name "phobos" version))
160 (base32 "0i7gh99w4mi0hdv16261jcdiqyv1nkjdcwy9prw32s0lvplx8fdy"))
161 (patches (search-patches "ldc-bootstrap-disable-tests.patch"))))
166 (url "https://github.com/ldc-developers/druntime.git")
167 (commit (string-append "ldc-v" version))))
168 (file-name (git-file-name "druntime" version))
170 (base32 "0alabm3bbvs94msvxz5psiwk4f51cw9h82z1p5hhsnf8ja6d0am7"))))
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))
179 (base32 "05qr4cgb4scfqzbw1l5pk72kil074mvj9d55b165ljyr51sgwgbl"))))))
180 (home-page "http://wiki.dlang.org/LDC")
181 (synopsis "LLVM-based compiler for the D programming language")
183 "LDC is an LLVM compiler for the D programming language. It is based on
184 the latest DMD compiler that was written in C and is used for
185 bootstrapping more recent compilers written in D.")
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
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.
197 (let ((older-version "1.10.0")) ;; retain this because sometimes the libs are older
199 (inherit ldc-bootstrap)
206 (url "https://github.com/ldc-developers/ldc.git")
207 (commit (string-append "v" version))))
208 (file-name (git-file-name name version))
210 (base32 "0qcb2rn01wql7y8qp31blbv3hwmnh3zjgzi2n7k168cxr6rrdhlp"))))
213 (modify-phases %standard-phases
214 (add-after 'unpack 'unpack-submodule-sources
215 (lambda* (#:key inputs #:allow-other-keys)
216 (let ((unpack (lambda (input target)
217 (let ((source (assoc-ref inputs input)))
218 ;; Git checkouts are directories as long as
219 ;; there are no patches; tarballs otherwise.
220 (if (file-is-directory? source)
221 (copy-recursively source target)
222 (with-directory-excursion target
223 (invoke "tar" "xvf" source
224 "--strip-components=1")))))))
225 (unpack "phobos-src" "runtime/phobos")
226 (unpack "druntime-src" "runtime/druntime")
227 (unpack "dmd-testsuite-src" "tests/d2/dmd-testsuite")
229 (add-after 'unpack-submodule-sources 'patch-phobos
230 (lambda* (#:key inputs #:allow-other-keys)
231 (substitute* '("runtime/phobos/std/process.d"
232 "tests/linking/linker_switches.d")
233 (("/bin/sh") (which "sh"))
234 (("echo") (which "echo")))
235 (substitute* "tests/d2/dmd-testsuite/Makefile"
236 (("/bin/bash") (which "bash")))
237 ;; disable unittests in the following files. We are discussing with
239 (substitute* '("runtime/phobos/std/net/curl.d"
240 "runtime/phobos/std/datetime/systime.d"
241 "runtime/phobos/std/datetime/timezone.d"
243 (("version(unittest)") "version(skipunittest)")
244 ((" unittest") " version(skipunittest) unittest"))
245 ;; the following tests require a more recent LLVM
246 (delete-file "tests/compilable/ctfe_math.d")
247 (delete-file "tests/debuginfo/nested_gdb.d")
248 (delete-file "tests/debuginfo/classtypes_gdb.d")
249 ;; the following tests plugins we don't have.
250 (delete-file "tests/plugins/addFuncEntryCall/testPlugin.d")
251 ;; the following tests requires AVX instruction set in the CPU.
252 (substitute* "tests/d2/dmd-testsuite/runnable/test_cdvecfill.d"
253 (("^// DISABLED: ") "^// DISABLED: linux64 "))
256 (lambda* (#:key inputs outputs #:allow-other-keys)
257 ;; some tests call into gdb binary which needs SHELL and CC set
258 (setenv "SHELL" (which "sh"))
259 (setenv "CC" (string-append (assoc-ref inputs "gcc") "/bin/gcc"))
260 (invoke "make" "test" "-j" (number->string (parallel-job-count))))))))
264 ("ldc" ,ldc-bootstrap)
265 ("python-lit" ,python-lit)
266 ("python-wrapper" ,python-wrapper)
273 (url "https://github.com/ldc-developers/phobos.git")
274 (commit (string-append "ldc-v" older-version))))
275 (file-name (git-file-name "phobos" older-version))
277 (base32 "1gmlwnjdcf6s5aahadxsif9l5nyaj0rrn379g6fmhcvdk64kf509"))
278 ;; This patch deactivates some tests that depend on network access
279 ;; to pass. It also deactivates some tests that have some reliance
282 ;; For the network tests, there's an effort to get a version flag
283 ;; added to deactivate these tests for distribution packagers
284 ;; that is being pursued at
285 ;; <https://forum.dlang.org/post/zmdbdgnzrxyvtpqafvyg@forum.dlang.org>.
286 ;; It also deactivates a test that requires /root
287 (patches (search-patches "ldc-disable-phobos-tests.patch"))))
292 (url "https://github.com/ldc-developers/druntime.git")
293 (commit (string-append "ldc-v" older-version))))
294 (file-name (git-file-name "druntime" older-version))
296 (base32 "0a3yyjcnpvm5fbdczf76fx08kl154w17w06hlxf0j3p1p4jc85aj"))))
301 (url "https://github.com/ldc-developers/dmd-testsuite.git")
302 (commit (string-append "ldc-v" older-version))))
303 (file-name (git-file-name "dmd-testsuite" older-version))
305 (base32 "0mm3rliki1nqiqfaha7ssvm156aa398vpvf4v6895m7nn1mz7rss")))))))))
315 (url "https://github.com/dlang/dub.git")
316 (commit (string-append "v" version))))
317 (file-name (git-file-name name version))
319 (base32 "073ibvgm1gphcqs1yjrav9ryp677nh3b194nxmvicwgvdc0sb6w9"))))
320 (build-system gnu-build-system)
322 `(#:tests? #f ; it would have tested itself by installing some packages (vibe etc)
324 (modify-phases %standard-phases
325 (delete 'configure) ; no configure script
328 (invoke "./build.sh")))
330 (lambda* (#:key outputs #:allow-other-keys)
331 (let* ((out (assoc-ref outputs "out"))
332 (bin (string-append out "/bin")))
333 (install-file "bin/dub" bin)
339 (home-page "https://code.dlang.org/getting_started")
340 (synopsis "Package and build manager for D projects")
342 "DUB is a package and build manager for applications and
343 libraries written in the D programming language. It can
344 automatically retrieve a project's dependencies and integrate
345 them in the build process.
347 The design emphasis is on maximum simplicity for simple projects,
348 while providing the opportunity to customize things when
350 (license license:expat)))