Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

po4a: format, make msgmerge command available #357685

Open
wants to merge 2 commits into
base: staging
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 55 additions & 40 deletions pkgs/development/perl-modules/Po4a/default.nix
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
{ stdenv
, lib
, fetchurl
, docbook_xsl
, docbook_xsl_ns
, gettext
, libxslt
, glibcLocales
, docbook_xml_dtd_45
, docbook_sgml_dtd_41
, opensp
, bash
, fetchpatch
, perl
, buildPerlPackage
, ModuleBuild
, TextWrapI18N
, LocaleGettext
, SGMLSpm
, UnicodeLineBreak
, PodParser
, YAMLTiny
, SyntaxKeywordTry
, writeShellScriptBin
{
stdenv,
lib,
fetchurl,
docbook_xsl,
docbook_xsl_ns,
gettext,
libxslt,
glibcLocales,
docbook_xml_dtd_45,
docbook_sgml_dtd_41,
opensp,
bash,
fetchpatch,
perl,
buildPerlPackage,
makeWrapper,
ModuleBuild,
TextWrapI18N,
LocaleGettext,
SGMLSpm,
UnicodeLineBreak,
PodParser,
YAMLTiny,
SyntaxKeywordTry,
writeShellScriptBin,
}:

buildPerlPackage rec {
Expand All @@ -41,14 +43,14 @@ buildPerlPackage rec {
# 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'';
kpsewhich-stub = writeShellScriptBin "kpsewhich" ''[[ $1 = "article.cls" ]] && echo /dev/null'';
in
[
gettext
libxslt
docbook_xsl
docbook_xsl_ns
makeWrapper
ModuleBuild
docbook_xml_dtd_45
docbook_sgml_dtd_41
Expand All @@ -62,19 +64,21 @@ buildPerlPackage rec {
url = "https://github.com/mquinson/po4a/commit/28fe52651eb8096d97d6bd3a97b3168522ba5306.patch";
hash = "sha256-QUXxkSzcnwRvU+2y2KoBXmtfE8qTZ2BV0StkJHqZehQ=";
})
];
];

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

buildInputs = [ bash ];

Expand All @@ -87,8 +91,10 @@ buildPerlPackage rec {
'';

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

# Disabling tests on musl
Expand All @@ -101,21 +107,30 @@ buildPerlPackage rec {
doCheck = (!stdenv.hostPlatform.isMusl) && (!stdenv.hostPlatform.isDarwin);

checkPhase = ''
runHook preCheck
export SGML_CATALOG_FILES=${docbook_sgml_dtd_41}/sgml/dtd/docbook-4.1/docbook.cat
./Build test
runHook postCheck
'';

installPhase = ''
runHook preInstall
./Build install
for f in $out/bin/*; do
substituteInPlace $f --replace "#! /usr/bin/env perl" "#!${perl}/bin/perl"
substituteInPlace $f --replace "exec perl" "exec ${perl}/bin/perl"
for f in $out/bin/{msguntypot,po4a,po4a-gettextize,po4a-normalize,po4a-translate,po4a-updatepo}; do
substituteInPlace $f --replace-fail "exec perl" "exec ${lib.getExe perl}"
done
runHook postInstall
'';

postFixup = ''
wrapProgram $out/bin/po4a \
--prefix PATH : ${lib.makeBinPath [ gettext ]}
'';

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