gnu: packages: Use 'search-patches' everywhere.
[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)
29 #:use-module (gnu packages libedit)
30 #:use-module (gnu packages llvm)
31 #:use-module (gnu packages textutils)
32 #:use-module (gnu packages zip))
33
c1fc7a67
RJ
34(define-public rdmd
35 (let ((commit "da0a2e0a379b08294015eec9d531f1e5dd4226f0"))
36 (package
37 (name "rdmd")
38 (version (string-append "v2.070.0-1." (string-take commit 7)))
39 (source (origin
40 (method git-fetch)
41 (uri (git-reference
42 (url "https://github.com/D-Programming-Language/tools.git")
43 (commit commit)))
44 (file-name (string-append name "-" version "-checkout"))
45 (sha256
46 (base32
47 "1pcx5lyqzrip86f4vv60x292rpvnwsq2hvl1znm9x9rn68f34m45"))))
48 (build-system gnu-build-system)
49 (arguments
50 '(#:phases
51 (modify-phases %standard-phases
52 (delete 'configure)
53 (delete 'check) ; There is no Makefile, so there's no 'make check'.
54 (replace
55 'build
56 (lambda _
57 (zero? (system* "ldc2" "rdmd.d"))))
58 (replace
59 'install
60 (lambda* (#:key outputs #:allow-other-keys)
61 (let ((bin (string-append (assoc-ref outputs "out") "/bin")))
62 (install-file "rdmd" bin)))))))
63 (native-inputs
64 `(("ldc" ,ldc)))
65 (home-page "https://github.com/D-Programming-Language/tools/")
66 (synopsis "Specialized equivalent to 'make' for the D language")
67 (description
68 "rdmd is a companion to the dmd compiler that simplifies the typical
69edit-compile-link-run or edit-make-run cycle to a rapid edit-run cycle. Like
70make and other tools, rdmd uses the relative dates of the files involved to
71minimize the amount of work necessary. Unlike make, rdmd tracks dependencies
72and freshness without requiring additional information from the user.")
73 (license license:boost1.0))))
74
a7ec569c
RJ
75(define-public ldc
76 (package
77 (name "ldc")
78 (version "0.16.1")
79 (source (origin
80 (method url-fetch)
81 (uri (string-append
82 "https://github.com/ldc-developers/ldc/archive/v"
83 version ".tar.gz"))
84 (file-name (string-append name "-" version ".tar.gz"))
85 (sha256
86 (base32
87 "1jvilxx0rpqmkbja4m69fhd5g09697xq7vyqp2hz4hvxmmmv4j40"))))
88 (build-system cmake-build-system)
89 ;; LDC currently only supports the x86_64 and i686 architectures.
90 (supported-systems '("x86_64-linux" "i686-linux"))
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")))))
104 (add-after 'unpack-submodule-sources 'patch-phobos
105 (lambda* (#:key inputs #:allow-other-keys)
106 (substitute* "runtime/phobos/std/process.d"
107 (("/bin/sh") (which "sh"))
108 (("echo") (which "echo")))
109 (substitute* "runtime/phobos/std/datetime.d"
110 (("/usr/share/zoneinfo/")
111 (string-append (assoc-ref inputs "tzdata") "/share/zoneinfo")))
112 (substitute* "tests/d2/dmd-testsuite/Makefile"
113 (("/bin/bash") (which "bash")))
114 #t)))))
115 (inputs
116 `(("libconfig" ,libconfig)
117 ("libedit" ,libedit)
118 ("tzdata" ,tzdata)))
119 (native-inputs
120 `(("llvm" ,llvm)
121 ("clang" ,clang)
122 ("unzip" ,unzip)
123 ("phobos-src"
124 ,(origin
125 (method url-fetch)
126 (uri (string-append
127 "https://github.com/ldc-developers/phobos/archive/ldc-v"
128 version ".tar.gz"))
129 (sha256
130 (base32
131 "0sgdj0536c4nb118yiw1f8lqy5d3g3lpg9l99l165lk9xy45l9z4"))
fc1adab1 132 (patches (search-patches "ldc-disable-tests.patch"))))
a7ec569c
RJ
133 ("druntime-src"
134 ,(origin
135 (method url-fetch)
136 (uri (string-append
137 "https://github.com/ldc-developers/druntime/archive/ldc-v"
138 version ".tar.gz"))
139 (sha256
140 (base32
141 "0z4mkyddx6c4sy1vqgqvavz55083dsxws681qkh93jh1rpby9yg6"))))
142 ("dmd-testsuite-src"
143 ,(origin
144 (method url-fetch)
145 (uri (string-append
146 "https://github.com/ldc-developers/dmd-testsuite/archive/ldc-v"
147 version ".tar.gz"))
148 (sha256
149 (base32
150 "0yc6miidzgl9k33ygk7xcppmfd6kivqj02cvv4fmkbs3qz4yy3z1"))))))
151 (home-page "http://wiki.dlang.org/LDC")
152 (synopsis "LLVM compiler for the D programming language")
153 (description
154 "LDC is a compiler for the D programming language. It is based on the
155latest DMD frontend and uses LLVM as backend.")
156 ;; Most of the code is released under BSD-3, except for code originally
157 ;; written for GDC, which is released under GPLv2+, and the DMD frontend,
158 ;; which is released under the "Boost Software License version 1.0".
159 (license (list license:bsd-3
160 license:gpl2+
341ae582 161 license:boost1.0))))