at 23.11-beta 67 lines 3.1 kB view raw
1{ stdenv, lib, fetchurl, docbook_xsl, docbook_xsl_ns, gettext, libxslt, glibcLocales, docbook_xml_dtd_412, docbook_sgml_dtd_41, opensp, bash 2, perl, buildPerlPackage, ModuleBuild, TextWrapI18N, LocaleGettext, TermReadKey, SGMLSpm, UnicodeLineBreak, PodParser, YAMLTiny 3, fetchpatch, writeShellScriptBin 4}: 5 6buildPerlPackage rec { 7 pname = "po4a"; 8 version = "0.62"; 9 src = fetchurl { 10 url = "https://github.com/mquinson/po4a/releases/download/v${version}/po4a-${version}.tar.gz"; 11 sha256 = "0eb510a66f59de68cf7a205342036cc9fc08b39334b91f1456421a5f3359e68b"; 12 }; 13 patches = [ 14 (fetchpatch { 15 # make devdoc output reproducible 16 # https://github.com/mquinson/po4a/pull/387 17 url = "https://github.com/mquinson/po4a/commit/df7433b58f6570558d44b6aac885c2a8f7862e51.patch"; 18 sha256 = "9MVkYiItR2P3PBCUc4OhEOUHQuLqTWUYtYlZ3L8miC8="; 19 }) 20 ]; 21 22 strictDeps = true; 23 nativeBuildInputs = 24 # the tests for the tex-format use kpsewhich -- texlive's file finding utility. 25 # We don't want to depend on texlive here, so we replace it with a minimal 26 # shellscript that suffices for the tests in t/fmt/tex/, i.e. it looks up 27 # article.cls to an existing file, but doesn't find article-wrong.cls. 28 let kpsewhich-stub = writeShellScriptBin "kpsewhich" 29 ''[[ $1 = "article.cls" ]] && echo /dev/null''; 30 in 31 [ gettext libxslt docbook_xsl docbook_xsl_ns ModuleBuild docbook_xml_dtd_412 docbook_sgml_dtd_41 opensp kpsewhich-stub glibcLocales ]; 32 propagatedBuildInputs = lib.optional (!stdenv.hostPlatform.isMusl) TextWrapI18N ++ [ LocaleGettext SGMLSpm UnicodeLineBreak PodParser YAMLTiny ]; 33 # TODO: TermReadKey was temporarily removed from propagatedBuildInputs to unfreeze the build 34 buildInputs = [ bash ]; 35 LC_ALL = "en_US.UTF-8"; 36 SGML_CATALOG_FILES = "${docbook_xml_dtd_412}/xml/dtd/docbook/catalog.xml"; 37 preConfigure = '' 38 touch Makefile.PL 39 export PERL_MB_OPT="--install_base=$out --prefix=$out" 40 ''; 41 buildPhase = "perl Build.PL --install_base=$out --install_path=\"lib=$out/${perl.libPrefix}\"; ./Build build"; 42 43 # Disabling tests on musl 44 # Void linux package have investigated the failure and tracked it down to differences in gettext behavior. They decided to disable tests. 45 # https://github.com/void-linux/void-packages/pull/34029#issuecomment-973267880 46 # Alpine packagers have not worried about running the tests until now: 47 # https://git.alpinelinux.org/aports/tree/main/po4a/APKBUILD#n11 48 # 49 # Disabling tests on Darwin until https://github.com/NixOS/nixpkgs/issues/236560 is resolved. 50 doCheck = (!stdenv.hostPlatform.isMusl) && (!stdenv.hostPlatform.isDarwin); 51 52 checkPhase = '' 53 export SGML_CATALOG_FILES=${docbook_sgml_dtd_41}/sgml/dtd/docbook-4.1/docbook.cat 54 ./Build test 55 ''; 56 installPhase = '' 57 ./Build install 58 for f in $out/bin/*; do 59 substituteInPlace $f --replace "#! /usr/bin/env perl" "#!${perl}/bin/perl" 60 done 61 ''; 62 meta = { 63 description = "Tools for helping translation of documentation"; 64 homepage = "https://po4a.org"; 65 license = with lib.licenses; [ gpl2Only ]; 66 }; 67}