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