Contents
/opt/fop/{build,lib}
; JAI components include
libmlib_jai.so, jai_codec.jar, jai_core.jar, and
mlibwrapper_jai.jar
The FOP (Formatting Objects Processor) package contains a print formatter driven by XSL formatting objects (XSL-FO). It is a Java application that reads a formatting object tree and renders the resulting pages to a specified output. Output formats currently supported include PDF, PCL, PostScript, SVG, XML (area tree representation), print, AWT, MIF and ASCII text. The primary output target is PDF.
This package is known to build and work properly using an LFS-SVN-20101029 platform.
Download (HTTP): http://archive.apache.org/dist/xmlgraphics/fop/source/fop-1.0-src.tar.gz
Download (FTP): ftp://anduin.linuxfromscratch.org/BLFS/svn/f/fop-1.0-src.tar.gz
Download MD5 sum: 95dcc4c2dd08b4bc88ce9ce1ee88c439
Download size: 16.1 MB
Estimated disk space required: 360 MB
Estimated build time: 2.8 SBU
Required packages
Objects for Formatting Objects (OFFO) hyphenation
patterns:
http://downloads.sourceforge.net/offo/offo-hyphenation_v2.0.zip
a78171d47c9af223c51bbd42df36f26d
858 KB
Java Advanced Imaging (JAI) API components:
http://download.java.net/media/jai/builds/release/1_1_3/jai-1_1_3-lib-linux-i586-jdk.bin
a63b661c4940582aa1679233e5f518b2
3.4 MB
Xorg-7.6, Apache Ant-1.8.1, and Java Advanced Imaging (JAI) API components
JIMI SDK, XMLUnit, JAI Image I/O Tools, JEuclid, PMD (requires Jaxen), and Forrest (Forrest used only to rebuild the documentation)
User Notes: http://wiki.linuxfromscratch.org/blfs/wiki/fop
You must run this installation from an X-window using a GL-aware Xorg server or some of the JUnit tests will hang. Using an X-window from the console is the preferred method.
Ensure $JAVA_HOME
is set correctly
before beginning the build. To build the JIMI SDK and/or XMLUnit extension classes, ensure the
corresponding .jar
files are
identified in the CLASSPATH
environment
variable.
Before beginning the build, unpack the FOP source tarball and the hyphenation zipfile from the same directory, then change directories into the root of the FOP source tree. Copy the XML hyphenation patterns into the FOP source tree by running the following commands:
cp ../offo-hyphenation/hyph/* hyph && rm -rf ../offo-hyphenation
The $FOP_PKG_DIR/jai-1_1_3-lib-linux-i586-jdk.bin command below installs the JAI components in the JDK tree. You will be required to view, and then accept (by entering a y keypress), a license agreement before the installation will continue. If you are scripting (automating) the build, you'll need to account for this. There is information about automating build commands in the Automated Building Procedures section of Chapter 2. Towards the end of this section, specific information for automating this type of installation is discussed.
Install the JAI components by running the following commands as
the root
user while in the root
of the FOP source tree:
FOP_PKG_DIR=$(pwd)/.. && pushd $JAVA_HOME && sh $FOP_PKG_DIR/jai-1_1_3-lib-linux-i586-jdk.bin && popd
If Forrest is not installed, remove a reference to it in the build.xml:
sed -i -e "s/all,javadocs,docs/all,javadocs/" \ -e '\#${dist.bin.result.dir}/docs#,\#</copy>#d' build.xml
Compile FOP by running the following commands:
ant dist
The unit regression tests were performed in the build step above.
Now, as the root
user:
install -v -d -m755 /opt/fop-1.0 && mv -v dist-bin/fop-1.0/* /opt/fop-1.0 && ln -v -sf fop-1.0 /opt/fop
FOP_PKG_DIR=$(pwd)/..: This assumes that the source packages are stored one level above the current working directory. This is always the default; but may be different because of personal taste. If necessary, change this to match the directory where the FOP tarball can be found.
sh
$FOP_PKG_DIR/jai-1_1_3-lib-linux-i586-jdk.bin: This
command installs the JAI
components into the JDK file
structure. $FOP_PKG_DIR
is used as a
reference point to the source executable.
ant dist: This reads
the build.xml
file's dist
target, builds the package and runs the unit
regression tests. It also creates the Java API documentation and a
directory where the newly created binaries are placed. This
directory is used to install FOP
into its final place.
ln -v -sf fop-1.0
/opt/fop: This is optional and creates a
convenience symlink so that $FOP_HOME
doesn't have to be changed each time there's a package version
change.
Using FOP to process some large FO's (including the FO derived from the BLFS XML sources), can lead to memory errors. Unless you add a parameter to the java command used in the fop script you may receive messages similar to the one shown below:
Exception in thread "main"
java.lang.OutOfMemoryError: Java heap space
To avoid errors like this, you need to pass an extra parameter to
the java command
used in the fop
script. This can be accomplished by creating a ~/.foprc
(which is sourced by the fop script) and adding the
parameter to the FOP_OPTS
environment
variable.
The fop script
looks for a FOP_HOME
environment
variable to locate the FOP class
libraries. You can create this variable using the ~/.foprc
file as well. Create a ~/.foprc
file using the following commands:
cat > ~/.foprc << "EOF"
FOP_OPTS="-Xmx<RAM_Installed>
m"
FOP_HOME="/opt/fop"
EOF
Replace <RAM_Installed>
with a
number representing the amount of RAM installed in your computer
(in megabytes). An example would be FOP_OPTS="-Xmx768m"
. For more
information about memory issues running FOP, see http://xml.apache.org/fop/running.html#memory.
To include the fop script in your path, update your personal or system-wide profile with the following:
PATH=$PATH:/opt/fop
/opt/fop/{build,lib}
; JAI components include
libmlib_jai.so, jai_codec.jar, jai_core.jar, and
mlibwrapper_jai.jar
Last updated on 2010-11-12 14:13:51 +0000