icu4c.scm 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2013 Andreas Enge <andreas@enge.fr>
  3. ;;; Copyright © 2015, 2016 Mark H Weaver <mhw@netris.org>
  4. ;;; Copyright © 2016, 2017, 2020 Efraim Flashner <efraim@flashner.co.il>
  5. ;;; Copyright © 2017 Clément Lassieur <clement@lassieur.org>
  6. ;;; Copyright © 2017 Ricardo Wurmus <rekado@elephly.net>
  7. ;;; Copyright © 2019, 2020 Marius Bakke <mbakke@fastmail.com>
  8. ;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
  9. ;;; Copyright © 2020 Björn Höfling <bjoern.hoefling@bjoernhoefling.de>
  10. ;;; Copyright © 2020 Julien Lepiller <julien@lepiller.eu>
  11. ;;; Copyright © 2021 Guillaume Le Vaillant <glv@posteo.net>
  12. ;;;
  13. ;;; This file is part of GNU Guix.
  14. ;;;
  15. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  16. ;;; under the terms of the GNU General Public License as published by
  17. ;;; the Free Software Foundation; either version 3 of the License, or (at
  18. ;;; your option) any later version.
  19. ;;;
  20. ;;; GNU Guix is distributed in the hope that it will be useful, but
  21. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  22. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  23. ;;; GNU General Public License for more details.
  24. ;;;
  25. ;;; You should have received a copy of the GNU General Public License
  26. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  27. (define-module (gnu packages icu4c)
  28. #:use-module (gnu packages)
  29. #:use-module (gnu packages java)
  30. #:use-module (gnu packages perl)
  31. #:use-module (gnu packages python)
  32. #:use-module (guix gexp)
  33. #:use-module (guix licenses)
  34. #:use-module (guix packages)
  35. #:use-module (guix utils)
  36. #:use-module (guix download)
  37. #:use-module (guix build-system ant)
  38. #:use-module (guix build-system gnu))
  39. (define-public icu4c
  40. (package
  41. (name "icu4c")
  42. (version "69.1")
  43. (source (origin
  44. (method url-fetch)
  45. (uri (string-append
  46. "https://github.com/unicode-org/icu/releases/download/release-"
  47. (string-map (lambda (x) (if (char=? x #\.) #\- x)) version)
  48. "/icu4c-"
  49. (string-map (lambda (x) (if (char=? x #\.) #\_ x)) version)
  50. "-src.tgz"))
  51. (sha256
  52. (base32 "0icps0avkwy5df3wwc5kybxcg63hcgk4phdh9g244g0xrmx7pfjc"))))
  53. (build-system gnu-build-system)
  54. ;; When cross-compiling, this package needs a source directory of a
  55. ;; native-build of itself.
  56. (native-inputs
  57. `(("python" ,python-minimal)
  58. ,@(if (%current-target-system)
  59. `(("icu4c-build-root" ,icu4c-build-root))
  60. '())))
  61. (inputs
  62. `(("perl" ,perl)))
  63. (arguments
  64. `(#:configure-flags
  65. (list
  66. "--enable-rpath"
  67. ,@(if (%current-target-system)
  68. '((string-append "--with-cross-build="
  69. (assoc-ref %build-inputs "icu4c-build-root")))
  70. '()))
  71. #:phases
  72. (modify-phases %standard-phases
  73. (add-after 'unpack 'chdir-to-source
  74. (lambda _ (chdir "source") #t))
  75. (add-after 'chdir-to-source 'update-LDFLAGS
  76. (lambda _
  77. ;; Do not create a "data-only" libicudata.so because it causes
  78. ;; problems on some architectures (notably armhf and MIPS).
  79. (substitute* "config/mh-linux"
  80. (("LDFLAGSICUDT=-nodefaultlibs -nostdlib")
  81. "LDFLAGSICUDT="))
  82. #t))
  83. (add-after 'install 'avoid-coreutils-reference
  84. ;; Don't keep a reference to the build tools.
  85. (lambda* (#:key outputs #:allow-other-keys)
  86. (let ((out (assoc-ref outputs "out")))
  87. (substitute* (find-files (string-append out "/lib/icu")
  88. "\\.inc$")
  89. (("INSTALL_CMD=.*/bin/install") "INSTALL_CMD=install"))
  90. #t))))))
  91. (synopsis "International Components for Unicode")
  92. (description
  93. "ICU is a set of C/C++ and Java libraries providing Unicode and
  94. globalisation support for software applications. This package contains the
  95. C/C++ part.")
  96. (license x11)
  97. (home-page "http://site.icu-project.org/")))
  98. (define-public icu4c-67
  99. (package
  100. (inherit icu4c)
  101. (version "67.1")
  102. (source (origin
  103. (method url-fetch)
  104. (uri (string-append
  105. "https://github.com/unicode-org/icu/releases/download/release-"
  106. (string-map (lambda (x) (if (char=? x #\.) #\- x)) version)
  107. "/icu4c-"
  108. (string-map (lambda (x) (if (char=? x #\.) #\_ x)) version)
  109. "-src.tgz"))
  110. (sha256
  111. (base32
  112. "1p6mhvxl0xr2n0g6xdps3mwzwlv6mjsz3xlpm793p9aiybb0ra4l"))))))
  113. (define-public icu4c-68
  114. (package
  115. (inherit icu4c)
  116. (version "68.2")
  117. (source (origin
  118. (method url-fetch)
  119. (uri (string-append
  120. "https://github.com/unicode-org/icu/releases/download/release-"
  121. (string-map (lambda (x) (if (char=? x #\.) #\- x)) version)
  122. "/icu4c-"
  123. (string-map (lambda (x) (if (char=? x #\.) #\_ x)) version)
  124. "-src.tgz"))
  125. (sha256
  126. (base32
  127. "09fng7a80xj8d5r1cgbgq8r47dsw5jsr6si9p2cj2ylhwgg974f7"))))))
  128. (define-public icu4c-build-root
  129. (package
  130. (inherit icu4c)
  131. (name "icu4c-build-root")
  132. (arguments
  133. (substitute-keyword-arguments (package-arguments icu4c)
  134. ((#:tests? _ '())
  135. #f)
  136. ((#:out-of-source? _ '())
  137. #t)
  138. ((#:phases phases)
  139. `(modify-phases ,phases
  140. (replace 'install
  141. (lambda* (#:key outputs #:allow-other-keys)
  142. (let ((out (assoc-ref outputs "out")))
  143. (copy-recursively "../build" out)
  144. #t)))))))
  145. (native-inputs '())))
  146. (define-public java-icu4j
  147. (package
  148. (name "java-icu4j")
  149. (version "66.1")
  150. (source (origin
  151. (method url-fetch)
  152. (uri (string-append
  153. "https://github.com/unicode-org/icu/releases/download/release-"
  154. (string-map (lambda (x) (if (char=? x #\.) #\- x)) version)
  155. "/icu4j-"
  156. (string-map (lambda (x) (if (char=? x #\.) #\_ x)) version)
  157. ".tgz"))
  158. (sha256
  159. (base32 "1ahdyz9209lwl7knb2l3gmnkkby221p0vpgx70fj4j02rdzgvw0d"))))
  160. (build-system ant-build-system)
  161. (arguments
  162. `(#:make-flags
  163. ,#~(list
  164. (string-append "-Djunit.core.jar="
  165. (car (find-files
  166. #$(this-package-native-input "java-junit")
  167. ".*.jar$")))
  168. (string-append "-Djunit.junitparams.jar="
  169. (car (find-files
  170. #$(this-package-native-input "java-junitparams")
  171. ".*.jar$")))
  172. (string-append "-Djunit.hamcrest.jar="
  173. (car (find-files
  174. #$(this-package-native-input "java-hamcrest-core")
  175. ".*.jar$"))))
  176. #:phases
  177. (modify-phases %standard-phases
  178. (add-before 'configure 'chdir
  179. (lambda _
  180. (chdir "..")
  181. #t))
  182. (add-before 'build 'remove-ivy
  183. (lambda _
  184. ;; This target wants to download ivy and use it to download
  185. ;; junit.
  186. (substitute* "build.xml"
  187. (("depends=\"test-init-junit-dependency\"") ""))
  188. #t))
  189. (replace 'install
  190. (lambda* (#:key outputs #:allow-other-keys)
  191. (let ((share (string-append (assoc-ref outputs "out")
  192. "/share/java/")))
  193. (mkdir-p share)
  194. (install-file "icu4j.jar" share)
  195. #t))))))
  196. (native-inputs
  197. `(("java-junit" ,java-junit)
  198. ("java-junitparams" ,java-junitparams)
  199. ("java-hamcrest-core" ,java-hamcrest-core)))
  200. (home-page "http://site.icu-project.org/")
  201. (synopsis "International Components for Unicode")
  202. (description
  203. "ICU is a set of C/C++ and Java libraries providing Unicode and
  204. globalisation support for software applications. This package contains the
  205. Java part.")
  206. (license x11)))