gnu: ldc: Update to 0.17.2.
[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
RJ
3;;; Copyright © 2015 Pjotr Prins <pjotr.guix@thebird.nl>
4;;;
5;;; This file is part of GNU Guix.
6;;;
7;;; GNU Guix is free software; you can redistribute it and/or modify it
8;;; under the terms of the GNU General Public License as published by
9;;; the Free Software Foundation; either version 3 of the License, or (at
10;;; your option) any later version.
11;;;
12;;; GNU Guix is distributed in the hope that it will be useful, but
13;;; WITHOUT ANY WARRANTY; without even the implied warranty of
14;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15;;; GNU General Public License for more details.
16;;;
17;;; You should have received a copy of the GNU General Public License
18;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
19
20(define-module (gnu packages ldc)
21 #:use-module ((guix licenses) #:prefix license:)
22 #:use-module (guix packages)
23 #:use-module (guix download)
c1fc7a67
RJ
24 #:use-module (guix git-download)
25 #:use-module (guix build-system gnu)
a7ec569c
RJ
26 #:use-module (guix build-system cmake)
27 #:use-module (gnu packages)
28 #:use-module (gnu packages base)
812b3c1f 29 #:use-module (gnu packages compression)
a7ec569c
RJ
30 #:use-module (gnu packages libedit)
31 #:use-module (gnu packages llvm)
32 #:use-module (gnu packages textutils)
33 #:use-module (gnu packages zip))
34
c1fc7a67
RJ
35(define-public rdmd
36 (let ((commit "da0a2e0a379b08294015eec9d531f1e5dd4226f0"))
37 (package
38 (name "rdmd")
39 (version (string-append "v2.070.0-1." (string-take commit 7)))
40 (source (origin
41 (method git-fetch)
42 (uri (git-reference
43 (url "https://github.com/D-Programming-Language/tools.git")
44 (commit commit)))
45 (file-name (string-append name "-" version "-checkout"))
46 (sha256
47 (base32
48 "1pcx5lyqzrip86f4vv60x292rpvnwsq2hvl1znm9x9rn68f34m45"))))
49 (build-system gnu-build-system)
50 (arguments
51 '(#:phases
52 (modify-phases %standard-phases
53 (delete 'configure)
54 (delete 'check) ; There is no Makefile, so there's no 'make check'.
55 (replace
56 'build
57 (lambda _
58 (zero? (system* "ldc2" "rdmd.d"))))
59 (replace
60 'install
61 (lambda* (#:key outputs #:allow-other-keys)
62 (let ((bin (string-append (assoc-ref outputs "out") "/bin")))
63 (install-file "rdmd" bin)))))))
64 (native-inputs
65 `(("ldc" ,ldc)))
66 (home-page "https://github.com/D-Programming-Language/tools/")
67 (synopsis "Specialized equivalent to 'make' for the D language")
68 (description
69 "rdmd is a companion to the dmd compiler that simplifies the typical
70edit-compile-link-run or edit-make-run cycle to a rapid edit-run cycle. Like
71make and other tools, rdmd uses the relative dates of the files involved to
72minimize the amount of work necessary. Unlike make, rdmd tracks dependencies
73and freshness without requiring additional information from the user.")
74 (license license:boost1.0))))
75
a7ec569c
RJ
76(define-public ldc
77 (package
78 (name "ldc")
e44b5112 79 (version "0.17.2")
a7ec569c
RJ
80 (source (origin
81 (method url-fetch)
82 (uri (string-append
83 "https://github.com/ldc-developers/ldc/archive/v"
84 version ".tar.gz"))
85 (file-name (string-append name "-" version ".tar.gz"))
86 (sha256
87 (base32
e44b5112 88 "0iksl6cvhsiwnlh15b7s9v8f3grxk27jn0vja9n4sad7fvfwmmlc"))))
a7ec569c 89 (build-system cmake-build-system)
e44b5112 90 (supported-systems '("x86_64-linux" "i686-linux" "armhf-linux"))
a7ec569c
RJ
91 (arguments
92 `(#:phases
93 (modify-phases %standard-phases
94 (add-after 'unpack 'unpack-submodule-sources
95 (lambda* (#:key inputs #:allow-other-keys)
96 (let ((unpack (lambda (source target)
97 (with-directory-excursion target
98 (zero? (system* "tar" "xvf"
99 (assoc-ref inputs source)
100 "--strip-components=1"))))))
101 (and (unpack "phobos-src" "runtime/phobos")
102 (unpack "druntime-src" "runtime/druntime")
103 (unpack "dmd-testsuite-src" "tests/d2/dmd-testsuite")))))
812b3c1f
DM
104 (add-after 'unpack-submodule-sources 'patch-dmd2
105 (lambda* (#:key inputs #:allow-other-keys)
106 (substitute* "dmd2/root/port.c"
107 ((" ::isnan") " isnan")
108 ((" ::isinf") " isinf")
109 (("#undef isnan") "")
110 (("#undef isinf") ""))
111 #t))
a7ec569c
RJ
112 (add-after 'unpack-submodule-sources 'patch-phobos
113 (lambda* (#:key inputs #:allow-other-keys)
114 (substitute* "runtime/phobos/std/process.d"
115 (("/bin/sh") (which "sh"))
116 (("echo") (which "echo")))
117 (substitute* "runtime/phobos/std/datetime.d"
118 (("/usr/share/zoneinfo/")
119 (string-append (assoc-ref inputs "tzdata") "/share/zoneinfo")))
120 (substitute* "tests/d2/dmd-testsuite/Makefile"
121 (("/bin/bash") (which "bash")))
122 #t)))))
123 (inputs
124 `(("libconfig" ,libconfig)
125 ("libedit" ,libedit)
812b3c1f
DM
126 ("tzdata" ,tzdata)
127 ("zlib" ,zlib)))
a7ec569c 128 (native-inputs
e44b5112
DM
129 `(("llvm" ,llvm)
130 ("clang" ,clang)
131 ("python-lit" ,python-lit)
132 ("python-wrapper" ,python-wrapper)
a7ec569c
RJ
133 ("unzip" ,unzip)
134 ("phobos-src"
135 ,(origin
136 (method url-fetch)
137 (uri (string-append
138 "https://github.com/ldc-developers/phobos/archive/ldc-v"
139 version ".tar.gz"))
140 (sha256
141 (base32
e44b5112 142 "07hh3ic3r755mq9hn9gfr0wlc5y8cr91xz2ydb6gqy4zy8jgp5s9"))
fc1adab1 143 (patches (search-patches "ldc-disable-tests.patch"))))
a7ec569c
RJ
144 ("druntime-src"
145 ,(origin
146 (method url-fetch)
147 (uri (string-append
148 "https://github.com/ldc-developers/druntime/archive/ldc-v"
149 version ".tar.gz"))
150 (sha256
151 (base32
e44b5112 152 "1m1dhday9dl3s04njmd29z7ism2xn2ksb9qlrwzykdgz27b3dk6x"))))
a7ec569c
RJ
153 ("dmd-testsuite-src"
154 ,(origin
155 (method url-fetch)
156 (uri (string-append
157 "https://github.com/ldc-developers/dmd-testsuite/archive/ldc-v"
158 version ".tar.gz"))
159 (sha256
160 (base32
e44b5112 161 "0n7gvalxwfmia4gag53r9qhcnk2cqrw3n4icj1yri0zkgc27pm60"))))))
a7ec569c
RJ
162 (home-page "http://wiki.dlang.org/LDC")
163 (synopsis "LLVM compiler for the D programming language")
164 (description
165 "LDC is a compiler for the D programming language. It is based on the
166latest DMD frontend and uses LLVM as backend.")
167 ;; Most of the code is released under BSD-3, except for code originally
168 ;; written for GDC, which is released under GPLv2+, and the DMD frontend,
169 ;; which is released under the "Boost Software License version 1.0".
170 (license (list license:bsd-3
171 license:gpl2+
341ae582 172 license:boost1.0))))