Commit | Line | Data |
---|---|---|
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> |
a7ec569c RJ |
5 | ;;; |
6 | ;;; This file is part of GNU Guix. | |
7 | ;;; | |
8 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | |
9 | ;;; under the terms of the GNU General Public License as published by | |
10 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
11 | ;;; your option) any later version. | |
12 | ;;; | |
13 | ;;; GNU Guix is distributed in the hope that it will be useful, but | |
14 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | ;;; GNU General Public License for more details. | |
17 | ;;; | |
18 | ;;; You should have received a copy of the GNU General Public License | |
19 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | |
20 | ||
21 | (define-module (gnu packages ldc) | |
22 | #:use-module ((guix licenses) #:prefix license:) | |
23 | #:use-module (guix packages) | |
24 | #:use-module (guix download) | |
c1fc7a67 RJ |
25 | #:use-module (guix git-download) |
26 | #:use-module (guix build-system gnu) | |
a7ec569c RJ |
27 | #:use-module (guix build-system cmake) |
28 | #:use-module (gnu packages) | |
29 | #:use-module (gnu packages base) | |
812b3c1f | 30 | #:use-module (gnu packages compression) |
4fdcc502 | 31 | #:use-module (gnu packages curl) |
2429dde5 | 32 | #:use-module (gnu packages gdb) |
a7ec569c RJ |
33 | #:use-module (gnu packages libedit) |
34 | #:use-module (gnu packages llvm) | |
0959478c | 35 | #:use-module (gnu packages python) |
a7ec569c RJ |
36 | #:use-module (gnu packages textutils) |
37 | #:use-module (gnu packages zip)) | |
38 | ||
c1fc7a67 | 39 | (define-public rdmd |
55330714 DM |
40 | (package |
41 | (name "rdmd") | |
42 | (version "2.073.0") | |
43 | (source (origin | |
44 | (method url-fetch) | |
45 | (uri (string-append "https://github.com/dlang/tools/archive/v" version ".tar.gz")) | |
46 | (file-name (string-append name "-" version ".tar.gz")) | |
47 | (sha256 | |
48 | (base32 | |
49 | "01if3ivnb7g2myfhymp4d9346s4vmvcl82i1kxfs5iza45almh7v")))) | |
50 | (build-system gnu-build-system) | |
51 | (arguments | |
52 | '(#:phases | |
53 | (modify-phases %standard-phases | |
54 | (delete 'configure) | |
55 | (delete 'check) ; There is no Makefile, so there's no 'make check'. | |
56 | (replace | |
57 | 'build | |
58 | (lambda _ | |
59 | (zero? (system* "ldc2" "rdmd.d")))) | |
60 | (replace | |
61 | 'install | |
62 | (lambda* (#:key outputs #:allow-other-keys) | |
63 | (let ((bin (string-append (assoc-ref outputs "out") "/bin"))) | |
64 | (install-file "rdmd" bin))))))) | |
65 | (native-inputs | |
66 | `(("ldc" ,ldc))) | |
67 | (home-page "https://github.com/D-Programming-Language/tools/") | |
68 | (synopsis "Specialized equivalent to 'make' for the D language") | |
69 | (description | |
70 | "rdmd is a companion to the dmd compiler that simplifies the typical | |
c1fc7a67 RJ |
71 | edit-compile-link-run or edit-make-run cycle to a rapid edit-run cycle. Like |
72 | make and other tools, rdmd uses the relative dates of the files involved to | |
73 | minimize the amount of work necessary. Unlike make, rdmd tracks dependencies | |
74 | and freshness without requiring additional information from the user.") | |
55330714 | 75 | (license license:boost1.0))) |
c1fc7a67 | 76 | |
beffaf9a | 77 | (define-public ldc-bootstrap |
a7ec569c RJ |
78 | (package |
79 | (name "ldc") | |
bcd2fddd | 80 | (version "0.17.3") |
a7ec569c RJ |
81 | (source (origin |
82 | (method url-fetch) | |
83 | (uri (string-append | |
84 | "https://github.com/ldc-developers/ldc/archive/v" | |
85 | version ".tar.gz")) | |
86 | (file-name (string-append name "-" version ".tar.gz")) | |
87 | (sha256 | |
88 | (base32 | |
bcd2fddd | 89 | "135rgwwk82ccqp4n3fhqz4696jmvip90fg5ql2kccq5h1r71gb82")))) |
a7ec569c | 90 | (build-system cmake-build-system) |
e44b5112 | 91 | (supported-systems '("x86_64-linux" "i686-linux" "armhf-linux")) |
a7ec569c RJ |
92 | (arguments |
93 | `(#:phases | |
94 | (modify-phases %standard-phases | |
95 | (add-after 'unpack 'unpack-submodule-sources | |
96 | (lambda* (#:key inputs #:allow-other-keys) | |
97 | (let ((unpack (lambda (source target) | |
98 | (with-directory-excursion target | |
99 | (zero? (system* "tar" "xvf" | |
100 | (assoc-ref inputs source) | |
101 | "--strip-components=1")))))) | |
102 | (and (unpack "phobos-src" "runtime/phobos") | |
103 | (unpack "druntime-src" "runtime/druntime") | |
104 | (unpack "dmd-testsuite-src" "tests/d2/dmd-testsuite"))))) | |
812b3c1f DM |
105 | (add-after 'unpack-submodule-sources 'patch-dmd2 |
106 | (lambda* (#:key inputs #:allow-other-keys) | |
107 | (substitute* "dmd2/root/port.c" | |
108 | ((" ::isnan") " isnan") | |
109 | ((" ::isinf") " isinf") | |
110 | (("#undef isnan") "") | |
111 | (("#undef isinf") "")) | |
112 | #t)) | |
a7ec569c RJ |
113 | (add-after 'unpack-submodule-sources 'patch-phobos |
114 | (lambda* (#:key inputs #:allow-other-keys) | |
115 | (substitute* "runtime/phobos/std/process.d" | |
116 | (("/bin/sh") (which "sh")) | |
117 | (("echo") (which "echo"))) | |
118 | (substitute* "runtime/phobos/std/datetime.d" | |
119 | (("/usr/share/zoneinfo/") | |
120 | (string-append (assoc-ref inputs "tzdata") "/share/zoneinfo"))) | |
121 | (substitute* "tests/d2/dmd-testsuite/Makefile" | |
122 | (("/bin/bash") (which "bash"))) | |
123 | #t))))) | |
124 | (inputs | |
125 | `(("libconfig" ,libconfig) | |
126 | ("libedit" ,libedit) | |
812b3c1f DM |
127 | ("tzdata" ,tzdata) |
128 | ("zlib" ,zlib))) | |
a7ec569c | 129 | (native-inputs |
e44b5112 DM |
130 | `(("llvm" ,llvm) |
131 | ("clang" ,clang) | |
132 | ("python-lit" ,python-lit) | |
133 | ("python-wrapper" ,python-wrapper) | |
a7ec569c RJ |
134 | ("unzip" ,unzip) |
135 | ("phobos-src" | |
136 | ,(origin | |
137 | (method url-fetch) | |
138 | (uri (string-append | |
139 | "https://github.com/ldc-developers/phobos/archive/ldc-v" | |
140 | version ".tar.gz")) | |
141 | (sha256 | |
142 | (base32 | |
bcd2fddd | 143 | "0qywnvnp019mmmr74aw90ir9f03iz0hc7cgzna609agsar0b27jl")) |
fc1adab1 | 144 | (patches (search-patches "ldc-disable-tests.patch")))) |
a7ec569c RJ |
145 | ("druntime-src" |
146 | ,(origin | |
147 | (method url-fetch) | |
148 | (uri (string-append | |
149 | "https://github.com/ldc-developers/druntime/archive/ldc-v" | |
150 | version ".tar.gz")) | |
151 | (sha256 | |
152 | (base32 | |
bcd2fddd | 153 | "0z418n6x2fxac07sxpi4rl69069qiym4w6r9sjppn91q58qh8hjs")))) |
a7ec569c RJ |
154 | ("dmd-testsuite-src" |
155 | ,(origin | |
156 | (method url-fetch) | |
157 | (uri (string-append | |
158 | "https://github.com/ldc-developers/dmd-testsuite/archive/ldc-v" | |
159 | version ".tar.gz")) | |
160 | (sha256 | |
161 | (base32 | |
bcd2fddd | 162 | "196mkfax5y3yqm3gz7jhqhnkjwrvr2m4a8nc9k41l0511ldzsk9x")))))) |
a7ec569c RJ |
163 | (home-page "http://wiki.dlang.org/LDC") |
164 | (synopsis "LLVM compiler for the D programming language") | |
165 | (description | |
166 | "LDC is a compiler for the D programming language. It is based on the | |
167 | latest DMD frontend and uses LLVM as backend.") | |
168 | ;; Most of the code is released under BSD-3, except for code originally | |
169 | ;; written for GDC, which is released under GPLv2+, and the DMD frontend, | |
170 | ;; which is released under the "Boost Software License version 1.0". | |
171 | (license (list license:bsd-3 | |
172 | license:gpl2+ | |
341ae582 | 173 | license:boost1.0)))) |
2429dde5 MFM |
174 | |
175 | ||
836cbd9f | 176 | (define-public ldc |
2429dde5 MFM |
177 | ;; The phobos, druntime and dmd-testsuite dependencies do not have a newer |
178 | ;; release than 1.1.0-beta4, hence the need to make use of the older-version | |
179 | ;; variable to hold this variable. | |
836cbd9f | 180 | (let ((older-version "1.1.0")) |
2429dde5 | 181 | (package |
beffaf9a | 182 | (inherit ldc-bootstrap) |
2429dde5 | 183 | (name "ldc") |
219369ce | 184 | (version "1.1.1") |
2429dde5 MFM |
185 | ;; Beta version needed to compile various scientific tools that require |
186 | ;; the newer beta versions, and won't compile successfully with the | |
187 | ;; older stable version. | |
188 | (source (origin | |
189 | (method url-fetch) | |
190 | (uri (string-append | |
191 | "https://github.com/ldc-developers/ldc/archive/v" | |
192 | version ".tar.gz")) | |
193 | (file-name (string-append name "-" version ".tar.gz")) | |
194 | (sha256 | |
195 | (base32 | |
219369ce | 196 | "0yjiwg8pnlm2286bwdkwasaqw6ys7lymrqvhh5xyb1adha1ndcav")))) |
2429dde5 MFM |
197 | (arguments |
198 | `(#:phases | |
199 | (modify-phases %standard-phases | |
200 | (add-after 'unpack 'unpack-submodule-sources | |
201 | (lambda* (#:key inputs #:allow-other-keys) | |
202 | (let ((unpack (lambda (source target) | |
203 | (with-directory-excursion target | |
204 | (zero? (system* "tar" "xvf" | |
205 | (assoc-ref inputs source) | |
206 | "--strip-components=1")))))) | |
207 | (and (unpack "phobos-src" "runtime/phobos") | |
208 | (unpack "druntime-src" "runtime/druntime") | |
209 | (unpack "dmd-testsuite-src" "tests/d2/dmd-testsuite"))))) | |
210 | ;; The 'patch-dmd2 step in ldc causes the build to fail since | |
211 | ;; dmd2/root/port.c no longer exists. Arguments needed to have | |
212 | ;; 'patch-dmd2 step removed, but retain everything else. | |
213 | (add-after 'unpack-submodule-sources 'patch-phobos | |
214 | (lambda* (#:key inputs #:allow-other-keys) | |
215 | (substitute* "runtime/phobos/std/process.d" | |
216 | (("/bin/sh") (which "sh")) | |
217 | (("echo") (which "echo"))) | |
218 | (substitute* "runtime/phobos/std/datetime.d" | |
219 | (("/usr/share/zoneinfo/") | |
220 | (string-append (assoc-ref inputs "tzdata") "/share/zoneinfo"))) | |
221 | (substitute* "tests/d2/dmd-testsuite/Makefile" | |
222 | (("/bin/bash") (which "bash"))) | |
223 | #t))))) | |
224 | (native-inputs | |
225 | `(("llvm" ,llvm) | |
226 | ("clang" ,clang) | |
beffaf9a | 227 | ("ldc" ,ldc-bootstrap) |
2429dde5 MFM |
228 | ("python-lit" ,python-lit) |
229 | ("python-wrapper" ,python-wrapper) | |
230 | ("unzip" ,unzip) | |
231 | ("gdb" ,gdb) | |
232 | ("phobos-src" | |
233 | ,(origin | |
234 | (method url-fetch) | |
235 | (uri (string-append | |
236 | "https://github.com/ldc-developers/phobos/archive/ldc-v" | |
237 | older-version ".tar.gz")) | |
238 | (sha256 | |
239 | (base32 | |
836cbd9f | 240 | "0z5v55b9s1ppf0c2ivjq7sbmq688c37c92ihc3qwrbxnqvkkvrlk")) |
2429dde5 MFM |
241 | ;; This patch deactivates some tests that depend on network access |
242 | ;; to pass. It also deactivates some tests that have some reliance | |
243 | ;; on timezone. | |
244 | ;; | |
245 | ;; For the network tests, there's an effort to get a version flag | |
246 | ;; added to deactivate these tests for distribution packagers | |
247 | ;; that is being pursued at | |
248 | ;; <https://forum.dlang.org/post/zmdbdgnzrxyvtpqafvyg@forum.dlang.org>. | |
249 | ;; It also deactivates a test that requires /root | |
250 | (patches (search-patches "ldc-1.1.0-disable-phobos-tests.patch")))) | |
251 | ("druntime-src" | |
252 | ,(origin | |
253 | (method url-fetch) | |
254 | (uri (string-append | |
255 | "https://github.com/ldc-developers/druntime/archive/ldc-v" | |
256 | older-version ".tar.gz")) | |
257 | (sha256 | |
258 | (base32 | |
836cbd9f | 259 | "07qvrqj6vgakd6qr4x5f70w6zwkzd1li5x8i1b5ywnds1z5lnfp6")))) |
2429dde5 MFM |
260 | ("dmd-testsuite-src" |
261 | ,(origin | |
262 | (method url-fetch) | |
263 | (uri (string-append | |
264 | "https://github.com/ldc-developers/dmd-testsuite/archive/ldc-v" | |
265 | older-version ".tar.gz")) | |
266 | (sha256 | |
267 | (base32 | |
836cbd9f | 268 | "12cak7yqmsgjlflx0dp6fwmwb9dac25amgi86n0bb95ard3547wy")) |
2429dde5 MFM |
269 | ;; Remove the gdb tests that fails with a "Error: No such file or |
270 | ;; directory" error, despite the files being present in the debug | |
271 | ;; files left with the --keep-failed flag to guix build. | |
272 | (patches (search-patches "ldc-1.1.0-disable-dmd-tests.patch"))))))))) | |
273 | ||
836cbd9f | 274 | (define-public ldc-beta ldc) |
4fdcc502 DM |
275 | |
276 | (define-public dub | |
277 | (package | |
278 | (name "dub") | |
279 | (version "1.2.0") | |
280 | (source (origin | |
281 | (method url-fetch) | |
282 | (uri (string-append "https://github.com/dlang/dub/archive/" | |
283 | "v" version ".tar.gz")) | |
284 | (file-name (string-append name "-" version ".tar.gz")) | |
285 | (sha256 | |
286 | (base32 | |
287 | "1sd8i1rvxc7y7kk0y6km5zyvaladc5zh56r6afj74ndd63dssv43")))) | |
288 | (build-system gnu-build-system) | |
289 | (arguments | |
290 | `(#:tests? #f ; it would have tested itself by installing some packages (vibe etc) | |
291 | #:phases | |
292 | (modify-phases %standard-phases | |
293 | (delete 'configure) | |
294 | (replace 'build | |
295 | (lambda _ | |
296 | (zero? (system* "./build.sh")))) | |
297 | (replace 'install | |
298 | (lambda* (#:key outputs #:allow-other-keys) | |
299 | (let* ((out (assoc-ref outputs "out")) | |
300 | (outbin (string-append out "/bin"))) | |
301 | (mkdir-p outbin) | |
302 | (install-file "bin/dub" outbin) | |
303 | #t)))))) | |
304 | (inputs | |
305 | `(("curl" ,curl))) | |
306 | (native-inputs | |
307 | `(("ldc" ,ldc))) | |
308 | (home-page "https://code.dlang.org/getting_started") | |
309 | (synopsis "DUB package manager") | |
310 | (description "This package provides the D package manager.") | |
311 | (license license:expat))) |