パッケージ構成
/opt/fop/{build,lib}
; JAI
components include libmlib_jai.so, jai_codec.jar, jai_core.jar,
mlibwrapper_jai.jar
FOP (Formatting Objects Processor) は XSL フォーマットオブジェクト (XSL formatting objects; XSL-FO) に基づいた、印刷フォーマッターを提供します。 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.
LFS や依存パッケージが本ブックに示す最新安定バージョンでなかった場合には、BLFS 開発版においては、パッケージのビルドや処理実行が適切に行われないことがあります。
ダウンロード (HTTP): https://archive.apache.org/dist/xmlgraphics/fop/source/fop-2.9-src.tar.gz
ダウンロード MD5 sum: f7537ca7f2e16971fa99c8bb0dad62c7
ダウンロードサイズ: 20 MB
必要ディスク容量: 333 MB (including files downloaded to the user directory)
概算ビルド時間: 0.9 SBU
Required Additional Downloads:
Maven build system:
https://archive.apache.org/dist/maven/maven-3/3.9.4/binaries/apache-maven-3.9.4-bin.tar.gz
0698a533397eda60cbebcc0fb68ae842
9.0 MB (additionally, about 90 MB are downloaded to the
building user's directory)
推奨
OFFO (Objects for Formatting Objects) ハイフネーションパターン:
https://downloads.sourceforge.net/offo/2.2/offo-hyphenation.zip
bf9c09bf05108ef9661b8f08d91c2336
862 KB
グラフィック環境 (to run tests), JAI Image I/O Tools, and JEuclid
ビルド前には環境変数 $JAVA_HOME
が適切に設定されていることを確認してください。 また JIMI
SDK や XMLUnit
といった拡張クラスをビルドする場合は、環境変数 CLASSPATH
にて対応する
.jar
が設定されていることを確認してください。
Copy the XML hyphenation patterns into the fop source tree by running the following commands:
unzip ../offo-hyphenation.zip && cp offo-hyphenation/hyph/* fop/hyph && rm -rf offo-hyphenation
Starting with fop-2.5, the Maven build system is required. We use the binary provided by apache, that we install in a temporary location:
tar -xf ../apache-maven-3.9.4-bin.tar.gz -C /tmp
The javadoc command that ships with OpenJDK 10 and later has become much stricter than previous versions regarding conformance of the Javadoc comments in source code to HTML. The FOP documentation does not meet those standards, so the conformance checks have to be disabled. This can be done with the following command:
sed -i '\@</javad@i\ <arg value="-Xdoclint:none"/>\ <arg value="--allow-script-in-comments"/>\ <arg value="--ignore-source-errors"/>' \ fop/build.xml
以下のコマンドを実行して fop をビルドします。
cd fop && LC_ALL=en_US.UTF-8 \ PATH=$PATH:/tmp/apache-maven-3.9.4/bin \ ant all javadocs && mv build/javadocs .
This package comes with a test suite, but the java infrastructure installed in this book does not allow running it.
root
ユーザーになって Fop をインストールします。
install -v -d -m755 -o root -g root /opt/fop-2.9 && cp -vR build conf examples fop* javadocs lib /opt/fop-2.9 && chmod a+x /opt/fop-2.9/fop && ln -v -sfn fop-2.9 /opt/fop
The last thing to do is to clean what we have done:
rm -rf /tmp/apache-maven-3.9.4
sed -i ... build.xml: This adds three switches to the javadoc command, preventing some errors from occurring when building the documentation.
export LC_ALL=en_US.UTF-8: the compiler fails if using an ASCII locale.
ant target
: This reads the file
build.xml
and builds the target:
compile
compiles the java sources,
jar-main
generates jar archives,
jar-hyphenation
generates the
hyphenation patterns for FOP, junit
runs the junit tests, and
javadocs
builds the documentation. The
all
target runs all of the above.
ln -v -sf fop-2.9
/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"
.
To include the fop
script in your path, update the system-wide profile with the
following command as the root
user:
cat > /etc/profile.d/fop.sh << "EOF"
# Begin /etc/profile.d/fop.sh
pathappend /opt/fop
# End /etc/profile.d/fop.sh
EOF
Running fop can
be somewhat verbose. The default logging level can be changed
from INFO to any of FINEST, FINER, FINE, CONFIG, INFO, WARNING,
SEVERE, ALL, or OFF. To do this, edit $JAVA_HOME/jre/lib/logging.properties
and
change the entries for .level
and
java.util.logging.ConsoleHandler.level
to the
desired value.
/opt/fop/{build,lib}
; JAI
components include libmlib_jai.so, jai_codec.jar, jai_core.jar,
mlibwrapper_jai.jar