gnu: nginx: Update to 1.13.9.
[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)
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")
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
5144c044
DM
80 (let ((runtime-version "0.17.3"))
81 (package
82 (name "ldc")
83 (version "0.17.4")
84 (source (origin
85 (method url-fetch)
86 (uri (string-append
87 "https://github.com/ldc-developers/ldc/archive/v"
88 version ".tar.gz"))
89 (file-name (string-append name "-" version ".tar.gz"))
90 (sha256
91 (base32
92 "1kw0j378k6bh0k66dvx99bjq8ilp8bb24w3jrmibn8rhmqv0d5q8"))))
93 (build-system cmake-build-system)
94 (supported-systems '("x86_64-linux" "i686-linux" "armhf-linux"))
95 (arguments
96 `(#:phases
97 (modify-phases %standard-phases
98 (add-after 'unpack 'unpack-submodule-sources
99 (lambda* (#:key inputs #:allow-other-keys)
100 (let ((unpack (lambda (source target)
101 (with-directory-excursion target
102 (zero? (system* "tar" "xvf"
103 (assoc-ref inputs source)
104 "--strip-components=1"))))))
105 (and (unpack "phobos-src" "runtime/phobos")
106 (unpack "druntime-src" "runtime/druntime")
107 (unpack "dmd-testsuite-src" "tests/d2/dmd-testsuite")))))
108 (add-after 'unpack-submodule-sources 'patch-dmd2
109 (lambda* (#:key inputs #:allow-other-keys)
110 (substitute* "dmd2/root/port.c"
111 ((" ::isnan") " isnan")
112 ((" ::isinf") " isinf")
113 (("#undef isnan") "")
114 (("#undef isinf") ""))
115 #t))
116 (add-after 'unpack-submodule-sources 'patch-phobos
117 (lambda* (#:key inputs #:allow-other-keys)
118 (substitute* "runtime/phobos/std/process.d"
119 (("/bin/sh") (which "sh"))
120 (("echo") (which "echo")))
121 (substitute* "runtime/phobos/std/datetime.d"
122 (("/usr/share/zoneinfo/")
123 (string-append (assoc-ref inputs "tzdata") "/share/zoneinfo")))
124 (substitute* "tests/d2/dmd-testsuite/Makefile"
125 (("/bin/bash") (which "bash")))
126 ;; FIXME: this test cannot be linked.
127 (delete-file "tests/d2/dmd-testsuite/runnable/cppa.d")
128 #t)))))
129 (inputs
130 `(("libconfig" ,libconfig)
131 ("libedit" ,libedit)
132 ("tzdata" ,tzdata)
133 ("zlib" ,zlib)))
134 (native-inputs
135 `(("llvm" ,llvm)
136 ("clang" ,clang)
137 ("python-lit" ,python-lit)
138 ("python-wrapper" ,python-wrapper)
139 ("unzip" ,unzip)
140 ("phobos-src"
141 ,(origin
142 (method url-fetch)
143 (uri (string-append
144 "https://github.com/ldc-developers/phobos/archive/ldc-v"
145 runtime-version ".tar.gz"))
146 (sha256
147 (base32
148 "0qywnvnp019mmmr74aw90ir9f03iz0hc7cgzna609agsar0b27jl"))
149 (patches (search-patches "ldc-disable-tests.patch"))))
150 ("druntime-src"
151 ,(origin
152 (method url-fetch)
153 (uri (string-append
154 "https://github.com/ldc-developers/druntime/archive/ldc-v"
155 runtime-version ".tar.gz"))
156 (sha256
157 (base32
158 "0z418n6x2fxac07sxpi4rl69069qiym4w6r9sjppn91q58qh8hjs"))))
159 ("dmd-testsuite-src"
160 ,(origin
161 (method url-fetch)
162 (uri (string-append
163 "https://github.com/ldc-developers/dmd-testsuite/archive/ldc-v"
164 runtime-version ".tar.gz"))
165 (sha256
166 (base32
167 "196mkfax5y3yqm3gz7jhqhnkjwrvr2m4a8nc9k41l0511ldzsk9x"))))))
469069b6
LC
168
169 (properties
170 ;; Some of the tests take a very long time on ARMv7. See
171 ;; <https://lists.gnu.org/archive/html/guix-devel/2018-02/msg00312.html>.
172 `((max-silent-time . ,(* 3600 3))))
173
5144c044
DM
174 (home-page "http://wiki.dlang.org/LDC")
175 (synopsis "LLVM compiler for the D programming language")
176 (description
177 "LDC is a compiler for the D programming language. It is based on the
a7ec569c 178latest DMD frontend and uses LLVM as backend.")
5144c044
DM
179 ;; Most of the code is released under BSD-3, except for code originally
180 ;; written for GDC, which is released under GPLv2+, and the DMD frontend,
181 ;; which is released under the "Boost Software License version 1.0".
182 (license (list license:bsd-3
183 license:gpl2+
184 license:boost1.0)))))
2429dde5 185
836cbd9f 186(define-public ldc
2429dde5
MFM
187 ;; The phobos, druntime and dmd-testsuite dependencies do not have a newer
188 ;; release than 1.1.0-beta4, hence the need to make use of the older-version
189 ;; variable to hold this variable.
836cbd9f 190 (let ((older-version "1.1.0"))
2429dde5 191 (package
beffaf9a 192 (inherit ldc-bootstrap)
2429dde5 193 (name "ldc")
219369ce 194 (version "1.1.1")
2429dde5
MFM
195 ;; Beta version needed to compile various scientific tools that require
196 ;; the newer beta versions, and won't compile successfully with the
197 ;; older stable version.
198 (source (origin
199 (method url-fetch)
200 (uri (string-append
201 "https://github.com/ldc-developers/ldc/archive/v"
202 version ".tar.gz"))
203 (file-name (string-append name "-" version ".tar.gz"))
204 (sha256
205 (base32
219369ce 206 "0yjiwg8pnlm2286bwdkwasaqw6ys7lymrqvhh5xyb1adha1ndcav"))))
2429dde5
MFM
207 (arguments
208 `(#:phases
209 (modify-phases %standard-phases
210 (add-after 'unpack 'unpack-submodule-sources
211 (lambda* (#:key inputs #:allow-other-keys)
212 (let ((unpack (lambda (source target)
213 (with-directory-excursion target
214 (zero? (system* "tar" "xvf"
215 (assoc-ref inputs source)
216 "--strip-components=1"))))))
217 (and (unpack "phobos-src" "runtime/phobos")
218 (unpack "druntime-src" "runtime/druntime")
219 (unpack "dmd-testsuite-src" "tests/d2/dmd-testsuite")))))
220 ;; The 'patch-dmd2 step in ldc causes the build to fail since
221 ;; dmd2/root/port.c no longer exists. Arguments needed to have
222 ;; 'patch-dmd2 step removed, but retain everything else.
223 (add-after 'unpack-submodule-sources 'patch-phobos
224 (lambda* (#:key inputs #:allow-other-keys)
225 (substitute* "runtime/phobos/std/process.d"
226 (("/bin/sh") (which "sh"))
227 (("echo") (which "echo")))
228 (substitute* "runtime/phobos/std/datetime.d"
229 (("/usr/share/zoneinfo/")
230 (string-append (assoc-ref inputs "tzdata") "/share/zoneinfo")))
231 (substitute* "tests/d2/dmd-testsuite/Makefile"
232 (("/bin/bash") (which "bash")))
233 #t)))))
234 (native-inputs
235 `(("llvm" ,llvm)
236 ("clang" ,clang)
beffaf9a 237 ("ldc" ,ldc-bootstrap)
2429dde5
MFM
238 ("python-lit" ,python-lit)
239 ("python-wrapper" ,python-wrapper)
240 ("unzip" ,unzip)
241 ("gdb" ,gdb)
242 ("phobos-src"
243 ,(origin
244 (method url-fetch)
245 (uri (string-append
246 "https://github.com/ldc-developers/phobos/archive/ldc-v"
247 older-version ".tar.gz"))
248 (sha256
249 (base32
836cbd9f 250 "0z5v55b9s1ppf0c2ivjq7sbmq688c37c92ihc3qwrbxnqvkkvrlk"))
2429dde5
MFM
251 ;; This patch deactivates some tests that depend on network access
252 ;; to pass. It also deactivates some tests that have some reliance
253 ;; on timezone.
254 ;;
255 ;; For the network tests, there's an effort to get a version flag
256 ;; added to deactivate these tests for distribution packagers
257 ;; that is being pursued at
258 ;; <https://forum.dlang.org/post/zmdbdgnzrxyvtpqafvyg@forum.dlang.org>.
259 ;; It also deactivates a test that requires /root
260 (patches (search-patches "ldc-1.1.0-disable-phobos-tests.patch"))))
261 ("druntime-src"
262 ,(origin
263 (method url-fetch)
264 (uri (string-append
265 "https://github.com/ldc-developers/druntime/archive/ldc-v"
266 older-version ".tar.gz"))
267 (sha256
268 (base32
836cbd9f 269 "07qvrqj6vgakd6qr4x5f70w6zwkzd1li5x8i1b5ywnds1z5lnfp6"))))
2429dde5
MFM
270 ("dmd-testsuite-src"
271 ,(origin
272 (method url-fetch)
273 (uri (string-append
274 "https://github.com/ldc-developers/dmd-testsuite/archive/ldc-v"
275 older-version ".tar.gz"))
276 (sha256
277 (base32
836cbd9f 278 "12cak7yqmsgjlflx0dp6fwmwb9dac25amgi86n0bb95ard3547wy"))
2429dde5
MFM
279 ;; Remove the gdb tests that fails with a "Error: No such file or
280 ;; directory" error, despite the files being present in the debug
281 ;; files left with the --keep-failed flag to guix build.
282 (patches (search-patches "ldc-1.1.0-disable-dmd-tests.patch")))))))))
283
836cbd9f 284(define-public ldc-beta ldc)
4fdcc502
DM
285
286(define-public dub
287 (package
288 (name "dub")
bbfc523d 289 (version "1.5.0")
4fdcc502
DM
290 (source (origin
291 (method url-fetch)
292 (uri (string-append "https://github.com/dlang/dub/archive/"
293 "v" version ".tar.gz"))
294 (file-name (string-append name "-" version ".tar.gz"))
295 (sha256
296 (base32
bbfc523d 297 "1p9pmzjsmd7v3jpilv0z0c8ar1ykvri6nn5fv95f8d2vriczj29m"))))
4fdcc502
DM
298 (build-system gnu-build-system)
299 (arguments
300 `(#:tests? #f ; it would have tested itself by installing some packages (vibe etc)
301 #:phases
302 (modify-phases %standard-phases
cd12f922 303 (delete 'configure) ; no configure script
4fdcc502
DM
304 (replace 'build
305 (lambda _
306 (zero? (system* "./build.sh"))))
307 (replace 'install
308 (lambda* (#:key outputs #:allow-other-keys)
309 (let* ((out (assoc-ref outputs "out"))
cd12f922
TGR
310 (bin (string-append out "/bin")))
311 (install-file "bin/dub" bin)
4fdcc502
DM
312 #t))))))
313 (inputs
314 `(("curl" ,curl)))
315 (native-inputs
316 `(("ldc" ,ldc)))
317 (home-page "https://code.dlang.org/getting_started")
27a5c604
TGR
318 (synopsis "Package and build manager for D projects")
319 (description
320 "DUB is a package and build manager for applications and libraries written
321in the D programming language. It can automatically retrieve a project's
322dependencies and integrate them in the build process.
323
324The design emphasis is on maximum simplicity for simple projects, while
325providing the opportunity to customize things when needed. ")
4fdcc502 326 (license license:expat)))