nixpkgs/pkgs/tools/typesetting/fop/default.nix
Profpatsch 4a7f99d55d treewide: with stdenv.lib; in meta -> with lib;
Part of: https://github.com/NixOS/nixpkgs/issues/108938

meta = with stdenv.lib;

is a widely used pattern. We want to slowly remove
the `stdenv.lib` indirection and encourage people
to use `lib` directly. Thus let’s start with the meta
field.

This used a rewriting script to mostly automatically
replace all occurances of this pattern, and add the
`lib` argument to the package header if it doesn’t
exist yet.

The script in its current form is available at
https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
2021-01-11 10:38:22 +01:00

52 lines
1.7 KiB
Nix

{ fetchurl, lib, stdenv, ant, jdk, runtimeShell }:
stdenv.mkDerivation rec {
pname = "fop";
version = "2.1";
src = fetchurl {
url = "mirror://apache/xmlgraphics/fop/source/${pname}-${version}-src.tar.gz";
sha256 = "165rx13q47l6qc29ppr7sg1z26vw830s3rkklj5ap7wgvy0ivbz5";
};
buildInputs = [ ant jdk ];
buildPhase = "ant";
installPhase = ''
mkdir -p $out/bin $out/lib $out/share/doc/fop
cp build/*.jar lib/*.jar $out/lib/
cp -r README examples/ $out/share/doc/fop/
# There is a fop script in the source archive, but it has many impurities.
# Instead of patching out 90 % of the script, we write our own.
cat > "$out/bin/fop" <<EOF
#!${runtimeShell}
java_exec_args="-Djava.awt.headless=true"
exec ${jdk.jre}/bin/java \$java_exec_args -classpath "$out/lib/*" org.apache.fop.cli.Main "\$@"
EOF
chmod a+x $out/bin/fop
'';
meta = with lib; {
description = "XML formatter driven by XSL Formatting Objects (XSL-FO)";
longDescription = ''
FOP is a Java application that reads a formatting object tree and then
turns it into a wide variety of output presentations (including AFP, PCL,
PDF, PNG, PostScript, RTF, TIFF, and plain text), or displays the result
on-screen.
The formatting object tree can be in the form of an XML document (output
by an XSLT engine like xalan) or can be passed in memory as a DOM
Document or (in the case of xalan) SAX events.
This package contains the fop command line tool.
'';
homepage = "https://xmlgraphics.apache.org/fop/";
license = licenses.asl20;
platforms = platforms.all;
maintainers = with maintainers; [ bjornfor ];
};
}