Commit | Line | Data |
---|---|---|
a7ec569c RJ |
1 | ;;; GNU Guix --- Functional package management for GNU |
2 | ;;; Copyright © 2015 Roel Janssen <roel@gnu.org> | |
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) | |
24 | #:use-module (guix build-system cmake) | |
25 | #:use-module (gnu packages) | |
26 | #:use-module (gnu packages base) | |
27 | #:use-module (gnu packages libedit) | |
28 | #:use-module (gnu packages llvm) | |
29 | #:use-module (gnu packages textutils) | |
30 | #:use-module (gnu packages zip)) | |
31 | ||
32 | (define-public ldc | |
33 | (package | |
34 | (name "ldc") | |
35 | (version "0.16.1") | |
36 | (source (origin | |
37 | (method url-fetch) | |
38 | (uri (string-append | |
39 | "https://github.com/ldc-developers/ldc/archive/v" | |
40 | version ".tar.gz")) | |
41 | (file-name (string-append name "-" version ".tar.gz")) | |
42 | (sha256 | |
43 | (base32 | |
44 | "1jvilxx0rpqmkbja4m69fhd5g09697xq7vyqp2hz4hvxmmmv4j40")))) | |
45 | (build-system cmake-build-system) | |
46 | ;; LDC currently only supports the x86_64 and i686 architectures. | |
47 | (supported-systems '("x86_64-linux" "i686-linux")) | |
48 | (arguments | |
49 | `(#:phases | |
50 | (modify-phases %standard-phases | |
51 | (add-after 'unpack 'unpack-submodule-sources | |
52 | (lambda* (#:key inputs #:allow-other-keys) | |
53 | (let ((unpack (lambda (source target) | |
54 | (with-directory-excursion target | |
55 | (zero? (system* "tar" "xvf" | |
56 | (assoc-ref inputs source) | |
57 | "--strip-components=1")))))) | |
58 | (and (unpack "phobos-src" "runtime/phobos") | |
59 | (unpack "druntime-src" "runtime/druntime") | |
60 | (unpack "dmd-testsuite-src" "tests/d2/dmd-testsuite"))))) | |
61 | (add-after 'unpack-submodule-sources 'patch-phobos | |
62 | (lambda* (#:key inputs #:allow-other-keys) | |
63 | (substitute* "runtime/phobos/std/process.d" | |
64 | (("/bin/sh") (which "sh")) | |
65 | (("echo") (which "echo"))) | |
66 | (substitute* "runtime/phobos/std/datetime.d" | |
67 | (("/usr/share/zoneinfo/") | |
68 | (string-append (assoc-ref inputs "tzdata") "/share/zoneinfo"))) | |
69 | (substitute* "tests/d2/dmd-testsuite/Makefile" | |
70 | (("/bin/bash") (which "bash"))) | |
71 | #t))))) | |
72 | (inputs | |
73 | `(("libconfig" ,libconfig) | |
74 | ("libedit" ,libedit) | |
75 | ("tzdata" ,tzdata))) | |
76 | (native-inputs | |
77 | `(("llvm" ,llvm) | |
78 | ("clang" ,clang) | |
79 | ("unzip" ,unzip) | |
80 | ("phobos-src" | |
81 | ,(origin | |
82 | (method url-fetch) | |
83 | (uri (string-append | |
84 | "https://github.com/ldc-developers/phobos/archive/ldc-v" | |
85 | version ".tar.gz")) | |
86 | (sha256 | |
87 | (base32 | |
88 | "0sgdj0536c4nb118yiw1f8lqy5d3g3lpg9l99l165lk9xy45l9z4")) | |
89 | (patches (list (search-patch "ldc-disable-tests.patch"))))) | |
90 | ("druntime-src" | |
91 | ,(origin | |
92 | (method url-fetch) | |
93 | (uri (string-append | |
94 | "https://github.com/ldc-developers/druntime/archive/ldc-v" | |
95 | version ".tar.gz")) | |
96 | (sha256 | |
97 | (base32 | |
98 | "0z4mkyddx6c4sy1vqgqvavz55083dsxws681qkh93jh1rpby9yg6")))) | |
99 | ("dmd-testsuite-src" | |
100 | ,(origin | |
101 | (method url-fetch) | |
102 | (uri (string-append | |
103 | "https://github.com/ldc-developers/dmd-testsuite/archive/ldc-v" | |
104 | version ".tar.gz")) | |
105 | (sha256 | |
106 | (base32 | |
107 | "0yc6miidzgl9k33ygk7xcppmfd6kivqj02cvv4fmkbs3qz4yy3z1")))))) | |
108 | (home-page "http://wiki.dlang.org/LDC") | |
109 | (synopsis "LLVM compiler for the D programming language") | |
110 | (description | |
111 | "LDC is a compiler for the D programming language. It is based on the | |
112 | latest DMD frontend and uses LLVM as backend.") | |
113 | ;; Most of the code is released under BSD-3, except for code originally | |
114 | ;; written for GDC, which is released under GPLv2+, and the DMD frontend, | |
115 | ;; which is released under the "Boost Software License version 1.0". | |
116 | (license (list license:bsd-3 | |
117 | license:gpl2+ | |
341ae582 | 118 | license:boost1.0)))) |