nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 100 lines 2.4 kB view raw
1{ 2 stdenv, 3 lib, 4 fetchurl, 5 fetchpatch, 6 texlive, 7 texliveInfraOnly, 8 buildPackages, 9}: 10 11let 12 buildPlatformTools = [ 13 "pse2unic" 14 "adobe2h" 15 ]; 16 tex = texliveInfraOnly.withPackages (ps: [ ps.collection-fontsrecommended ]); 17in 18 19stdenv.mkDerivation (finalAttrs: { 20 pname = "catdvi"; 21 version = "0.14"; 22 src = fetchurl { 23 url = with finalAttrs; "http://downloads.sourceforge.net/${pname}/${pname}-${version}.tar.bz2"; 24 hash = "sha256-orVQVdQuRXp//OGkA7xRidNi4+J+tkw398LPZ+HX+k8="; 25 }; 26 27 patches = [ 28 # fix error: conflicting types for 'kpathsea_version_string'; have 'char *' 29 (fetchpatch { 30 url = "https://sources.debian.org/data/main/c/catdvi/0.14-14/debian/patches/03_kpathsea_version_string_declaration.diff"; 31 hash = "sha256-d3CPDxXdVVLNtKkN0rC2G02dh/bJrRll/nVzQNggwkk="; 32 }) 33 ]; 34 35 # fix implicit-int compile error in test code used in configure script 36 postPatch = '' 37 sed -i 's/^main()/int main()/' configure 38 ''; 39 40 hardeningDisable = [ "format" ]; 41 42 outputs = [ "out" ] ++ lib.optional (with stdenv; buildPlatform.canExecute hostPlatform) "dev"; 43 44 setOutputFlags = false; 45 46 enableParallelBuilding = true; 47 48 preBuild = lib.optionalString (with stdenv; !buildPlatform.canExecute hostPlatform) ( 49 lib.concatMapStringsSep "\n" (tool: '' 50 cp ${lib.getDev buildPackages.catdvi}/bin/${tool} . 51 '') buildPlatformTools 52 ); 53 54 nativeBuildInputs = [ 55 texlive.bin.core 56 texlive.bin.core.dev 57 ]; 58 59 buildInputs = [ 60 tex 61 ]; 62 63 makeFlags = [ 64 "catdvi" # to avoid running tests until checkPhase 65 ] 66 ++ lib.optionals (with stdenv; !buildPlatform.canExecute hostPlatform) ( 67 map (tool: "--assume-old=${tool}") buildPlatformTools 68 ); 69 70 nativeCheckInputs = [ 71 texlive 72 ]; 73 74 testFlags = [ 75 "all1" 76 ]; 77 78 preInstall = '' 79 mkdir -p $out/{bin,man/man1} 80 ''; 81 82 postInstall = 83 lib.optionalString (with stdenv; buildPlatform.canExecute hostPlatform) '' 84 mkdir -p $dev/bin 85 ${lib.concatMapStringsSep "\n" (tool: '' 86 cp ${tool} $dev/bin/ 87 '') buildPlatformTools} 88 '' 89 + '' 90 mkdir -p $out/share 91 ln -s ${tex}/share/texmf-var $out/share/texmf 92 ''; 93 94 meta = { 95 homepage = "https://catdvi.sourceforge.net"; 96 description = "DVI to plain text translator"; 97 license = lib.licenses.gpl2Plus; 98 maintainers = [ ]; 99 }; 100})