gnu: fontconfig: Add replacement with font-dejavu instead of gs-fonts.
[jackhill/guix/guix.git] / gnu / packages / icu4c.scm
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 ;;;
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
25 (define-module (gnu packages icu4c)
26 #:use-module (gnu packages)
27 #:use-module (gnu packages perl)
28 #:use-module (gnu packages python)
29 #:use-module (guix licenses)
30 #:use-module (guix packages)
31 #:use-module (guix utils)
32 #:use-module (guix download)
33 #:use-module (guix build-system ant)
34 #:use-module (guix build-system gnu))
35
36 (define-public icu4c
37 (package
38 (name "icu4c")
39 (version "66.1")
40 (source (origin
41 (method url-fetch)
42 (uri (string-append
43 "https://github.com/unicode-org/icu/releases/download/release-"
44 (string-map (lambda (x) (if (char=? x #\.) #\- x)) version)
45 "/icu4c-"
46 (string-map (lambda (x) (if (char=? x #\.) #\_ x)) version)
47 "-src.tgz"))
48 (patch-flags '("-p2"))
49 (patches (search-patches "icu4c-CVE-2020-10531.patch"))
50 (sha256
51 (base32 "0bharwzc9nzkbrcf405z2nb3h7q0711z450arz0mjmdrk8hg58sj"))))
52 (build-system gnu-build-system)
53 ;; When cross-compiling, this package needs a source directory of a
54 ;; native-build of itself.
55 (native-inputs
56 `(("python" ,python-minimal)
57 ,@(if (%current-target-system)
58 `(("icu4c-build-root" ,icu4c-build-root))
59 '())))
60 (inputs
61 `(("perl" ,perl)))
62 (arguments
63 `(#:configure-flags
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 '()))
70 #:phases
71 (modify-phases %standard-phases
72 (add-after 'unpack 'chdir-to-source
73 (lambda _ (chdir "source") #t))
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))
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))))))
90 (synopsis "International Components for Unicode")
91 (description
92 "ICU is a set of C/C++ and Java libraries providing Unicode and
93 globalisation support for software applications. This package contains the
94 C/C++ part.")
95 (license x11)
96 (home-page "http://site.icu-project.org/")))
97
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
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
140 globalisation support for software applications. This package contains the
141 Java part.")
142 (license x11)))