Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at flake-libs 137 lines 5.3 kB view raw
1{ 2 stdenv, 3 lib, 4 fetchurl, 5 libiconv, 6 bashNonInteractive, 7 updateAutotoolsGnuConfigScriptsHook, 8}: 9 10# Note: this package is used for bootstrapping fetchurl, and thus 11# cannot use fetchpatch! All mutable patches (generated by GitHub or 12# cgit) that are needed here should be included directly in Nixpkgs as 13# files. 14 15stdenv.mkDerivation rec { 16 pname = "gettext"; 17 version = "0.22.5"; 18 19 src = fetchurl { 20 url = "mirror://gnu/gettext/${pname}-${version}.tar.gz"; 21 hash = "sha256-7BcFselpuDqfBzFE7IBhUduIEn9eQP5alMtsj6SJlqA="; 22 }; 23 patches = [ 24 ./absolute-paths.diff 25 # fix reproducibile output, in particular in the grub2 build 26 # https://savannah.gnu.org/bugs/index.php?59658 27 ./0001-msginit-Do-not-use-POT-Creation-Date.patch 28 ]; 29 30 outputs = [ 31 "out" 32 "man" 33 "doc" 34 "info" 35 ]; 36 37 LDFLAGS = lib.optionalString stdenv.hostPlatform.isSunOS "-lm -lmd -lmp -luutil -lnvpair -lnsl -lidmap -lavl -lsec"; 38 39 configureFlags = 40 [ 41 "--disable-csharp" 42 ] 43 ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ 44 # On cross building, gettext supposes that the wchar.h from libc 45 # does not fulfill gettext needs, so it tries to work with its 46 # own wchar.h file, which does not cope well with the system's 47 # wchar.h and stddef.h (gcc-4.3 - glibc-2.9) 48 "gl_cv_func_wcwidth_works=yes" 49 ]; 50 51 postPatch = 52 '' 53 # Older versions of gettext come with a copy of `extern-inline.m4` that is not compatible with clang 18. 54 # When a project uses gettext + autoreconfPhase, autoreconfPhase will invoke `autopoint -f`, which will 55 # replace whatever (probably compatible) version of `extern-inline.m4` with one that probalby wont work 56 # because `autopoint` will copy the autoconf macros from the projects required version of gettext. 57 # Fixing this requires replacing all the older copies of the problematic file with a new one. 58 # 59 # This is ugly, but it avoids requiring workarounds in every package using gettext and autoreconfPhase. 60 declare -a oldFiles=($(tar tf gettext-tools/misc/archive.dir.tar | grep '^gettext-0\.[19].*/extern-inline.m4')) 61 oldFilesDir=$(mktemp -d) 62 for oldFile in "''${oldFiles[@]}"; do 63 mkdir -p "$oldFilesDir/$(dirname "$oldFile")" 64 cp -a gettext-tools/gnulib-m4/extern-inline.m4 "$oldFilesDir/$oldFile" 65 done 66 tar uf gettext-tools/misc/archive.dir.tar --owner=0 --group=0 --numeric-owner -C "$oldFilesDir" "''${oldFiles[@]}" 67 68 substituteAllInPlace gettext-runtime/src/gettext.sh.in 69 substituteInPlace gettext-tools/projects/KDE/trigger --replace "/bin/pwd" pwd 70 substituteInPlace gettext-tools/projects/GNOME/trigger --replace "/bin/pwd" pwd 71 substituteInPlace gettext-tools/src/project-id --replace "/bin/pwd" pwd 72 '' 73 + lib.optionalString stdenv.hostPlatform.isCygwin '' 74 sed -i -e "s/\(cldr_plurals_LDADD = \)/\\1..\/gnulib-lib\/libxml_rpl.la /" gettext-tools/src/Makefile.in 75 sed -i -e "s/\(libgettextsrc_la_LDFLAGS = \)/\\1..\/gnulib-lib\/libxml_rpl.la /" gettext-tools/src/Makefile.in 76 '' 77 + lib.optionalString stdenv.hostPlatform.isMinGW '' 78 sed -i "s/@GNULIB_CLOSE@/1/" */*/unistd.in.h 79 ''; 80 81 strictDeps = true; 82 nativeBuildInputs = [ 83 updateAutotoolsGnuConfigScriptsHook 84 ]; 85 buildInputs = 86 lib.optionals (!stdenv.hostPlatform.isMinGW) [ 87 bashNonInteractive 88 ] 89 ++ lib.optionals (!stdenv.hostPlatform.isLinux && !stdenv.hostPlatform.isCygwin) [ 90 # HACK, see #10874 (and 14664) 91 libiconv 92 ]; 93 94 setupHooks = [ 95 ../../../build-support/setup-hooks/role.bash 96 ./gettext-setup-hook.sh 97 ]; 98 env = { 99 gettextNeedsLdflags = stdenv.hostPlatform.libc != "glibc" && !stdenv.hostPlatform.isMusl; 100 }; 101 102 enableParallelBuilding = true; 103 enableParallelChecking = false; # fails sometimes 104 105 meta = with lib; { 106 description = "Well integrated set of translation tools and documentation"; 107 108 longDescription = '' 109 Usually, programs are written and documented in English, and use 110 English at execution time for interacting with users. Using a common 111 language is quite handy for communication between developers, 112 maintainers and users from all countries. On the other hand, most 113 people are less comfortable with English than with their own native 114 language, and would rather be using their mother tongue for day to 115 day's work, as far as possible. Many would simply love seeing their 116 computer screen showing a lot less of English, and far more of their 117 own language. 118 119 GNU `gettext` is an important step for the GNU Translation Project, as 120 it is an asset on which we may build many other steps. This package 121 offers to programmers, translators, and even users, a well integrated 122 set of tools and documentation. Specifically, the GNU `gettext` 123 utilities are a set of tools that provides a framework to help other 124 GNU packages produce multi-lingual messages. 125 ''; 126 127 homepage = "https://www.gnu.org/software/gettext/"; 128 129 maintainers = with maintainers; [ zimbatm ]; 130 license = licenses.gpl2Plus; 131 platforms = platforms.all; 132 }; 133} 134 135// lib.optionalAttrs stdenv.hostPlatform.isDarwin { 136 makeFlags = [ "CFLAGS=-D_FORTIFY_SOURCE=0" ]; 137}