1 { fetchurl, lib, stdenv, ant, jdk, runtimeShell }:
3 stdenv.mkDerivation rec {
8 url = "mirror://apache/xmlgraphics/fop/source/${pname}-${version}-src.tar.gz";
9 sha256 = "sha256-tPGlISmJzrx9F8cnX70j3nPMVyWdkojAFDZVYlSthtQ=";
12 buildInputs = [ ant jdk ];
14 # build only the "package" target, which generates the fop command.
16 export JAVA_TOOL_OPTIONS="-Dfile.encoding=UTF8"
17 ant -f fop/build.xml package
21 mkdir -p $out/bin $out/lib $out/share/doc/fop
22 cp fop/build/*.jar fop/lib/*.jar $out/lib/
23 cp -r README fop/examples/ $out/share/doc/fop/
25 # There is a fop script in the source archive, but it has many impurities.
26 # Instead of patching out 90 % of the script, we write our own.
27 cat > "$out/bin/fop" <<EOF
29 java_exec_args="-Djava.awt.headless=true"
30 exec ${jdk.jre}/bin/java \$java_exec_args -classpath "$out/lib/*" org.apache.fop.cli.Main "\$@"
32 chmod a+x $out/bin/fop
36 description = "XML formatter driven by XSL Formatting Objects (XSL-FO)";
38 FOP is a Java application that reads a formatting object tree and then
39 turns it into a wide variety of output presentations (including AFP, PCL,
40 PDF, PNG, PostScript, RTF, TIFF, and plain text), or displays the result
43 The formatting object tree can be in the form of an XML document (output
44 by an XSLT engine like xalan) or can be passed in memory as a DOM
45 Document or (in the case of xalan) SAX events.
47 This package contains the fop command line tool.
49 homepage = "https://xmlgraphics.apache.org/fop/";
50 license = licenses.asl20;
51 sourceProvenance = with sourceTypes; [
53 binaryBytecode # source bundles dependencies as jars
55 platforms = platforms.all;
56 maintainers = with maintainers; [ bjornfor ];