You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

236 lines
9.7 KiB

  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2015, 2016 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. (define-module (gn packages ldc)
  20. #:use-module ((guix licenses) #:prefix license:)
  21. #:use-module (guix packages)
  22. #:use-module (guix download)
  23. #:use-module (guix git-download)
  24. #:use-module (guix build-system gnu)
  25. #:use-module (guix build-system cmake)
  26. #:use-module (gnu packages)
  27. #:use-module (gnu packages base)
  28. #:use-module (gnu packages compression)
  29. #:use-module ((gnu packages ldc) #:prefix ldcmain:)
  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. (define-public ldc-0.17.2
  35. (package
  36. (inherit ldcmain:ldc)
  37. (name "ldc")
  38. (version "0.17.2")
  39. (source (origin
  40. (method url-fetch)
  41. (uri (string-append
  42. "https://github.com/ldc-developers/ldc/archive/v"
  43. version ".tar.gz"))
  44. (file-name (string-append name "-" version ".tar.gz"))
  45. (sha256
  46. (base32
  47. "0iksl6cvhsiwnlh15b7s9v8f3grxk27jn0vja9n4sad7fvfwmmlc"))))
  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-dmd2
  62. (lambda* (#:key inputs #:allow-other-keys)
  63. (substitute* "dmd2/root/port.c"
  64. ((" ::isnan") " isnan")
  65. ((" ::isinf") " isinf")
  66. (("#undef isnan") "")
  67. (("#undef isinf") ""))
  68. #t))
  69. (add-after 'unpack-submodule-sources 'patch-phobos
  70. (lambda* (#:key inputs #:allow-other-keys)
  71. (substitute* "runtime/phobos/std/process.d"
  72. (("/bin/sh") (which "sh"))
  73. (("echo") (which "echo")))
  74. (substitute* "runtime/phobos/std/datetime.d"
  75. (("/usr/share/zoneinfo/")
  76. (string-append (assoc-ref inputs "tzdata") "/share/zoneinfo")))
  77. (substitute* "tests/d2/dmd-testsuite/Makefile"
  78. (("/bin/bash") (which "bash")))
  79. #t)))
  80. #:tests? #f))
  81. (native-inputs
  82. `(("llvm" ,llvm-3.7)
  83. ("clang" ,clang-3.7)
  84. ("zlib" ,zlib)
  85. ("unzip" ,unzip)
  86. ("phobos-src"
  87. ,(origin
  88. (method url-fetch)
  89. (uri (string-append
  90. "https://github.com/ldc-developers/phobos/archive/ldc-v"
  91. version ".tar.gz"))
  92. (file-name (string-append "ldc-phobos-" version ".tar.gz"))
  93. (sha256
  94. (base32
  95. "07hh3ic3r755mq9hn9gfr0wlc5y8cr91xz2ydb6gqy4zy8jgp5s9"))))
  96. ("druntime-src"
  97. ,(origin
  98. (method url-fetch)
  99. (uri (string-append
  100. "https://github.com/ldc-developers/druntime/archive/ldc-v"
  101. version ".tar.gz"))
  102. (file-name (string-append "ldc-druntime-" version ".tar.gz"))
  103. (sha256
  104. (base32
  105. "1m1dhday9dl3s04njmd29z7ism2xn2ksb9qlrwzykdgz27b3dk6x"))))
  106. ("dmd-testsuite-src"
  107. ,(origin
  108. (method url-fetch)
  109. (uri (string-append
  110. "https://github.com/ldc-developers/dmd-testsuite/archive/ldc-v"
  111. version ".tar.gz"))
  112. (file-name (string-append "testsuite-" version ".tar.gz"))
  113. (sha256
  114. (base32
  115. "0n7gvalxwfmia4gag53r9qhcnk2cqrw3n4icj1yri0zkgc27pm60"))))))))
  116. (define-public ldc-1.1.0
  117. (let ((version2 "1.1.0")) ; libraries have not been updated
  118. (package
  119. (inherit ldcmain:ldc)
  120. (name "ldc")
  121. (version "1.1.0")
  122. (source (origin
  123. (method url-fetch)
  124. (uri (string-append
  125. "https://github.com/ldc-developers/ldc/archive/v"
  126. version ".tar.gz"))
  127. (file-name (string-append name "-" version ".tar.gz"))
  128. (sha256
  129. (base32
  130. "10zkrmx9bcmhfxvgykm3fkjamzc8js96wm032bv0fyil5c9ja2y1"))))
  131. (arguments
  132. `(#:phases
  133. (modify-phases %standard-phases
  134. (add-after 'unpack 'unpack-submodule-sources
  135. (lambda* (#:key inputs #:allow-other-keys)
  136. (let ((unpack (lambda (source target)
  137. (with-directory-excursion target
  138. (zero? (system* "tar" "xvf"
  139. (assoc-ref inputs source)
  140. "--strip-components=1"))))))
  141. (and (unpack "phobos-src" "runtime/phobos")
  142. (unpack "druntime-src" "runtime/druntime")
  143. (unpack "dmd-testsuite-src" "tests/d2/dmd-testsuite")))))
  144. (add-after 'unpack-submodule-sources 'patch-phobos
  145. (lambda* (#:key inputs #:allow-other-keys)
  146. (substitute* "runtime/phobos/std/process.d"
  147. (("/bin/sh") (which "sh"))
  148. (("echo") (which "echo")))
  149. (substitute* "runtime/phobos/std/datetime.d"
  150. (("/usr/share/zoneinfo/")
  151. (string-append (assoc-ref inputs "tzdata") "/share/zoneinfo")))
  152. (substitute* "tests/d2/dmd-testsuite/Makefile"
  153. (("/bin/bash") (which "bash")))
  154. #t)))
  155. #:tests? #f))
  156. (native-inputs
  157. `(("llvm" ,llvm-3.7)
  158. ("ldc" ,ldc-0.17.2)
  159. ("zlib" ,zlib)
  160. ("phobos-src"
  161. ,(origin
  162. (method url-fetch)
  163. (uri (string-append
  164. "https://github.com/ldc-developers/phobos/archive/ldc-v"
  165. version2 ".tar.gz")) ; older version
  166. (file-name (string-append "ldc-phobos-" version2 ".tar.gz"))
  167. (sha256
  168. (base32
  169. "0z5v55b9s1ppf0c2ivjq7sbmq688c37c92ihc3qwrbxnqvkkvrlk"))))
  170. ("druntime-src"
  171. ,(origin
  172. (method url-fetch)
  173. (uri (string-append
  174. "https://github.com/ldc-developers/druntime/archive/ldc-v"
  175. version2 ".tar.gz"))
  176. (file-name (string-append "ldc-druntime-" version2 ".tar.gz"))
  177. (patches (search-patches "ldc-druntime-finiTLSRanges.patch"))
  178. (sha256
  179. (base32
  180. "07qvrqj6vgakd6qr4x5f70w6zwkzd1li5x8i1b5ywnds1z5lnfp6"))))
  181. ("dmd-testsuite-src"
  182. ,(origin
  183. (method url-fetch)
  184. (uri (string-append
  185. "https://github.com/ldc-developers/dmd-testsuite/archive/ldc-v"
  186. version2 ".tar.gz")) ; version is behind
  187. (file-name (string-append "dmd-testsuite-" version2 ".tar.gz"))
  188. (sha256
  189. (base32
  190. "12cak7yqmsgjlflx0dp6fwmwb9dac25amgi86n0bb95ard3547wy")))))))))
  191. (define-public ldc ldc-1.1.0)
  192. (define-public rdmd
  193. (package
  194. (name "rdmd")
  195. (version "v2.072.1") ;; remove v when putting in mainline
  196. (source (origin
  197. (method url-fetch)
  198. (uri (string-append
  199. "https://github.com/dlang/tools/archive/"
  200. version ".tar.gz"))
  201. (file-name (string-append name "-" version ".tar.gz"))
  202. (sha256
  203. (base32
  204. "0ryn4fv1mj8c8d7y4lrr43baahl3z7sk5bryj9kd829paz573va6"))))
  205. (build-system gnu-build-system)
  206. (arguments
  207. '(#:phases
  208. (modify-phases %standard-phases
  209. (delete 'configure)
  210. (delete 'check) ; There is no Makefile, so there's no 'make check'.
  211. (replace
  212. 'build
  213. (lambda _
  214. (zero? (system* "ldc2" "rdmd.d"))))
  215. (replace
  216. 'install
  217. (lambda* (#:key outputs #:allow-other-keys)
  218. (let ((bin (string-append (assoc-ref outputs "out") "/bin")))
  219. (install-file "rdmd" bin)))))))
  220. (native-inputs
  221. `(("ldc" ,ldc)))
  222. (home-page "https://github.com/D-Programming-Language/tools/")
  223. (synopsis "Specialized equivalent to 'make' for the D language")
  224. (description
  225. "rdmd is a companion to the dmd compiler that simplifies the typical
  226. edit-compile-link-run or edit-make-run cycle to a rapid edit-run cycle. Like
  227. make and other tools, rdmd uses the relative dates of the files involved to
  228. minimize the amount of work necessary. Unlike make, rdmd tracks dependencies
  229. and freshness without requiring additional information from the user.")
  230. (license license:boost1.0)))