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