1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2015, 2016 Roel Janssen <roel@gnu.org>
3 ;;; Copyright © 2015, 2018 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, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
7 ;;; Copyright © 2020 Guy Fleury Iteriteka <gfleury@disroot.org>
8 ;;; Copyright © 2021 Efraim Flashner <efraim@flashner.co.il>
10 ;;; This file is part of GNU Guix.
12 ;;; GNU Guix is free software; you can redistribute it and/or modify it
13 ;;; under the terms of the GNU General Public License as published by
14 ;;; the Free Software Foundation; either version 3 of the License, or (at
15 ;;; your option) any later version.
17 ;;; GNU Guix is distributed in the hope that it will be useful, but
18 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;;; GNU General Public License for more details.
22 ;;; You should have received a copy of the GNU General Public License
23 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
25 (define-module (gnu packages dlang)
26 #:use-module ((guix licenses) #:prefix license:)
27 #:use-module (guix packages)
28 #:use-module (guix download)
29 #:use-module (guix git-download)
30 #:use-module (guix build-system gnu)
31 #:use-module (guix build-system cmake)
32 #:use-module (gnu packages)
33 #:use-module (gnu packages base)
34 #:use-module (gnu packages check)
35 #:use-module (gnu packages compression)
36 #:use-module (gnu packages curl)
37 #:use-module (gnu packages gdb)
38 #:use-module (gnu packages libedit)
39 #:use-module (gnu packages llvm)
40 #:use-module (gnu packages pkg-config)
41 #:use-module (gnu packages python)
42 #:use-module (gnu packages python-xyz)
43 #:use-module (gnu packages textutils)
44 #:use-module (gnu packages xorg))
52 (uri (string-append "https://github.com/dlang/tools/archive/v" version ".tar.gz"))
53 (file-name (string-append name "-" version ".tar.gz"))
56 "0c8w373rv6iz3xfid94w40ncv2lr2ncxi662qsr4lda4aghczmq7"))))
57 (build-system gnu-build-system)
60 (modify-phases %standard-phases
62 (delete 'check) ; There is no Makefile, so there's no 'make check'.
66 (invoke "ldc2" "rdmd.d")))
69 (lambda* (#:key outputs #:allow-other-keys)
70 (let ((bin (string-append (assoc-ref outputs "out") "/bin")))
71 (install-file "rdmd" bin)))))))
74 (home-page "https://github.com/D-Programming-Language/tools/")
75 (synopsis "Specialized equivalent to 'make' for the D language")
77 "rdmd is a companion to the dmd compiler that simplifies the typical
78 edit-compile-link-run or edit-make-run cycle to a rapid edit-run cycle. Like
79 make and other tools, rdmd uses the relative dates of the files involved to
80 minimize the amount of work necessary. Unlike make, rdmd tracks dependencies
81 and freshness without requiring additional information from the user.")
82 (license license:boost1.0)))
84 (define-public ldc-bootstrap
92 (url "https://github.com/ldc-developers/ldc")
93 (commit (string-append "v" version))))
94 (file-name (git-file-name name version))
96 (base32 "1q6hm4fkrcwys83x0p4kfg9xrc1b9g2qicqif2zy5z4nsfsb5vgs"))))
97 (build-system cmake-build-system)
98 (supported-systems '("x86_64-linux" "i686-linux" "armhf-linux"))
100 ;; Some of the tests take a very long time on ARMv7. See
101 ;; <https://lists.gnu.org/archive/html/guix-devel/2018-02/msg00312.html>.
102 `((max-silent-time . ,(* 3600 3))))
105 (modify-phases %standard-phases
106 (add-after 'unpack 'unpack-submodule-sources
107 (lambda* (#:key inputs #:allow-other-keys)
108 (let ((unpack (lambda (input target)
109 (let ((source (assoc-ref inputs input)))
110 ;; Git checkouts are directories as long as
111 ;; there are no patches; tarballs otherwise.
112 (if (file-is-directory? source)
113 (copy-recursively source target)
114 (with-directory-excursion target
115 (invoke "tar" "xvf" source
116 "--strip-components=1")))))))
117 (unpack "phobos-src" "runtime/phobos")
118 (unpack "druntime-src" "runtime/druntime")
119 (unpack "dmd-testsuite-src" "tests/d2/dmd-testsuite")
121 (add-after 'unpack-submodule-sources 'patch-phobos
122 (lambda* (#:key inputs #:allow-other-keys)
123 (substitute* "runtime/phobos/std/process.d"
124 (("/bin/sh") (which "sh"))
125 (("echo") (which "echo")))
126 (substitute* "runtime/phobos/std/datetime.d"
127 (("/usr/share/zoneinfo/")
128 (string-append (assoc-ref inputs "tzdata") "/share/zoneinfo"))
129 (("tzName == \"[+]VERSION\"")
130 "(tzName == \"+VERSION\" || std.algorithm.endsWith(tzName, \"/leapseconds\"))"))
131 (substitute* "tests/d2/dmd-testsuite/Makefile"
132 (("/bin/bash") (which "bash")))
133 ;; the following two tests fail on i686
134 (for-each delete-file '("tests/ir/attributes.d" "tests/ir/align.d")))))))
136 `(("libconfig" ,libconfig)
143 ("python-lit" ,python-lit)
144 ("python-wrapper" ,python-wrapper)
150 (url "https://github.com/ldc-developers/phobos")
151 (commit (string-append "ldc-v" version))))
152 (file-name (git-file-name "phobos" version))
154 (base32 "15jzs38wanks2jfp2izzl7zqrp4c8ai54ppsgm8ws86p3sbbkmj8"))
155 (patches (search-patches "ldc-bootstrap-disable-tests.patch"))))
160 (url "https://github.com/ldc-developers/druntime")
161 (commit (string-append "ldc-v" version))))
162 (file-name (git-file-name "druntime" version))
164 (base32 "00wr2kiggwnd8h7by51fhj1xc65hv1ysip5gbgdbkfar58p2d0bb"))))
169 (url "https://github.com/ldc-developers/dmd-testsuite")
170 (commit (string-append "ldc-v" version))))
171 (file-name (git-file-name "dmd-testsuite" version))
173 (base32 "1d1c0979wbippldrkjf7szyj4n87hxz8dwqg1r5b3aai37g9kcky"))))))
174 (home-page "http://wiki.dlang.org/LDC")
175 (synopsis "LLVM-based compiler for the D programming language")
177 "LDC is an LLVM compiler for the D programming language. It is based on
178 the latest DMD compiler that was written in C and is used for
179 bootstrapping more recent compilers written in D.")
180 ;; Most of the code is released under BSD-3, except for code originally
181 ;; written for GDC, which is released under GPLv2+, and the DMD frontend,
182 ;; which is released under the "Boost Software License version 1.0".
183 (license (list license:bsd-3
188 ;; Phobos, druntime and dmd-testsuite library dependencies do
189 ;; not always have a newer release than the compiler, hence we
190 ;; retain this variable.
191 (let ((older-version "1.10.0")) ;; retain this because sometimes the libs are older
193 (inherit ldc-bootstrap)
200 (url "https://github.com/ldc-developers/ldc")
201 (commit (string-append "v" version))))
202 (file-name (git-file-name name version))
204 (base32 "0qcb2rn01wql7y8qp31blbv3hwmnh3zjgzi2n7k168cxr6rrdhlp"))))
207 (modify-phases %standard-phases
208 (add-after 'unpack 'unpack-submodule-sources
209 (lambda* (#:key inputs #:allow-other-keys)
210 (let ((unpack (lambda (input target)
211 (let ((source (assoc-ref inputs input)))
212 ;; Git checkouts are directories as long as
213 ;; there are no patches; tarballs otherwise.
214 (if (file-is-directory? source)
215 (copy-recursively source target)
216 (with-directory-excursion target
217 (invoke "tar" "xvf" source
218 "--strip-components=1")))))))
219 (unpack "phobos-src" "runtime/phobos")
220 (unpack "druntime-src" "runtime/druntime")
221 (unpack "dmd-testsuite-src" "tests/d2/dmd-testsuite")
223 (add-after 'unpack-submodule-sources 'patch-phobos
224 (lambda* (#:key inputs #:allow-other-keys)
225 (substitute* '("runtime/phobos/std/process.d"
226 "tests/linking/linker_switches.d")
227 (("/bin/sh") (which "sh"))
228 (("echo") (which "echo")))
229 (substitute* "tests/d2/dmd-testsuite/Makefile"
230 (("/bin/bash") (which "bash")))
231 ;; disable unittests in the following files. We are discussing with
233 (substitute* '("runtime/phobos/std/net/curl.d"
234 "runtime/phobos/std/datetime/systime.d"
235 "runtime/phobos/std/datetime/timezone.d"
237 (("version(unittest)") "version(skipunittest)")
238 ((" unittest") " version(skipunittest) unittest"))
239 ;; the following tests require a more recent LLVM
240 (delete-file "tests/compilable/ctfe_math.d")
241 (delete-file "tests/debuginfo/nested_gdb.d")
242 (delete-file "tests/debuginfo/classtypes_gdb.d")
243 ;; the following tests plugins we don't have.
244 (delete-file "tests/plugins/addFuncEntryCall/testPlugin.d")
245 ;; the following tests requires AVX instruction set in the CPU.
246 (substitute* "tests/d2/dmd-testsuite/runnable/test_cdvecfill.d"
247 (("^// DISABLED: ") "^// DISABLED: linux64 "))
250 (lambda* (#:key inputs outputs #:allow-other-keys)
251 ;; some tests call into gdb binary which needs SHELL and CC set
252 (setenv "SHELL" (which "sh"))
253 (setenv "CC" (string-append (assoc-ref inputs "gcc") "/bin/gcc"))
254 (invoke "make" "test" "-j" (number->string (parallel-job-count))))))))
258 ("ldc" ,ldc-bootstrap)
259 ("python-lit" ,python-lit)
260 ("python-wrapper" ,python-wrapper)
267 (url "https://github.com/ldc-developers/phobos")
268 (commit (string-append "ldc-v" older-version))))
269 (file-name (git-file-name "phobos" older-version))
271 (base32 "1gmlwnjdcf6s5aahadxsif9l5nyaj0rrn379g6fmhcvdk64kf509"))
272 ;; This patch deactivates some tests that depend on network access
273 ;; to pass. It also deactivates some tests that have some reliance
276 ;; For the network tests, there's an effort to get a version flag
277 ;; added to deactivate these tests for distribution packagers
278 ;; that is being pursued at
279 ;; <https://forum.dlang.org/post/zmdbdgnzrxyvtpqafvyg@forum.dlang.org>.
280 ;; It also deactivates a test that requires /root
281 (patches (search-patches "ldc-disable-phobos-tests.patch"))))
286 (url "https://github.com/ldc-developers/druntime")
287 (commit (string-append "ldc-v" older-version))))
288 (file-name (git-file-name "druntime" older-version))
290 (base32 "0a3yyjcnpvm5fbdczf76fx08kl154w17w06hlxf0j3p1p4jc85aj"))))
295 (url "https://github.com/ldc-developers/dmd-testsuite")
296 (commit (string-append "ldc-v" older-version))))
297 (file-name (git-file-name "dmd-testsuite" older-version))
299 (base32 "0mm3rliki1nqiqfaha7ssvm156aa398vpvf4v6895m7nn1mz7rss")))))))))
309 (url "https://github.com/dlang/dub")
310 (commit (string-append "v" version))))
311 (file-name (git-file-name name version))
313 (base32 "073ibvgm1gphcqs1yjrav9ryp677nh3b194nxmvicwgvdc0sb6w9"))))
314 (build-system gnu-build-system)
316 `(#:tests? #f ; it would have tested itself by installing some packages (vibe etc)
318 (modify-phases %standard-phases
319 (delete 'configure) ; no configure script
322 (invoke "./build.sh")))
324 (lambda* (#:key outputs #:allow-other-keys)
325 (let* ((out (assoc-ref outputs "out"))
326 (bin (string-append out "/bin")))
327 (install-file "bin/dub" bin)
333 (home-page "https://code.dlang.org/getting_started")
334 (synopsis "Package and build manager for D projects")
336 "DUB is a package and build manager for applications and
337 libraries written in the D programming language. It can
338 automatically retrieve a project's dependencies and integrate
339 them in the build process.
341 The design emphasis is on maximum simplicity for simple projects,
342 while providing the opportunity to customize things when
344 (license license:expat)))
352 (method url-fetch/zipbomb)
353 (uri (string-append "https://gtkd.org/Downloads/sources/GtkD-"
356 (base32 "0qv8qlpwwb1d078pnrf0a59vpbkziyf53cf9p6m8ms542wbcxllp"))))
357 (build-system gnu-build-system)
361 ("pkg-config" ,pkg-config)
362 ("xorg-server-for-tests" ,xorg-server-for-tests)))
364 `(#:test-target "test"
367 ,(string-append "prefix=" (assoc-ref %outputs "out"))
368 ,(string-append "libdir=" (assoc-ref %outputs "out")
371 (modify-phases %standard-phases
373 (add-before 'build 'patch-makefile
374 (lambda* (#:key outputs #:allow-other-keys)
375 (substitute* "GNUmakefile"
376 ;; We do the tests ourselves.
377 (("default-goal: libs test") "default-goal: libs")
378 (("all: libs shared-libs test") "all: libs shared-libs")
379 ;; Work around upstream bug.
380 (("\\$\\(prefix\\)\\/\\$\\(libdir\\)") "$(libdir)"))
382 (add-before 'check 'prepare-x
385 (setenv "DISPLAY" ":1")
387 (home-page "https://gtkd.org/")
388 (synopsis "D binding and OO wrapper of GTK+")
389 (description "This package provides bindings to GTK+ for D.")
390 (license license:lgpl2.1)))