1 { stdenv, lib, fetchurl, fetchpatch, libiconv, xz, bash
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
10 stdenv.mkDerivation rec {
15 url = "mirror://gnu/gettext/${pname}-${version}.tar.gz";
16 sha256 = "sha256-6MNlDh2M7odcTzVWQjgsHfgwWL1aEe6FVcDPJ21kbUU=";
20 # fix reproducibile output, in particular in the grub2 build
21 # https://savannah.gnu.org/bugs/index.php?59658
22 ./0001-msginit-Do-not-use-POT-Creation-Date.patch
23 ] ++ lib.optional stdenv.hostPlatform.isWindows (fetchpatch {
24 url = "https://aur.archlinux.org/cgit/aur.git/plain/gettext_formatstring-ruby.patch?h=mingw-w64-gettext&id=e8b577ee3d399518d005e33613f23363a7df07ee";
25 name = "gettext_formatstring-ruby.patch";
26 sha256 = "sha256-6SxZObOMkQDxuKJuJY+mQ/VuJJxSeGbf97J8ZZddCV0=";
29 outputs = [ "out" "man" "doc" "info" ];
31 hardeningDisable = [ "format" ];
33 LDFLAGS = lib.optionalString stdenv.isSunOS "-lm -lmd -lmp -luutil -lnvpair -lnsl -lidmap -lavl -lsec";
36 "--disable-csharp" "--with-xz"
37 ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
38 # On cross building, gettext supposes that the wchar.h from libc
39 # does not fulfill gettext needs, so it tries to work with its
40 # own wchar.h file, which does not cope well with the system's
41 # wchar.h and stddef.h (gcc-4.3 - glibc-2.9)
42 "gl_cv_func_wcwidth_works=yes"
46 substituteAllInPlace gettext-runtime/src/gettext.sh.in
47 substituteInPlace gettext-tools/projects/KDE/trigger --replace "/bin/pwd" pwd
48 substituteInPlace gettext-tools/projects/GNOME/trigger --replace "/bin/pwd" pwd
49 substituteInPlace gettext-tools/src/project-id --replace "/bin/pwd" pwd
50 '' + lib.optionalString stdenv.hostPlatform.isCygwin ''
51 sed -i -e "s/\(cldr_plurals_LDADD = \)/\\1..\/gnulib-lib\/libxml_rpl.la /" gettext-tools/src/Makefile.in
52 sed -i -e "s/\(libgettextsrc_la_LDFLAGS = \)/\\1..\/gnulib-lib\/libxml_rpl.la /" gettext-tools/src/Makefile.in
60 buildInputs = lib.optionals (!stdenv.hostPlatform.isMinGW) [
63 ++ lib.optionals (!stdenv.isLinux && !stdenv.hostPlatform.isCygwin) [
64 # HACK, see #10874 (and 14664)
69 ../../../build-support/setup-hooks/role.bash
70 ./gettext-setup-hook.sh
73 gettextNeedsLdflags = stdenv.hostPlatform.libc != "glibc" && !stdenv.hostPlatform.isMusl;
76 enableParallelBuilding = true;
77 enableParallelChecking = false; # fails sometimes
80 description = "Well integrated set of translation tools and documentation";
83 Usually, programs are written and documented in English, and use
84 English at execution time for interacting with users. Using a common
85 language is quite handy for communication between developers,
86 maintainers and users from all countries. On the other hand, most
87 people are less comfortable with English than with their own native
88 language, and would rather be using their mother tongue for day to
89 day's work, as far as possible. Many would simply love seeing their
90 computer screen showing a lot less of English, and far more of their
93 GNU `gettext' is an important step for the GNU Translation Project, as
94 it is an asset on which we may build many other steps. This package
95 offers to programmers, translators, and even users, a well integrated
96 set of tools and documentation. Specifically, the GNU `gettext'
97 utilities are a set of tools that provides a framework to help other
98 GNU packages produce multi-lingual messages.
101 homepage = "https://www.gnu.org/software/gettext/";
103 maintainers = with maintainers; [ zimbatm vrthra ];
104 license = licenses.gpl2Plus;
105 platforms = platforms.all;
109 // lib.optionalAttrs stdenv.isDarwin {
110 makeFlags = [ "CFLAGS=-D_FORTIFY_SOURCE=0" ];