projects/guix·blob python-team · refs

353 lines · 14.4 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2013 Andreas Enge <[email protected]>
3;;; Copyright © 2015, 2016 Mark H Weaver <[email protected]>
4;;; Copyright © 2016, 2017, 2020, 2022, 2025 Efraim Flashner <[email protected]>
5;;; Copyright © 2017 Clément Lassieur <[email protected]>
6;;; Copyright © 2017 Ricardo Wurmus <[email protected]>
7;;; Copyright © 2019, 2020, 2022 Marius Bakke <[email protected]>
8;;; Copyright © 2019 Mathieu Othacehe <[email protected]>
9;;; Copyright © 2020 Björn Höfling <[email protected]>
10;;; Copyright © 2020 Julien Lepiller <[email protected]>
11;;; Copyright © 2021 Guillaume Le Vaillant <[email protected]>
12;;; Copyright © 2023 Nicolas Graves <[email protected]>
13;;; Copyright © 2024 Zheng Junjie <[email protected]>
14;;; Copyright © 2025 Maxim Cournoyer <[email protected]>
15;;;
16;;; This file is part of GNU Guix.
17;;;
18;;; GNU Guix is free software; you can redistribute it and/or modify it
19;;; under the terms of the GNU General Public License as published by
20;;; the Free Software Foundation; either version 3 of the License, or (at
21;;; your option) any later version.
22;;;
23;;; GNU Guix is distributed in the hope that it will be useful, but
24;;; WITHOUT ANY WARRANTY; without even the implied warranty of
25;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26;;; GNU General Public License for more details.
27;;;
28;;; You should have received a copy of the GNU General Public License
29;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
30
31(define-module (gnu packages icu4c)
32 #:use-module (gnu packages)
33 #:use-module (gnu packages cpio)
34 #:use-module (gnu packages java)
35 #:use-module (gnu packages perl)
36 #:use-module (gnu packages pkg-config)
37 #:use-module (gnu packages python)
38 #:use-module (guix gexp)
39 #:use-module (guix licenses)
40 #:use-module (guix memoization)
41 #:use-module (guix packages)
42 #:use-module (guix utils)
43 #:use-module (guix download)
44 #:use-module (guix git-download)
45 #:use-module (guix build-system ant)
46 #:use-module (guix build-system gnu))
47
48(define (icu4c-uri version)
49 (string-append
50 "https://github.com/unicode-org/icu/releases/download/release-"
51 (string-map (lambda (x) (if (char=? x #\.) #\- x)) version)
52 "/icu4c-"
53 (string-map (lambda (x) (if (char=? x #\.) #\_ x)) version)
54 "-src.tgz"))
55
56;; The URI format has changed starting with 78.1.
57(define (icu4c-uri->=78 version)
58 (string-append
59 "https://github.com/unicode-org/icu/releases/download/release-"
60 version "/icu4c-" version "-sources.tgz"))
61
62(define-public icu4c-73
63 (package
64 (name "icu4c")
65 (version "73.1")
66 (source (origin
67 (method url-fetch)
68 (uri (icu4c-uri version))
69 (sha256
70 (base32 "0iccpdvc0kvpww5a31k9gjkqigyz016i7v80r9zamd34w4fl6mx4"))
71 (patches
72 (search-patches
73 "icu4c-icu-22132-fix-vtimezone.patch"
74 "icu4c-fix-TestHebrewCalendarInTemporalLeapYear.patch"))))
75 (build-system gnu-build-system)
76 (native-inputs
77 (append (list python-minimal)
78 (if (%current-target-system)
79 ;; When cross-compiling, this package needs a source directory
80 ;; of a native-build of itself.
81 (list (icu4c-build-root-from this-package))
82 '())))
83 (inputs
84 (list perl))
85 (arguments
86 (list
87 #:configure-flags
88 #~(list
89 "--enable-rpath"
90 #$@(if (%current-target-system)
91 #~((string-append "--with-cross-build="
92 #+(this-package-native-input
93 "icu4c-build-root")))
94 #~()))
95 #:phases
96 #~(modify-phases %standard-phases
97 (add-after 'unpack 'chdir-to-source
98 (lambda _ (chdir "source")))
99 (add-after 'chdir-to-source 'update-LDFLAGS
100 (lambda _
101 ;; Do not create a "data-only" libicudata.so because it causes
102 ;; problems on some architectures (notably armhf and MIPS).
103 (substitute* "config/mh-linux"
104 (("LDFLAGSICUDT=-nodefaultlibs -nostdlib")
105 "LDFLAGSICUDT="))))
106 #$@(if (target-riscv64?)
107 #~((add-after 'unpack 'disable-failing-test
108 ;; It is unknown why this test is failing.
109 (lambda _
110 (substitute* "source/test/intltest/numbertest_api.cpp"
111 (("(TESTCASE_AUTO\\(unitUsage\\));" all)
112 (string-append "//" all))))))
113 #~())
114 #$@(if (target-x86-32?)
115 #~((add-after 'unpack 'disable-failing-test
116 (lambda _
117 ;; The test reports 18 errors but it's woefully
118 ;; unclear which tests actually fail or how to disable
119 ;; individual tests.
120 (substitute* "source/test/Makefile.in"
121 ((" intltest ") " ")))))
122 #~())
123 #$@(if (target-arm32?)
124 #~((add-after 'unpack 'disable-failing-test
125 (lambda _
126 ;; The caltest test started to fail to compile after
127 ;; the upgrade to gcc-14 but it's unclear which test is
128 ;; failing or how to disable just that one test.
129 ;; Error: co-processor offset out of range
130 (substitute* "source/test/Makefile.in"
131 ((" intltest ") " ")))))
132 #~())
133 (add-after 'install 'avoid-coreutils-reference
134 ;; Don't keep a reference to the build tools.
135 (lambda _
136 (substitute* (find-files (string-append #$output "/lib/icu")
137 "\\.inc$")
138 (("INSTALL_CMD=.*/bin/install") "INSTALL_CMD=install")))))))
139 (synopsis "International Components for Unicode")
140 (description
141 "ICU is a set of C/C++ and Java libraries providing Unicode and
142globalisation support for software applications. This package contains the
143C/C++ part.")
144 (license x11)
145 (home-page "https://icu.unicode.org/")))
146
147(define-public icu4c icu4c-73)
148
149(define-public icu4c-76
150 (package
151 (inherit icu4c)
152 (name "icu4c")
153 (version "76.1")
154 (source (origin
155 (method url-fetch)
156 (uri (icu4c-uri version))
157 (sha256
158 (base32
159 "0gjg1zrnqk4vmidqgqx4xbz05898px212gnff8242is7zrmv9b6z"))))))
160
161(define-public icu4c-77
162 (package
163 (inherit icu4c)
164 (name "icu4c")
165 (version "77.1")
166 (source
167 (origin
168 (method url-fetch)
169 (uri (icu4c-uri version))
170 (sha256
171 (base32
172 "0qa0yapkypywhzx8ai1p27125h9v1qy89f7v3w1kjz1jfwgl73jq"))
173 (patches
174 (search-patches
175 ;; These are the relevant patches Firefox applies (see
176 ;; <https://github.com/mozilla-firefox/firefox/tree/main/intl/icu-patches>).
177 ;; The 'intl/icu' prefix in the file names must be stripped. These
178 ;; are necessary to ensure applications like Icedove run correctly.
179 "icu4c-22132-standardize-vtzone-output.patch"
180 "icu4c-20548-dateinterval-timezone.patch"
181 "icu4c-23069-rosh-hashanah-postponement.patch"
182 "icu4c-dayperiod-fractional-seconds.patch"
183 "icu4c-double-conversion.patch"
184 "icu4c-dtitvfmt-adopt-calendar.patch"
185 "icu4c-wasi-workaround.patch"))))))
186
187(define-public icu4c-78
188 (package
189 (inherit icu4c-77)
190 (name "icu4c")
191 (version "78.2")
192 (source
193 (origin
194 (inherit (package-source icu4c-77))
195 (uri (icu4c-uri->=78 version))
196 (sha256 (base32 "0dfzi4yf0wmng1866y2yd22cj1lrnzmx5qihjqh4npa3bixni69y"))
197 (patches
198 (search-patches
199 "icu4c-bug-1706949-wasi-workaround.patch"
200 "icu4c-bug-1790071-ICU-22132-standardize-vtzone-output.patch"
201 "icu4c-bug-1856290-ICU-20548-dateinterval-timezone.patch"
202 "icu4c-bug-1954138-dtitvfmt-adopt-calendar.patch"
203 "icu4c-bug-1972781-chinese-based-calendar.patch"
204 "icu4c-bug-2000225-ICU-23264-increase-measure-unit-capacity.patch"
205 "icu4c-78-double-conversion.patch"
206 "icu4c-suppress-warnings.patch"))))))
207
208(define icu4c-build-root-from
209 (mlambdaq (p)
210 (package
211 (inherit p)
212 (name "icu4c-build-root")
213 (arguments
214 (substitute-keyword-arguments arguments
215 ((#:tests? _ #f)
216 #f)
217 ((#:out-of-source? _ #t)
218 #t)
219 ((#:phases phases)
220 #~(modify-phases #$phases
221 (replace 'install
222 (lambda _
223 (copy-recursively "../build" #$output)))))))
224 (native-inputs '()))))
225
226(define-public java-icu4j
227 (package
228 (name "java-icu4j")
229 (version "70.1")
230 (source (origin
231 (method url-fetch)
232 (uri (string-append
233 "https://github.com/unicode-org/icu/releases/download/release-"
234 (string-map (lambda (x) (if (char=? x #\.) #\- x)) version)
235 "/icu4j-"
236 (string-map (lambda (x) (if (char=? x #\.) #\_ x)) version)
237 ".tgz"))
238 (sha256
239 (base32 "0qrs75iyzn19kf54q55jn8wf6xjlpkrihdwqpxm39jdh2hz4cgvj"))))
240 (build-system ant-build-system)
241 (arguments
242 `(#:make-flags
243 ,#~(list
244 (string-append "-Djunit.core.jar="
245 (car (find-files
246 #$(this-package-native-input "java-junit")
247 ".*.jar$")))
248 (string-append "-Djunit.junitparams.jar="
249 (car (find-files
250 #$(this-package-native-input "java-junitparams")
251 ".*.jar$")))
252 (string-append "-Djunit.hamcrest.jar="
253 (car (find-files
254 #$(this-package-native-input "java-hamcrest-core")
255 ".*.jar$"))))
256 #:phases
257 (modify-phases %standard-phases
258 (add-before 'configure 'chdir
259 (lambda _
260 (chdir "..")))
261 (add-before 'build 'remove-ivy
262 (lambda _
263 ;; This target wants to download ivy and use it to download
264 ;; junit.
265 (substitute* "build.xml"
266 (("depends=\"test-init-junit-dependency\"") ""))))
267 (replace 'install
268 (lambda* (#:key outputs #:allow-other-keys)
269 (let ((share (string-append (assoc-ref outputs "out")
270 "/share/java/")))
271 (mkdir-p share)
272 (install-file "icu4j.jar" share)))))))
273 (native-inputs
274 (list java-junit java-junitparams java-hamcrest-core))
275 (home-page "http://site.icu-project.org/")
276 (synopsis "International Components for Unicode")
277 (description
278 "ICU is a set of C/C++ and Java libraries providing Unicode and
279globalisation support for software applications. This package contains the
280Java part.")
281 (license x11)))
282
283(define-public icu4c-for-skia
284 ;; The current version of skia needs this exact commit
285 ;; for its test dependencies.
286 (let ((commit "a0718d4f121727e30b8d52c7a189ebf5ab52421f")
287 (revision "0"))
288 (package
289 (inherit icu4c)
290 (name "icu4c-for-skia")
291 (version "skia")
292 (source
293 (origin
294 (method git-fetch)
295 (uri (git-reference
296 (url "https://chromium.googlesource.com/chromium/deps/icu.git")
297 (commit commit)))
298 (file-name (git-file-name name version))
299 (sha256
300 (base32 "1qxws2p91f6dmhy7d3967r5ygz06r88pkmpm97px067x0zzdz384"))))
301 (arguments
302 (list
303 #:make-flags #~(list (string-append "DESTDIR=" #$output))
304 #:configure-flags #~(list "--prefix=" "--exec-prefix=")
305 #:phases
306 #~(modify-phases %standard-phases
307 (add-after 'unpack 'chdir-to-source
308 (lambda _ (chdir "source")))
309 (replace 'configure
310 (lambda* (#:key inputs parallel-build? configure-flags
311 #:allow-other-keys)
312 (setenv "CONFIG_SHELL" (which "sh"))
313 (setenv "OPTS" (string-join configure-flags))
314 (invoke "./runConfigureICU" "Linux/gcc"
315 "--disable-layout" "--disable-tests")))
316 (add-after 'install 'install-cleanup
317 (lambda* (#:key make-flags #:allow-other-keys)
318 (with-directory-excursion "data"
319 (apply invoke "make" "clean" make-flags))))
320 (add-after 'install-cleanup 'configure-filtered-data
321 (lambda* (#:key configure-flags #:allow-other-keys)
322 (setenv "OPTS" (string-join configure-flags))
323 (setenv "ICU_DATA_FILTER_FILE"
324 (string-append (getcwd) "/../filters/common.json"))
325 (invoke "./runConfigureICU" "Linux/gcc"
326 "--disable-layout" "--disable-tests")))
327 (add-after 'configure-filtered-data 'build-filtered-data
328 (lambda* (#:key parallel-build? make-flags #:allow-other-keys)
329 (let ((job-count (if parallel-build?
330 (number->string (parallel-job-count))
331 "1")))
332 (apply invoke "make" "-j" job-count make-flags)
333 (setenv "DESTDIR" #$output)
334 (invoke "bash" "../scripts/copy_data.sh" "common"))))
335 (add-after 'build-filtered-data 'install-scripts-and-data
336 (lambda _
337 (let* ((share (string-append #$output "/share"))
338 (scripts (string-append share "/scripts"))
339 (data (string-append share "/data/common")))
340 ;; Install scripts.
341 (mkdir-p scripts)
342 (copy-recursively "../scripts/" scripts)
343 ;; Install data.
344 (mkdir-p data)
345 (copy-recursively "./dataout/common/data/out/tmp" data)
346 (symlink (string-append data "/icudt69l.dat")
347 (string-append data "/icudtl.dat")))))
348 (add-before 'check 'disable-failing-uconv-test
349 (lambda _
350 (substitute* "extra/uconv/Makefile.in"
351 (("check: check-local")
352 "")))))))
353 (native-inputs (list cpio pkg-config python)))))