{ fetchurl, lib, stdenv, ant, jdk, runtimeShell }: stdenv.mkDerivation rec { pname = "fop"; version = "2.8"; src = fetchurl { url = "mirror://apache/xmlgraphics/fop/source/${pname}-${version}-src.tar.gz"; sha256 = "sha256-b7Av17wu6Ar/npKOiwYqzlvBFSIuXTpqTacM1sxtBvc="; }; buildInputs = [ ant jdk ]; # build only the "package" target, which generates the fop command. buildPhase = '' export JAVA_TOOL_OPTIONS="-Dfile.encoding=UTF8" ant -f fop/build.xml package ''; installPhase = '' mkdir -p $out/bin $out/lib $out/share/doc/fop cp fop/build/*.jar fop/lib/*.jar $out/lib/ cp -r README fop/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" <