Merge branch 'master' into staging
[jackhill/guix/guix.git] / gnu / packages / icu4c.scm
CommitLineData
4c9e7975
AE
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2013 Andreas Enge <andreas@enge.fr>
93cb98d4 3;;; Copyright © 2015, 2016 Mark H Weaver <mhw@netris.org>
4e080fbb 4;;; Copyright © 2016, 2017 Efraim Flashner <efraim@flashner.co.il>
a408e757 5;;; Copyright © 2017 Clément Lassieur <clement@lassieur.org>
1d4234d4 6;;; Copyright © 2017 Ricardo Wurmus <rekado@elephly.net>
e15acf8c 7;;; Copyright © 2019, 2020 Marius Bakke <mbakke@fastmail.com>
63eb30c1 8;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
4c9e7975
AE
9;;;
10;;; This file is part of GNU Guix.
11;;;
12;;; GNU Guix is free software; you can redistribute it and/or modify it
13;;; under the terms of the GNU General Public License as published by
14;;; the Free Software Foundation; either version 3 of the License, or (at
15;;; your option) any later version.
16;;;
17;;; GNU Guix is distributed in the hope that it will be useful, but
18;;; WITHOUT ANY WARRANTY; without even the implied warranty of
19;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20;;; GNU General Public License for more details.
21;;;
22;;; You should have received a copy of the GNU General Public License
23;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
24
1ffa7090 25(define-module (gnu packages icu4c)
59a43334 26 #:use-module (gnu packages)
1ffa7090 27 #:use-module (gnu packages perl)
27ed6960 28 #:use-module (gnu packages python)
4c9e7975
AE
29 #:use-module (guix licenses)
30 #:use-module (guix packages)
63eb30c1 31 #:use-module (guix utils)
4c9e7975 32 #:use-module (guix download)
1d4234d4 33 #:use-module (guix build-system ant)
4c9e7975
AE
34 #:use-module (guix build-system gnu))
35
36(define-public icu4c
37 (package
38 (name "icu4c")
8d425d74 39 (version "66.1")
4c9e7975
AE
40 (source (origin
41 (method url-fetch)
d5df6fc7 42 (uri (string-append
e8acfd1a
MB
43 "https://github.com/unicode-org/icu/releases/download/release-"
44 (string-map (lambda (x) (if (char=? x #\.) #\- x)) version)
d5df6fc7
AW
45 "/icu4c-"
46 (string-map (lambda (x) (if (char=? x #\.) #\_ x)) version)
47 "-src.tgz"))
63bd6643
MB
48 (patch-flags '("-p2"))
49 (patches (search-patches "icu4c-CVE-2020-10531.patch"))
1319cfe9 50 (sha256
8d425d74 51 (base32 "0bharwzc9nzkbrcf405z2nb3h7q0711z450arz0mjmdrk8hg58sj"))))
4c9e7975 52 (build-system gnu-build-system)
63eb30c1
MO
53 ;; When cross-compiling, this package needs a source directory of a
54 ;; native-build of itself.
27ed6960 55 (native-inputs
63eb30c1
MO
56 `(("python" ,python-minimal)
57 ,@(if (%current-target-system)
58 `(("icu4c-build-root" ,icu4c-build-root))
59 '())))
a2270ce2 60 (inputs
0d93648b 61 `(("perl" ,perl)))
4c9e7975 62 (arguments
0d93648b 63 `(#:configure-flags
63eb30c1
MO
64 (list
65 "--enable-rpath"
66 ,@(if (%current-target-system)
67 '((string-append "--with-cross-build="
68 (assoc-ref %build-inputs "icu4c-build-root")))
69 '()))
a2270ce2 70 #:phases
c296d5d1
EF
71 (modify-phases %standard-phases
72 (add-after 'unpack 'chdir-to-source
fbd2b8da 73 (lambda _ (chdir "source") #t))
f73fe13c
MB
74 (add-after 'chdir-to-source 'update-LDFLAGS
75 (lambda _
76 ;; Do not create a "data-only" libicudata.so because it causes
77 ;; problems on some architectures (notably armhf and MIPS).
78 (substitute* "config/mh-linux"
79 (("LDFLAGSICUDT=-nodefaultlibs -nostdlib")
80 "LDFLAGSICUDT="))
81 #t))
fbd2b8da
MB
82 (add-after 'install 'avoid-coreutils-reference
83 ;; Don't keep a reference to the build tools.
84 (lambda* (#:key outputs #:allow-other-keys)
85 (let ((out (assoc-ref outputs "out")))
86 (substitute* (find-files (string-append out "/lib/icu")
87 "\\.inc$")
88 (("INSTALL_CMD=.*/bin/install") "INSTALL_CMD=install"))
89 #t))))))
35b9e423 90 (synopsis "International Components for Unicode")
4c9e7975
AE
91 (description
92 "ICU is a set of C/C++ and Java libraries providing Unicode and
35b9e423 93globalisation support for software applications. This package contains the
4c9e7975
AE
94C/C++ part.")
95 (license x11)
96 (home-page "http://site.icu-project.org/")))
a408e757 97
63eb30c1
MO
98(define-public icu4c-build-root
99 (package
100 (inherit icu4c)
101 (name "icu4c-build-root")
102 (arguments
103 (substitute-keyword-arguments (package-arguments icu4c)
104 ((#:tests? _ '())
105 #f)
106 ((#:out-of-source? _ '())
107 #t)
108 ((#:phases phases)
109 `(modify-phases ,phases
110 (replace 'install
111 (lambda* (#:key outputs #:allow-other-keys)
112 (let ((out (assoc-ref outputs "out")))
113 (copy-recursively "../build" out)
114 #t)))))))
115 (native-inputs '())))
116
1d4234d4
RW
117(define-public java-icu4j
118 (package
119 (name "java-icu4j")
120 (version "59.1")
121 (source (origin
122 (method url-fetch)
123 (uri (string-append "http://download.icu-project.org/files/icu4j/"
124 version "/icu4j-"
125 (string-map (lambda (x)
126 (if (char=? x #\.) #\_ x))
127 version)
128 "-src.jar"))
129 (sha256
130 (base32
131 "0bgxsvgi0qcwj60pvcxrf7a3fbk7aksyxnfwpbzavyfrfzixqh0c"))))
132 (build-system ant-build-system)
133 (arguments
134 `(#:tests? #f ; no tests included
135 #:jar-name "icu4j.jar"))
136 (home-page "http://site.icu-project.org/")
137 (synopsis "International Components for Unicode")
138 (description
139 "ICU is a set of C/C++ and Java libraries providing Unicode and
140globalisation support for software applications. This package contains the
141Java part.")
142 (license x11)))