gnu: libtasn1: Remove obsolete patch.
[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>
a7ec569c 3;;; Copyright © 2015 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)
812b3c1f 32 #:use-module (gnu packages compression)
4fdcc502 33 #:use-module (gnu packages curl)
2429dde5 34 #:use-module (gnu packages gdb)
a7ec569c
RJ
35 #:use-module (gnu packages libedit)
36 #:use-module (gnu packages llvm)
0959478c 37 #:use-module (gnu packages python)
a7ec569c
RJ
38 #:use-module (gnu packages textutils)
39 #:use-module (gnu packages zip))
40
c1fc7a67 41(define-public rdmd
55330714
DM
42 (package
43 (name "rdmd")
44 (version "2.073.0")
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
51 "01if3ivnb7g2myfhymp4d9346s4vmvcl82i1kxfs5iza45almh7v"))))
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 _
61 (zero? (system* "ldc2" "rdmd.d"))))
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
a7ec569c
RJ
80 (package
81 (name "ldc")
bcd2fddd 82 (version "0.17.3")
a7ec569c
RJ
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
bcd2fddd 91 "135rgwwk82ccqp4n3fhqz4696jmvip90fg5ql2kccq5h1r71gb82"))))
a7ec569c 92 (build-system cmake-build-system)
e44b5112 93 (supported-systems '("x86_64-linux" "i686-linux" "armhf-linux"))
a7ec569c
RJ
94 (arguments
95 `(#:phases
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")))))
812b3c1f
DM
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") ""))
114 #t))
a7ec569c
RJ
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")))
538bce24
RW
125 ;; FIXME: this test cannot be linked.
126 (delete-file "tests/d2/dmd-testsuite/runnable/cppa.d")
a7ec569c
RJ
127 #t)))))
128 (inputs
129 `(("libconfig" ,libconfig)
130 ("libedit" ,libedit)
812b3c1f
DM
131 ("tzdata" ,tzdata)
132 ("zlib" ,zlib)))
a7ec569c 133 (native-inputs
e44b5112
DM
134 `(("llvm" ,llvm)
135 ("clang" ,clang)
136 ("python-lit" ,python-lit)
137 ("python-wrapper" ,python-wrapper)
a7ec569c
RJ
138 ("unzip" ,unzip)
139 ("phobos-src"
140 ,(origin
141 (method url-fetch)
142 (uri (string-append
143 "https://github.com/ldc-developers/phobos/archive/ldc-v"
144 version ".tar.gz"))
145 (sha256
146 (base32
bcd2fddd 147 "0qywnvnp019mmmr74aw90ir9f03iz0hc7cgzna609agsar0b27jl"))
fc1adab1 148 (patches (search-patches "ldc-disable-tests.patch"))))
a7ec569c
RJ
149 ("druntime-src"
150 ,(origin
151 (method url-fetch)
152 (uri (string-append
153 "https://github.com/ldc-developers/druntime/archive/ldc-v"
154 version ".tar.gz"))
155 (sha256
156 (base32
bcd2fddd 157 "0z418n6x2fxac07sxpi4rl69069qiym4w6r9sjppn91q58qh8hjs"))))
a7ec569c
RJ
158 ("dmd-testsuite-src"
159 ,(origin
160 (method url-fetch)
161 (uri (string-append
162 "https://github.com/ldc-developers/dmd-testsuite/archive/ldc-v"
163 version ".tar.gz"))
164 (sha256
165 (base32
bcd2fddd 166 "196mkfax5y3yqm3gz7jhqhnkjwrvr2m4a8nc9k41l0511ldzsk9x"))))))
a7ec569c
RJ
167 (home-page "http://wiki.dlang.org/LDC")
168 (synopsis "LLVM compiler for the D programming language")
169 (description
170 "LDC is a compiler for the D programming language. It is based on the
171latest 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
176 license:gpl2+
341ae582 177 license:boost1.0))))
2429dde5
MFM
178
179
836cbd9f 180(define-public ldc
2429dde5
MFM
181 ;; The phobos, druntime and dmd-testsuite dependencies do not have a newer
182 ;; release than 1.1.0-beta4, hence the need to make use of the older-version
183 ;; variable to hold this variable.
836cbd9f 184 (let ((older-version "1.1.0"))
2429dde5 185 (package
beffaf9a 186 (inherit ldc-bootstrap)
2429dde5 187 (name "ldc")
219369ce 188 (version "1.1.1")
2429dde5
MFM
189 ;; Beta version needed to compile various scientific tools that require
190 ;; the newer beta versions, and won't compile successfully with the
191 ;; older stable version.
192 (source (origin
193 (method url-fetch)
194 (uri (string-append
195 "https://github.com/ldc-developers/ldc/archive/v"
196 version ".tar.gz"))
197 (file-name (string-append name "-" version ".tar.gz"))
198 (sha256
199 (base32
219369ce 200 "0yjiwg8pnlm2286bwdkwasaqw6ys7lymrqvhh5xyb1adha1ndcav"))))
2429dde5
MFM
201 (arguments
202 `(#:phases
203 (modify-phases %standard-phases
204 (add-after 'unpack 'unpack-submodule-sources
205 (lambda* (#:key inputs #:allow-other-keys)
206 (let ((unpack (lambda (source target)
207 (with-directory-excursion target
208 (zero? (system* "tar" "xvf"
209 (assoc-ref inputs source)
210 "--strip-components=1"))))))
211 (and (unpack "phobos-src" "runtime/phobos")
212 (unpack "druntime-src" "runtime/druntime")
213 (unpack "dmd-testsuite-src" "tests/d2/dmd-testsuite")))))
214 ;; The 'patch-dmd2 step in ldc causes the build to fail since
215 ;; dmd2/root/port.c no longer exists. Arguments needed to have
216 ;; 'patch-dmd2 step removed, but retain everything else.
217 (add-after 'unpack-submodule-sources 'patch-phobos
218 (lambda* (#:key inputs #:allow-other-keys)
219 (substitute* "runtime/phobos/std/process.d"
220 (("/bin/sh") (which "sh"))
221 (("echo") (which "echo")))
222 (substitute* "runtime/phobos/std/datetime.d"
223 (("/usr/share/zoneinfo/")
224 (string-append (assoc-ref inputs "tzdata") "/share/zoneinfo")))
225 (substitute* "tests/d2/dmd-testsuite/Makefile"
226 (("/bin/bash") (which "bash")))
227 #t)))))
228 (native-inputs
229 `(("llvm" ,llvm)
230 ("clang" ,clang)
beffaf9a 231 ("ldc" ,ldc-bootstrap)
2429dde5
MFM
232 ("python-lit" ,python-lit)
233 ("python-wrapper" ,python-wrapper)
234 ("unzip" ,unzip)
235 ("gdb" ,gdb)
236 ("phobos-src"
237 ,(origin
238 (method url-fetch)
239 (uri (string-append
240 "https://github.com/ldc-developers/phobos/archive/ldc-v"
241 older-version ".tar.gz"))
242 (sha256
243 (base32
836cbd9f 244 "0z5v55b9s1ppf0c2ivjq7sbmq688c37c92ihc3qwrbxnqvkkvrlk"))
2429dde5
MFM
245 ;; This patch deactivates some tests that depend on network access
246 ;; to pass. It also deactivates some tests that have some reliance
247 ;; on timezone.
248 ;;
249 ;; For the network tests, there's an effort to get a version flag
250 ;; added to deactivate these tests for distribution packagers
251 ;; that is being pursued at
252 ;; <https://forum.dlang.org/post/zmdbdgnzrxyvtpqafvyg@forum.dlang.org>.
253 ;; It also deactivates a test that requires /root
254 (patches (search-patches "ldc-1.1.0-disable-phobos-tests.patch"))))
255 ("druntime-src"
256 ,(origin
257 (method url-fetch)
258 (uri (string-append
259 "https://github.com/ldc-developers/druntime/archive/ldc-v"
260 older-version ".tar.gz"))
261 (sha256
262 (base32
836cbd9f 263 "07qvrqj6vgakd6qr4x5f70w6zwkzd1li5x8i1b5ywnds1z5lnfp6"))))
2429dde5
MFM
264 ("dmd-testsuite-src"
265 ,(origin
266 (method url-fetch)
267 (uri (string-append
268 "https://github.com/ldc-developers/dmd-testsuite/archive/ldc-v"
269 older-version ".tar.gz"))
270 (sha256
271 (base32
836cbd9f 272 "12cak7yqmsgjlflx0dp6fwmwb9dac25amgi86n0bb95ard3547wy"))
2429dde5
MFM
273 ;; Remove the gdb tests that fails with a "Error: No such file or
274 ;; directory" error, despite the files being present in the debug
275 ;; files left with the --keep-failed flag to guix build.
276 (patches (search-patches "ldc-1.1.0-disable-dmd-tests.patch")))))))))
277
836cbd9f 278(define-public ldc-beta ldc)
4fdcc502
DM
279
280(define-public dub
281 (package
282 (name "dub")
cd12f922 283 (version "1.3.0")
4fdcc502
DM
284 (source (origin
285 (method url-fetch)
286 (uri (string-append "https://github.com/dlang/dub/archive/"
287 "v" version ".tar.gz"))
288 (file-name (string-append name "-" version ".tar.gz"))
289 (sha256
290 (base32
cd12f922 291 "056mvf01z51qc3i1qnx7yaqr728q8pss8zabiv5zpfx2ynfsw3k7"))))
4fdcc502
DM
292 (build-system gnu-build-system)
293 (arguments
294 `(#:tests? #f ; it would have tested itself by installing some packages (vibe etc)
295 #:phases
296 (modify-phases %standard-phases
cd12f922 297 (delete 'configure) ; no configure script
4fdcc502
DM
298 (replace 'build
299 (lambda _
300 (zero? (system* "./build.sh"))))
301 (replace 'install
302 (lambda* (#:key outputs #:allow-other-keys)
303 (let* ((out (assoc-ref outputs "out"))
cd12f922
TGR
304 (bin (string-append out "/bin")))
305 (install-file "bin/dub" bin)
4fdcc502
DM
306 #t))))))
307 (inputs
308 `(("curl" ,curl)))
309 (native-inputs
310 `(("ldc" ,ldc)))
311 (home-page "https://code.dlang.org/getting_started")
27a5c604
TGR
312 (synopsis "Package and build manager for D projects")
313 (description
314 "DUB is a package and build manager for applications and libraries written
315in the D programming language. It can automatically retrieve a project's
316dependencies and integrate them in the build process.
317
318The design emphasis is on maximum simplicity for simple projects, while
319providing the opportunity to customize things when needed. ")
4fdcc502 320 (license license:expat)))