fop: Drop runtime dependency on the JDK

This commit is contained in:
Eelco Dolstra 2014-01-03 16:03:36 +01:00
parent 4728ec3f99
commit 48701a3cef

View File

@ -4,34 +4,28 @@ stdenv.mkDerivation rec {
name = "fop-1.1"; name = "fop-1.1";
src = fetchurl { src = fetchurl {
url = "http://apache.uib.no/xmlgraphics/fop/source/${name}-src.tar.gz"; url = "mirror://apache/xmlgraphics/fop/source/${name}-src.tar.gz";
sha256 = "08i56d57w5dl5bqchr34x9165hvi5h4bhiflxhi0a4wd56rlq5jq"; sha256 = "08i56d57w5dl5bqchr34x9165hvi5h4bhiflxhi0a4wd56rlq5jq";
}; };
buildInputs = [ ant jdk ]; buildInputs = [ ant jdk ];
buildPhase = '' buildPhase = "ant";
ant
'';
installPhase = '' installPhase = ''
mkdir -p "$out/bin" mkdir -p $out/bin $out/lib $out/share/doc/fop
mkdir -p "$out/lib"
mkdir -p "$out/share/doc/fop"
cp build/*.jar lib/*.jar "$out/lib/" cp build/*.jar lib/*.jar $out/lib/
cp -r README examples/ "$out/share/doc/fop/" cp -r README examples/ $out/share/doc/fop/
# There is a fop script in the source archive, but it has many impurities. # 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. # Instead of patching out 90 % of the script, we write our own.
cat > "$out/bin/fop" <<EOF cat > "$out/bin/fop" <<EOF
#!${stdenv.shell} #!${stdenv.shell}
java_exec_args="-Djava.awt.headless=true" java_exec_args="-Djava.awt.headless=true"
# Note the wildcard; it will be passed to java and java will expand it exec ${jdk.jre}/bin/java \$java_exec_args -classpath "$out/lib/*" org.apache.fop.cli.Main "\$@"
LOCALCLASSPATH="$out/lib/*"
exec "${jdk}/bin/java" \$java_exec_args -classpath "\$LOCALCLASSPATH" org.apache.fop.cli.Main "\$@"
EOF EOF
chmod a+x "$out/bin/fop" chmod a+x $out/bin/fop
''; '';
meta = with stdenv.lib; { meta = with stdenv.lib; {