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> |
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 |
73 | edit-compile-link-run or edit-make-run cycle to a rapid edit-run cycle. Like |
74 | make and other tools, rdmd uses the relative dates of the files involved to | |
75 | minimize the amount of work necessary. Unlike make, rdmd tracks dependencies | |
76 | and 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")))))) | |
168 | (home-page "http://wiki.dlang.org/LDC") | |
169 | (synopsis "LLVM compiler for the D programming language") | |
170 | (description | |
171 | "LDC is a compiler for the D programming language. It is based on the | |
a7ec569c | 172 | latest DMD frontend and uses LLVM as backend.") |
5144c044 DM |
173 | ;; Most of the code is released under BSD-3, except for code originally |
174 | ;; written for GDC, which is released under GPLv2+, and the DMD frontend, | |
175 | ;; which is released under the "Boost Software License version 1.0". | |
176 | (license (list license:bsd-3 | |
177 | license:gpl2+ | |
178 | license:boost1.0))))) | |
2429dde5 | 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") | |
bbfc523d | 283 | (version "1.5.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 | |
bbfc523d | 291 | "1p9pmzjsmd7v3jpilv0z0c8ar1ykvri6nn5fv95f8d2vriczj29m")))) |
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 | |
315 | in the D programming language. It can automatically retrieve a project's | |
316 | dependencies and integrate them in the build process. | |
317 | ||
318 | The design emphasis is on maximum simplicity for simple projects, while | |
319 | providing the opportunity to customize things when needed. ") | |
4fdcc502 | 320 | (license license:expat))) |