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