1{
2 fetchurl,
3 lib,
4 stdenv,
5 libiconv,
6 libiconvReal,
7 updateAutotoolsGnuConfigScriptsHook,
8 darwin,
9}@args:
10
11let
12 # https://lists.gnu.org/archive/html/bug-gnulib/2024-05/msg00375.html
13 # macOS libiconv 14 & 15 do not work with libunistring and a configure test
14 # added in 1.3 rejects even building with it so use gnu libiconv on darwin
15 libiconv = if stdenv.hostPlatform.isDarwin then libiconvReal else args.libiconv;
16in
17
18# Note: this package is used for bootstrapping fetchurl, and thus
19# cannot use fetchpatch! All mutable patches (generated by GitHub or
20# cgit) that are needed here should be included directly in Nixpkgs as
21# files.
22
23stdenv.mkDerivation (finalAttrs: {
24 pname = "libunistring";
25 version = "1.3";
26
27 src = fetchurl {
28 url = "mirror://gnu/libunistring/libunistring-${finalAttrs.version}.tar.gz";
29 hash = "sha256-jqjM+GwJ3YAcjKwZh46ATlT3B89piENxEw0gveaDhrc=";
30 };
31
32 outputs = [
33 "out"
34 "dev"
35 "info"
36 "doc"
37 ];
38
39 strictDeps = true;
40 propagatedBuildInputs = lib.optional (!stdenv.hostPlatform.isLinux) libiconv;
41 nativeBuildInputs = [ updateAutotoolsGnuConfigScriptsHook ];
42
43 configureFlags = [ "--with-libiconv-prefix=${libiconv}" ];
44
45 doCheck = false;
46
47 /*
48 This seems to cause several random failures like these, which I assume
49 is because of bad or missing target dependencies in their build system:
50
51 ./unistdio/test-u16-vasnprintf2.sh: line 16: ./test-u16-vasnprintf1: No such file or directory
52 FAIL unistdio/test-u16-vasnprintf2.sh (exit status: 1)
53
54 FAIL: unistdio/test-u16-vasnprintf3.sh
55 ======================================
56
57 ./unistdio/test-u16-vasnprintf3.sh: line 16: ./test-u16-vasnprintf1: No such file or directory
58 FAIL unistdio/test-u16-vasnprintf3.sh (exit status: 1)
59 */
60 enableParallelChecking = false;
61 enableParallelBuilding = true;
62
63 meta = {
64 homepage = "https://www.gnu.org/software/libunistring/";
65
66 description = "Unicode string library";
67
68 longDescription = ''
69 This library provides functions for manipulating Unicode strings
70 and for manipulating C strings according to the Unicode
71 standard.
72
73 GNU libunistring is for you if your application involves
74 non-trivial text processing, such as upper/lower case
75 conversions, line breaking, operations on words, or more
76 advanced analysis of text. Text provided by the user can, in
77 general, contain characters of all kinds of scripts. The text
78 processing functions provided by this library handle all scripts
79 and all languages.
80
81 libunistring is for you if your application already uses the ISO
82 C / POSIX <ctype.h>, <wctype.h> functions and the text it
83 operates on is provided by the user and can be in any language.
84
85 libunistring is also for you if your application uses Unicode
86 strings as internal in-memory representation.
87 '';
88
89 license = lib.licenses.lgpl3Plus;
90
91 maintainers = [ ];
92 platforms = lib.platforms.all;
93 };
94})