about summary refs log tree commit diff
path: root/pkgs/tools/typesetting/xmlto/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/tools/typesetting/xmlto/default.nix')
-rw-r--r--pkgs/tools/typesetting/xmlto/default.nix78
1 files changed, 60 insertions, 18 deletions
diff --git a/pkgs/tools/typesetting/xmlto/default.nix b/pkgs/tools/typesetting/xmlto/default.nix
index 09597be8540df..848b72eee0876 100644
--- a/pkgs/tools/typesetting/xmlto/default.nix
+++ b/pkgs/tools/typesetting/xmlto/default.nix
@@ -1,13 +1,32 @@
-{ fetchurl, fetchpatch, lib, stdenv, libxml2, libxslt
-, docbook_xml_dtd_45, docbook_xsl, flex, w3m
-, bash, getopt, makeWrapper }:
+{
+  bash,
+  coreutils,
+  docbook_xml_dtd_45,
+  docbook_xsl,
+  docbook-xsl-ns,
+  fetchpatch,
+  fetchurl,
+  findutils,
+  flex,
+  getopt,
+  gnugrep,
+  gnused,
+  lib,
+  libxml2,
+  libxslt,
+  makeWrapper,
+  stdenv,
+  testers,
+  w3m,
+}:
 
-stdenv.mkDerivation rec {
+stdenv.mkDerivation (finalAttrs: {
   pname = "xmlto";
   version = "0.0.28";
+
   src = fetchurl {
-    url = "https://releases.pagure.org/${pname}/${pname}-${version}.tar.bz2";
-    sha256 = "0xhj8b2pwp4vhl9y16v3dpxpsakkflfamr191mprzsspg4xdyc0i";
+    url = "https://releases.pagure.org/xmlto/xmlto-${finalAttrs.version}.tar.bz2";
+    hash = "sha256-ETDfOnlX659vDSnkqhx1cyp9+21jm+AThZtcfsVCEnY=";
   };
 
   # Note: These patches modify `xmlif/xmlif.l`, which requires `flex` to be rerun.
@@ -28,17 +47,34 @@ stdenv.mkDerivation rec {
     patchShebangs xmlif/test/run-test
 
     substituteInPlace "xmlto.in" \
-      --replace "/bin/bash" "${bash}/bin/bash"
-    substituteInPlace "xmlto.in" \
-      --replace "/usr/bin/locale" "$(type -P locale)"
-    substituteInPlace "xmlto.in" \
-      --replace "mktemp" "$(type -P mktemp)"
+      --replace-fail "@BASH@" "${bash}/bin/bash" \
+      --replace-fail "@FIND@" "${findutils}/bin/find" \
+      --replace-fail "@GETOPT@" "${getopt}/bin/getopt" \
+      --replace-fail "@GREP@" "${gnugrep}/bin/grep" \
+      --replace-fail "@MKTEMP@" "$(type -P mktemp)" \
+      --replace-fail "@SED@" "${gnused}/bin/sed" \
+      --replace-fail "@TAIL@" "${coreutils}/bin/tail"
+
+    for f in format/docbook/* xmlto.in; do
+      substituteInPlace $f \
+        --replace-fail "http://docbook.sourceforge.net/release/xsl/current" "${docbook-xsl-ns}/xml/xsl/docbook"
+    done
   '';
 
   # `libxml2' provides `xmllint', needed at build-time and run-time.
   # `libxslt' provides `xsltproc', used by `xmlto' at run-time.
-  nativeBuildInputs = [ makeWrapper flex getopt ];
-  buildInputs = [ libxml2 libxslt docbook_xml_dtd_45 docbook_xsl ];
+  nativeBuildInputs = [
+    makeWrapper
+    flex
+    getopt
+  ];
+
+  buildInputs = [
+    docbook_xml_dtd_45
+    docbook_xsl
+    libxml2
+    libxslt
+  ];
 
   postInstall = ''
     # `w3m' is needed for HTML to text conversions.
@@ -46,18 +82,24 @@ stdenv.mkDerivation rec {
        --prefix PATH : "${lib.makeBinPath [ libxslt libxml2 getopt w3m ]}"
   '';
 
+  passthru.tests.version = testers.testVersion {
+    command = "${lib.getExe finalAttrs.finalPackage} --version";
+    package = finalAttrs.finalPackage;
+  };
+
   meta = {
+    changelog = "https://pagure.io/xmlto/blob/master/f/ChangeLog";
     description = "Front-end to an XSL toolchain";
-
+    homepage = "https://pagure.io/xmlto/";
+    license = lib.licenses.gpl2Plus;
     longDescription = ''
       xmlto is a front-end to an XSL toolchain.  It chooses an
       appropriate stylesheet for the conversion you want and applies
       it using an external XSL-T processor.  It also performs any
       necessary post-processing.
     '';
-
-    license = lib.licenses.gpl2Plus;
-    homepage = "https://pagure.io/xmlto/";
+    mainProgram = "xmlto";
+    maintainers = [ ];
     platforms = lib.platforms.unix;
   };
-}
+})