Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ stdenv, lib, fetchurl, fetchpatch, libiconv, xz, bash
2, gnulib
3}:
4
5# Note: this package is used for bootstrapping fetchurl, and thus
6# cannot use fetchpatch! All mutable patches (generated by GitHub or
7# cgit) that are needed here should be included directly in Nixpkgs as
8# files.
9
10stdenv.mkDerivation rec {
11 pname = "gettext";
12 version = "0.21.1";
13
14 src = fetchurl {
15 url = "mirror://gnu/gettext/${pname}-${version}.tar.gz";
16 sha256 = "sha256-6MNlDh2M7odcTzVWQjgsHfgwWL1aEe6FVcDPJ21kbUU=";
17 };
18 patches = [
19 ./absolute-paths.diff
20 ] ++ lib.optional stdenv.hostPlatform.isWindows (fetchpatch {
21 url = "https://aur.archlinux.org/cgit/aur.git/plain/gettext_formatstring-ruby.patch?h=mingw-w64-gettext&id=e8b577ee3d399518d005e33613f23363a7df07ee";
22 name = "gettext_formatstring-ruby.patch";
23 sha256 = "sha256-6SxZObOMkQDxuKJuJY+mQ/VuJJxSeGbf97J8ZZddCV0=";
24 });
25
26 outputs = [ "out" "man" "doc" "info" ];
27
28 hardeningDisable = [ "format" ];
29
30 LDFLAGS = lib.optionalString stdenv.isSunOS "-lm -lmd -lmp -luutil -lnvpair -lnsl -lidmap -lavl -lsec";
31
32 configureFlags = [
33 "--disable-csharp" "--with-xz"
34 ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
35 # On cross building, gettext supposes that the wchar.h from libc
36 # does not fulfill gettext needs, so it tries to work with its
37 # own wchar.h file, which does not cope well with the system's
38 # wchar.h and stddef.h (gcc-4.3 - glibc-2.9)
39 "gl_cv_func_wcwidth_works=yes"
40 ];
41
42 postPatch = ''
43 substituteAllInPlace gettext-runtime/src/gettext.sh.in
44 substituteInPlace gettext-tools/projects/KDE/trigger --replace "/bin/pwd" pwd
45 substituteInPlace gettext-tools/projects/GNOME/trigger --replace "/bin/pwd" pwd
46 substituteInPlace gettext-tools/src/project-id --replace "/bin/pwd" pwd
47 '' + lib.optionalString stdenv.hostPlatform.isCygwin ''
48 sed -i -e "s/\(cldr_plurals_LDADD = \)/\\1..\/gnulib-lib\/libxml_rpl.la /" gettext-tools/src/Makefile.in
49 sed -i -e "s/\(libgettextsrc_la_LDFLAGS = \)/\\1..\/gnulib-lib\/libxml_rpl.la /" gettext-tools/src/Makefile.in
50 '';
51
52 strictDeps = true;
53 nativeBuildInputs = [
54 xz
55 xz.bin
56 ];
57 buildInputs = [ bash ]
58 # HACK, see #10874 (and 14664)
59 ++ lib.optionals (!stdenv.isLinux && !stdenv.hostPlatform.isCygwin) [ libiconv ];
60
61 setupHooks = [
62 ../../../build-support/setup-hooks/role.bash
63 ./gettext-setup-hook.sh
64 ];
65 env = {
66 gettextNeedsLdflags = stdenv.hostPlatform.libc != "glibc" && !stdenv.hostPlatform.isMusl;
67 };
68
69 enableParallelBuilding = true;
70 enableParallelChecking = false; # fails sometimes
71
72 meta = with lib; {
73 description = "Well integrated set of translation tools and documentation";
74
75 longDescription = ''
76 Usually, programs are written and documented in English, and use
77 English at execution time for interacting with users. Using a common
78 language is quite handy for communication between developers,
79 maintainers and users from all countries. On the other hand, most
80 people are less comfortable with English than with their own native
81 language, and would rather be using their mother tongue for day to
82 day's work, as far as possible. Many would simply love seeing their
83 computer screen showing a lot less of English, and far more of their
84 own language.
85
86 GNU `gettext' is an important step for the GNU Translation Project, as
87 it is an asset on which we may build many other steps. This package
88 offers to programmers, translators, and even users, a well integrated
89 set of tools and documentation. Specifically, the GNU `gettext'
90 utilities are a set of tools that provides a framework to help other
91 GNU packages produce multi-lingual messages.
92 '';
93
94 homepage = "https://www.gnu.org/software/gettext/";
95
96 maintainers = with maintainers; [ zimbatm vrthra ];
97 license = licenses.gpl2Plus;
98 platforms = platforms.all;
99 };
100}
101
102// lib.optionalAttrs stdenv.isDarwin {
103 makeFlags = [ "CFLAGS=-D_FORTIFY_SOURCE=0" ];
104}