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 compression)
33 #:use-module (gnu packages curl)
34 #:use-module (gnu packages gdb)
35 #:use-module (gnu packages libedit)
36 #:use-module (gnu packages llvm)
37 #:use-module (gnu packages python)
38 #:use-module (gnu packages textutils))
46 (uri (string-append "https://github.com/dlang/tools/archive/v" version ".tar.gz"))
47 (file-name (string-append name "-" version ".tar.gz"))
50 "01if3ivnb7g2myfhymp4d9346s4vmvcl82i1kxfs5iza45almh7v"))))
51 (build-system gnu-build-system)
54 (modify-phases %standard-phases
56 (delete 'check) ; There is no Makefile, so there's no 'make check'.
60 (zero? (system* "ldc2" "rdmd.d"))))
63 (lambda* (#:key outputs #:allow-other-keys)
64 (let ((bin (string-append (assoc-ref outputs "out") "/bin")))
65 (install-file "rdmd" bin)))))))
68 (home-page "https://github.com/D-Programming-Language/tools/")
69 (synopsis "Specialized equivalent to 'make' for the D language")
71 "rdmd is a companion to the dmd compiler that simplifies the typical
72 edit-compile-link-run or edit-make-run cycle to a rapid edit-run cycle. Like
73 make and other tools, rdmd uses the relative dates of the files involved to
74 minimize the amount of work necessary. Unlike make, rdmd tracks dependencies
75 and freshness without requiring additional information from the user.")
76 (license license:boost1.0)))
78 (define-public ldc-bootstrap
79 (let ((runtime-version "0.17.3"))
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"))
96 (modify-phases %standard-phases
97 (add-after 'unpack 'unpack-submodule-sources
98 (lambda* (#:key inputs #:allow-other-keys)
99 (let ((unpack (lambda (source target)
100 (with-directory-excursion target
101 (zero? (system* "tar" "xvf"
102 (assoc-ref inputs source)
103 "--strip-components=1"))))))
104 (and (unpack "phobos-src" "runtime/phobos")
105 (unpack "druntime-src" "runtime/druntime")
106 (unpack "dmd-testsuite-src" "tests/d2/dmd-testsuite")))))
107 (add-after 'unpack-submodule-sources 'patch-dmd2
108 (lambda* (#:key inputs #:allow-other-keys)
109 (substitute* "dmd2/root/port.c"
110 ((" ::isnan") " isnan")
111 ((" ::isinf") " isinf")
112 (("#undef isnan") "")
113 (("#undef isinf") ""))
115 (add-after 'unpack-submodule-sources 'patch-phobos
116 (lambda* (#:key inputs #:allow-other-keys)
117 (substitute* "runtime/phobos/std/process.d"
118 (("/bin/sh") (which "sh"))
119 (("echo") (which "echo")))
120 (substitute* "runtime/phobos/std/datetime.d"
121 (("/usr/share/zoneinfo/")
122 (string-append (assoc-ref inputs "tzdata") "/share/zoneinfo")))
123 (substitute* "tests/d2/dmd-testsuite/Makefile"
124 (("/bin/bash") (which "bash")))
125 ;; FIXME: this test cannot be linked.
126 (delete-file "tests/d2/dmd-testsuite/runnable/cppa.d")
129 `(("libconfig" ,libconfig)
136 ("python-lit" ,python-lit)
137 ("python-wrapper" ,python-wrapper)
143 "https://github.com/ldc-developers/phobos/archive/ldc-v"
144 runtime-version ".tar.gz"))
147 "0qywnvnp019mmmr74aw90ir9f03iz0hc7cgzna609agsar0b27jl"))
148 (patches (search-patches "ldc-disable-tests.patch"))))
153 "https://github.com/ldc-developers/druntime/archive/ldc-v"
154 runtime-version ".tar.gz"))
157 "0z418n6x2fxac07sxpi4rl69069qiym4w6r9sjppn91q58qh8hjs"))))
162 "https://github.com/ldc-developers/dmd-testsuite/archive/ldc-v"
163 runtime-version ".tar.gz"))
166 "196mkfax5y3yqm3gz7jhqhnkjwrvr2m4a8nc9k41l0511ldzsk9x"))))))
167 (home-page "http://wiki.dlang.org/LDC")
168 (synopsis "LLVM compiler for the D programming language")
170 "LDC is a compiler for the D programming language. It is based on the
171 latest DMD frontend and uses LLVM as backend.")
172 ;; Most of the code is released under BSD-3, except for code originally
173 ;; written for GDC, which is released under GPLv2+, and the DMD frontend,
174 ;; which is released under the "Boost Software License version 1.0".
175 (license (list license:bsd-3
177 license:boost1.0)))))
180 ;; The phobos, druntime and dmd-testsuite dependencies do not have a newer
181 ;; release than 1.1.0-beta4, hence the need to make use of the older-version
182 ;; variable to hold this variable.
183 (let ((older-version "1.1.0"))
185 (inherit ldc-bootstrap)
188 ;; Beta version needed to compile various scientific tools that require
189 ;; the newer beta versions, and won't compile successfully with the
190 ;; older stable version.
194 "https://github.com/ldc-developers/ldc/archive/v"
196 (file-name (string-append name "-" version ".tar.gz"))
199 "0yjiwg8pnlm2286bwdkwasaqw6ys7lymrqvhh5xyb1adha1ndcav"))))
202 (modify-phases %standard-phases
203 (add-after 'unpack 'unpack-submodule-sources
204 (lambda* (#:key inputs #:allow-other-keys)
205 (let ((unpack (lambda (source target)
206 (with-directory-excursion target
207 (zero? (system* "tar" "xvf"
208 (assoc-ref inputs source)
209 "--strip-components=1"))))))
210 (and (unpack "phobos-src" "runtime/phobos")
211 (unpack "druntime-src" "runtime/druntime")
212 (unpack "dmd-testsuite-src" "tests/d2/dmd-testsuite")))))
213 ;; The 'patch-dmd2 step in ldc causes the build to fail since
214 ;; dmd2/root/port.c no longer exists. Arguments needed to have
215 ;; 'patch-dmd2 step removed, but retain everything else.
216 (add-after 'unpack-submodule-sources 'patch-phobos
217 (lambda* (#:key inputs #:allow-other-keys)
218 (substitute* "runtime/phobos/std/process.d"
219 (("/bin/sh") (which "sh"))
220 (("echo") (which "echo")))
221 (substitute* "runtime/phobos/std/datetime.d"
222 (("/usr/share/zoneinfo/")
223 (string-append (assoc-ref inputs "tzdata") "/share/zoneinfo")))
224 (substitute* "tests/d2/dmd-testsuite/Makefile"
225 (("/bin/bash") (which "bash")))
230 ("ldc" ,ldc-bootstrap)
231 ("python-lit" ,python-lit)
232 ("python-wrapper" ,python-wrapper)
239 "https://github.com/ldc-developers/phobos/archive/ldc-v"
240 older-version ".tar.gz"))
243 "0z5v55b9s1ppf0c2ivjq7sbmq688c37c92ihc3qwrbxnqvkkvrlk"))
244 ;; This patch deactivates some tests that depend on network access
245 ;; to pass. It also deactivates some tests that have some reliance
248 ;; For the network tests, there's an effort to get a version flag
249 ;; added to deactivate these tests for distribution packagers
250 ;; that is being pursued at
251 ;; <https://forum.dlang.org/post/zmdbdgnzrxyvtpqafvyg@forum.dlang.org>.
252 ;; It also deactivates a test that requires /root
253 (patches (search-patches "ldc-1.1.0-disable-phobos-tests.patch"))))
258 "https://github.com/ldc-developers/druntime/archive/ldc-v"
259 older-version ".tar.gz"))
262 "07qvrqj6vgakd6qr4x5f70w6zwkzd1li5x8i1b5ywnds1z5lnfp6"))))
267 "https://github.com/ldc-developers/dmd-testsuite/archive/ldc-v"
268 older-version ".tar.gz"))
271 "12cak7yqmsgjlflx0dp6fwmwb9dac25amgi86n0bb95ard3547wy"))
272 ;; Remove the gdb tests that fails with a "Error: No such file or
273 ;; directory" error, despite the files being present in the debug
274 ;; files left with the --keep-failed flag to guix build.
275 (patches (search-patches "ldc-1.1.0-disable-dmd-tests.patch")))))))))
277 (define-public ldc-beta ldc)
285 (uri (string-append "https://github.com/dlang/dub/archive/"
286 "v" version ".tar.gz"))
287 (file-name (string-append name "-" version ".tar.gz"))
290 "1w3pznyjnmsmasrvv93f82l0sr31fpwg2zcj8hh1b2gvc5761qhi"))))
291 (build-system gnu-build-system)
293 `(#:tests? #f ; it would have tested itself by installing some packages (vibe etc)
295 (modify-phases %standard-phases
296 (delete 'configure) ; no configure script
299 (zero? (system* "./build.sh"))))
301 (lambda* (#:key outputs #:allow-other-keys)
302 (let* ((out (assoc-ref outputs "out"))
303 (bin (string-append out "/bin")))
304 (install-file "bin/dub" bin)
310 (home-page "https://code.dlang.org/getting_started")
311 (synopsis "Package and build manager for D projects")
313 "DUB is a package and build manager for applications and libraries written
314 in the D programming language. It can automatically retrieve a project's
315 dependencies and integrate them in the build process.
317 The design emphasis is on maximum simplicity for simple projects, while
318 providing the opportunity to customize things when needed. ")
319 (license license:expat)))