nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
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";
13
14 src = fetchurl {
15 url = "mirror://gnu/gettext/${pname}-${version}.tar.gz";
16 sha256 = "04kbg1sx0ncfrsbr85ggjslqkzzb243fcw9nyh3rrv1a22ihszf7";
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 # This change to gettext's vendored copy of gnulib is already
52 # merged upstream; we can drop this patch on the next version
53 # bump. It must be applied twice because gettext vendors gnulib
54 # not once, but twice!
55 ''
56 patch -p2 -d gettext-tools/gnulib-lib/ < ${gnulib.passthru.longdouble-redirect-patch}
57 patch -p2 -d gettext-tools/libgrep/ < ${gnulib.passthru.longdouble-redirect-patch}
58 '';
59
60 strictDeps = true;
61 nativeBuildInputs = [
62 xz
63 xz.bin
64 ];
65 buildInputs = [ bash ]
66 # HACK, see #10874 (and 14664)
67 ++ lib.optionals (!stdenv.isLinux && !stdenv.hostPlatform.isCygwin) [ libiconv ];
68
69 setupHooks = [
70 ../../../build-support/setup-hooks/role.bash
71 ./gettext-setup-hook.sh
72 ];
73 env = {
74 gettextNeedsLdflags = stdenv.hostPlatform.libc != "glibc" && !stdenv.hostPlatform.isMusl;
75 };
76
77 enableParallelBuilding = true;
78 enableParallelChecking = false; # fails sometimes
79
80 meta = with lib; {
81 description = "Well integrated set of translation tools and documentation";
82
83 longDescription = ''
84 Usually, programs are written and documented in English, and use
85 English at execution time for interacting with users. Using a common
86 language is quite handy for communication between developers,
87 maintainers and users from all countries. On the other hand, most
88 people are less comfortable with English than with their own native
89 language, and would rather be using their mother tongue for day to
90 day's work, as far as possible. Many would simply love seeing their
91 computer screen showing a lot less of English, and far more of their
92 own language.
93
94 GNU `gettext' is an important step for the GNU Translation Project, as
95 it is an asset on which we may build many other steps. This package
96 offers to programmers, translators, and even users, a well integrated
97 set of tools and documentation. Specifically, the GNU `gettext'
98 utilities are a set of tools that provides a framework to help other
99 GNU packages produce multi-lingual messages.
100 '';
101
102 homepage = "https://www.gnu.org/software/gettext/";
103
104 maintainers = with maintainers; [ zimbatm vrthra ];
105 license = licenses.gpl2Plus;
106 platforms = platforms.all;
107 };
108}
109
110// lib.optionalAttrs stdenv.isDarwin {
111 makeFlags = [ "CFLAGS=-D_FORTIFY_SOURCE=0" ];
112}