nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 147 lines 3.8 kB view raw
1{ 2 lib, 3 stdenv, 4 buildPackages, 5 fetchurl, 6 perl, 7 libintl, 8 bashNonInteractive, 9 updateAutotoolsGnuConfigScriptsHook, 10 gawk, 11 freebsd, 12 glibcLocales, 13 libiconv, 14 15 # we are a dependency of gcc, this simplifies bootstrapping 16 interactive ? false, 17 ncurses, 18 procps, 19 meta, 20}: 21 22{ 23 version, 24 hash, 25 patches ? [ ], 26}: 27 28# Note: this package is used for bootstrapping fetchurl, and thus 29# cannot use fetchpatch! All mutable patches (generated by GitHub or 30# cgit) that are needed here should be included directly in Nixpkgs as 31# files. 32 33let 34 inherit (lib) 35 getBin 36 getDev 37 getLib 38 optional 39 optionals 40 optionalString 41 versionAtLeast 42 versionOlder 43 ; 44 crossBuildTools = stdenv.hostPlatform != stdenv.buildPlatform; 45in 46 47stdenv.mkDerivation { 48 pname = "texinfo${optionalString interactive "-interactive"}"; 49 inherit version; 50 51 src = fetchurl { 52 url = "mirror://gnu/texinfo/texinfo-${version}.tar.xz"; 53 inherit hash; 54 }; 55 56 patches = 57 patches 58 ++ optional ( 59 interactive && versionAtLeast version "7.2" 60 ) ./fix-test-suite-failures-with-perl-5.42.patch 61 ++ optional crossBuildTools ./cross-tools-flags.patch; 62 63 postPatch = '' 64 patchShebangs tp/maintain/regenerate_commands_perl_info.pl 65 ''; 66 67 env = { 68 XFAIL_TESTS = toString ( 69 optionals stdenv.hostPlatform.isMusl [ 70 # musl does not support locales. 71 "different_languages_gen_master_menu.sh" 72 "test_scripts/formatting_documentlanguage_cmdline.sh" 73 "test_scripts/layout_formatting_fr_info.sh" 74 "test_scripts/layout_formatting_fr.sh" 75 "test_scripts/layout_formatting_fr_icons.sh" 76 ] 77 ++ optionals (!stdenv.hostPlatform.isMusl && versionOlder version "7") [ 78 # Test is known to fail on various locales on texinfo-6.8: 79 # https://lists.gnu.org/r/bug-texinfo/2021-07/msg00012.html 80 "test_scripts/layout_formatting_fr_icons.sh" 81 ] 82 ); 83 } 84 // lib.optionalAttrs crossBuildTools { 85 # ncurses is required to build `makedoc' 86 # this feature is introduced by the ./cross-tools-flags.patch 87 NATIVE_TOOLS_CFLAGS = "-I${getDev buildPackages.ncurses}/include"; 88 NATIVE_TOOLS_LDFLAGS = "-L${getLib buildPackages.ncurses}/lib"; 89 }; 90 91 strictDeps = true; 92 enableParallelBuilding = true; 93 94 # A native compiler is needed to build tools needed at build time 95 depsBuildBuild = [ 96 buildPackages.stdenv.cc 97 perl 98 ]; 99 100 nativeBuildInputs = [ updateAutotoolsGnuConfigScriptsHook ]; 101 buildInputs = [ 102 bashNonInteractive 103 libintl 104 ] 105 ++ optionals stdenv.hostPlatform.isSunOS [ 106 libiconv 107 gawk 108 ] 109 ++ optional interactive ncurses; 110 111 configureFlags = [ 112 "PERL=${buildPackages.perl}/bin/perl" 113 ] 114 # Perl XS modules are difficult to cross-compile and texinfo has pure Perl 115 # fallbacks. 116 # Also prevent the buildPlatform's awk being used in the texindex script 117 ++ optionals crossBuildTools [ 118 "--enable-perl-xs=no" 119 "TI_AWK=${getBin gawk}/bin/awk" 120 ] 121 ++ optionals (crossBuildTools && lib.versionAtLeast version "7.1") [ 122 "texinfo_cv_sys_iconv_converts_euc_cn=yes" 123 ] 124 ++ optional stdenv.hostPlatform.isSunOS "AWK=${gawk}/bin/awk"; 125 126 installFlags = [ "TEXMF=$(out)/texmf-dist" ]; 127 installTargets = [ 128 "install" 129 "install-tex" 130 ]; 131 132 nativeCheckInputs = [ procps ] ++ optionals stdenv.buildPlatform.isFreeBSD [ freebsd.locale ]; 133 checkInputs = optionals (lib.versionAtLeast version "7.2") [ glibcLocales ]; 134 135 doCheck = interactive && !stdenv.hostPlatform.isDarwin && !stdenv.hostPlatform.isSunOS; # flaky 136 137 postFixup = optionalString crossBuildTools '' 138 for f in "$out"/bin/{pod2texi,texi2any}; do 139 substituteInPlace "$f" \ 140 --replace-fail ${buildPackages.perl}/bin/perl ${perl}/bin/perl 141 done 142 ''; 143 144 meta = meta // { 145 branch = version; 146 }; 147}