Skip to content

Commit

Permalink
Merge pull request #309008 from linsui/po4a
Browse files Browse the repository at this point in the history
po4a: 0.62 -> 0.71
  • Loading branch information
stigtsp authored May 5, 2024
2 parents 158b4a0 + fd7787f commit 56d8e18
Showing 1 changed file with 65 additions and 20 deletions.
85 changes: 65 additions & 20 deletions pkgs/development/perl-modules/Po4a/default.nix
Original file line number Diff line number Diff line change
@@ -1,44 +1,87 @@
{ stdenv, lib, fetchurl, docbook_xsl, docbook_xsl_ns, gettext, libxslt, glibcLocales, docbook_xml_dtd_412, docbook_sgml_dtd_41, opensp, bash
, perl, buildPerlPackage, ModuleBuild, TextWrapI18N, LocaleGettext, TermReadKey, SGMLSpm, UnicodeLineBreak, PodParser, YAMLTiny
, fetchpatch, writeShellScriptBin
{ stdenv
, lib
, fetchurl
, docbook_xsl
, docbook_xsl_ns
, gettext
, libxslt
, glibcLocales
, docbook_xml_dtd_45
, docbook_sgml_dtd_41
, opensp
, bash
, perl
, buildPerlPackage
, ModuleBuild
, TextWrapI18N
, LocaleGettext
, SGMLSpm
, UnicodeLineBreak
, PodParser
, YAMLTiny
, SyntaxKeywordTry
, writeShellScriptBin
}:

buildPerlPackage rec {
pname = "po4a";
version = "0.62";
version = "0.71";

src = fetchurl {
url = "https://github.com/mquinson/po4a/releases/download/v${version}/po4a-${version}.tar.gz";
sha256 = "0eb510a66f59de68cf7a205342036cc9fc08b39334b91f1456421a5f3359e68b";
hash = "sha256-xXJAHknMEXV8bTBgkW/ftagzJR7R1K65ibZnBLzyg/k=";
};
patches = [
(fetchpatch {
# make devdoc output reproducible
# https://github.com/mquinson/po4a/pull/387
url = "https://github.com/mquinson/po4a/commit/df7433b58f6570558d44b6aac885c2a8f7862e51.patch";
sha256 = "9MVkYiItR2P3PBCUc4OhEOUHQuLqTWUYtYlZ3L8miC8=";
})
];

strictDeps = true;

nativeBuildInputs =
# the tests for the tex-format use kpsewhich -- texlive's file finding utility.
# We don't want to depend on texlive here, so we replace it with a minimal
# shellscript that suffices for the tests in t/fmt/tex/, i.e. it looks up
# article.cls to an existing file, but doesn't find article-wrong.cls.
let kpsewhich-stub = writeShellScriptBin "kpsewhich"
''[[ $1 = "article.cls" ]] && echo /dev/null'';
let
kpsewhich-stub = writeShellScriptBin "kpsewhich"
''[[ $1 = "article.cls" ]] && echo /dev/null'';
in
[ gettext libxslt docbook_xsl docbook_xsl_ns ModuleBuild docbook_xml_dtd_412 docbook_sgml_dtd_41 opensp kpsewhich-stub glibcLocales ];
propagatedBuildInputs = lib.optional (!stdenv.hostPlatform.isMusl) TextWrapI18N ++ [ LocaleGettext SGMLSpm UnicodeLineBreak PodParser YAMLTiny ];
[
gettext
libxslt
docbook_xsl
docbook_xsl_ns
ModuleBuild
docbook_xml_dtd_45
docbook_sgml_dtd_41
opensp
kpsewhich-stub
glibcLocales
];

# TODO: TermReadKey was temporarily removed from propagatedBuildInputs to unfreeze the build
propagatedBuildInputs = lib.optionals (!stdenv.hostPlatform.isMusl) [
TextWrapI18N
] ++ [
LocaleGettext
SGMLSpm
UnicodeLineBreak
PodParser
YAMLTiny
SyntaxKeywordTry
];

buildInputs = [ bash ];

LC_ALL = "en_US.UTF-8";
SGML_CATALOG_FILES = "${docbook_xml_dtd_412}/xml/dtd/docbook/catalog.xml";
SGML_CATALOG_FILES = "${docbook_xml_dtd_45}/xml/dtd/docbook/catalog.xml";

preConfigure = ''
touch Makefile.PL
export PERL_MB_OPT="--install_base=$out --prefix=$out"
'';
buildPhase = "perl Build.PL --install_base=$out --install_path=\"lib=$out/${perl.libPrefix}\"; ./Build build";

buildPhase = ''
perl Build.PL --install_base=$out --install_path="lib=$out/${perl.libPrefix}"
./Build build
'';

# Disabling tests on musl
# Void linux package have investigated the failure and tracked it down to differences in gettext behavior. They decided to disable tests.
Expand All @@ -53,15 +96,17 @@ buildPerlPackage rec {
export SGML_CATALOG_FILES=${docbook_sgml_dtd_41}/sgml/dtd/docbook-4.1/docbook.cat
./Build test
'';

installPhase = ''
./Build install
for f in $out/bin/*; do
substituteInPlace $f --replace "#! /usr/bin/env perl" "#!${perl}/bin/perl"
done
'';

meta = {
description = "Tools for helping translation of documentation";
homepage = "https://po4a.org";
license = with lib.licenses; [ gpl2Only ];
license = with lib.licenses; [ gpl2Plus ];
};
}

0 comments on commit 56d8e18

Please sign in to comment.