1{ stdenv, fetchurl, libiconv, xz }:
2
3stdenv.mkDerivation (rec {
4 name = "gettext-0.19.6";
5
6 src = fetchurl {
7 url = "mirror://gnu/gettext/${name}.tar.gz";
8 sha256 = "0pb9vp4ifymvdmc31ks3xxcnfqgzj8shll39czmk8c1splclqjzd";
9 };
10
11 outputs = [ "out" "doc" ];
12
13 LDFLAGS = if stdenv.isSunOS then "-lm -lmd -lmp -luutil -lnvpair -lnsl -lidmap -lavl -lsec" else "";
14
15 configureFlags = [ "--disable-csharp" "--with-xz" ]
16 ++ (stdenv.lib.optionals stdenv.isCygwin
17 [ "--disable-java"
18 "--disable-native-java"
19 # Share the cache among the various `configure' runs.
20 "--config-cache"
21 "--with-included-gettext"
22 "--with-included-glib"
23 "--with-included-libcroco"
24 ])
25 # avoid retaining reference to CF during stdenv bootstrap
26 ++ (stdenv.lib.optionals stdenv.isDarwin [
27 "gt_cv_func_CFPreferencesCopyAppValue=no"
28 "gt_cv_func_CFLocaleCopyCurrent=no"
29 ]);
30
31 # On cross building, gettext supposes that the wchar.h from libc
32 # does not fulfill gettext needs, so it tries to work with its
33 # own wchar.h file, which does not cope well with the system's
34 # wchar.h and stddef.h (gcc-4.3 - glibc-2.9)
35 preConfigure = ''
36 if test -n "$crossConfig"; then
37 echo gl_cv_func_wcwidth_works=yes > cachefile
38 configureFlags="$configureFlags --cache-file=`pwd`/cachefile"
39 fi
40 '' + stdenv.lib.optionalString stdenv.isCygwin ''
41 sed -i -e "s/\(am_libgettextlib_la_OBJECTS = \)error.lo/\\1/" gettext-tools/gnulib-lib/Makefile.in
42 '';
43
44 buildInputs = [ xz ] ++ stdenv.lib.optional (!stdenv.isLinux) libiconv;
45
46 enableParallelBuilding = true;
47
48 crossAttrs = {
49 buildInputs = stdenv.lib.optional (stdenv ? ccCross && stdenv.ccCross.libc ? libiconv)
50 stdenv.ccCross.libc.libiconv.crossDrv;
51 # Gettext fails to guess the cross compiler
52 configureFlags = "CXX=${stdenv.cross.config}-g++";
53 };
54
55 meta = {
56 description = "Well integrated set of translation tools and documentation";
57
58 longDescription = ''
59 Usually, programs are written and documented in English, and use
60 English at execution time for interacting with users. Using a common
61 language is quite handy for communication between developers,
62 maintainers and users from all countries. On the other hand, most
63 people are less comfortable with English than with their own native
64 language, and would rather be using their mother tongue for day to
65 day's work, as far as possible. Many would simply love seeing their
66 computer screen showing a lot less of English, and far more of their
67 own language.
68
69 GNU `gettext' is an important step for the GNU Translation Project, as
70 it is an asset on which we may build many other steps. This package
71 offers to programmers, translators, and even users, a well integrated
72 set of tools and documentation. Specifically, the GNU `gettext'
73 utilities are a set of tools that provides a framework to help other
74 GNU packages produce multi-lingual messages.
75 '';
76
77 homepage = http://www.gnu.org/software/gettext/;
78
79 maintainers = [ ];
80 platforms = stdenv.lib.platforms.all;
81 };
82}
83
84// stdenv.lib.optionalAttrs stdenv.isDarwin {
85 makeFlags = "CFLAGS=-D_FORTIFY_SOURCE=0";
86}
87
88// stdenv.lib.optionalAttrs stdenv.isCygwin {
89 patchPhase =
90 # Make sure `error.c' gets compiled and is part of `libgettextlib.la'.
91 # This fixes:
92 # gettext-0.18.1.1/gettext-tools/src/msgcmp.c:371: undefined reference to `_error_message_count'
93
94 '' sed -i gettext-tools/gnulib-lib/Makefile.in \
95 -e 's/am_libgettextlib_la_OBJECTS =/am_libgettextlib_la_OBJECTS = error.lo/g'
96 '';
97})