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