3
# run-fop: Attempt to run fop (or fop.sh), fail articulately otherwise.
5
# Usage: run-fop.sh BOOK_TOP [FOP_ARGS...]
7
# This script is meant to be invoked by subversion/doc/book/Makefile.
8
# The first argument is the top of the book directory, that is,
9
# subversion/doc/book (*not* subversion/doc/book/book), and the
10
# remaining arguments are passed along to `fop'.
14
if [ "${BOOK_TOP}X" = X ]; then
15
echo "usage: run-fop.sh BOOK_TOP [FOP_ARGS...]"
21
# The fop of last resort.
22
DESPERATION_FOP_DIR=${BOOK_TOP}/tools/fop
23
DESPERATION_FOP_PGM=${DESPERATION_FOP_DIR}/fop.sh
25
if [ "${FOP_HOME}X" = X ]; then
26
FOP_HOME=${DESPERATION_FOP_DIR}
31
# Unfortunately, 'which' seems to behave slightly differently on every
32
# platform, making it unreliable for shell scripts. Just do it inline
33
# instead. Also, note that we search for `fop' or `fop.sh', since
34
# different systems seem to package it different ways.
37
for dir in ${PATH}; do
38
if [ -x ${dir}/fop -a "${FOP_PGM}X" = X ]; then
40
elif [ -x ${dir}/fop.sh -a "${FOP_PGM}X" = X ]; then
46
if [ "${FOP_PGM}X" = X ]; then
47
FOP_PGM=${DESPERATION_FOP_PGM}
50
echo "(Using '${FOP_PGM}' for FOP)"
52
# FOP is noisy on stdout, and -q doesn't seem to help, so stuff that
53
# garbage into /dev/null.
54
${FOP_PGM} $@ | grep -v "\[ERROR\]"