diff options
-rwxr-xr-x | fop | 244 | ||||
-rwxr-xr-x | fop.sh | 126 | ||||
-rw-r--r-- | src/documentation/content/xdocs/trunk/compiling.xml | 22 | ||||
-rw-r--r-- | src/documentation/content/xdocs/trunk/running.xml | 2 |
4 files changed, 255 insertions, 139 deletions
@@ -0,0 +1,244 @@ +#! /bin/sh +# +# Copyright 2005 The Apache Software Foundation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Shell script to run FOP, adapted from the Jakarta-Ant project. + +rpm_mode=true +fop_exec_args= +no_config=false +fop_exec_debug=false +show_help=false +for arg in "$@" ; do + if [ "$arg" = "--noconfig" ] ; then + no_config=true + elif [ "$arg" = "--execdebug" ] ; then + fop_exec_debug=true + elif [ my"$arg" = my"--h" -o my"$arg" = my"--help" ] ; then + show_help=true + else + if [ my"$arg" = my"-h" -o my"$arg" = my"-help" ] ; then + show_help=true + fi + fop_exec_args="$fop_exec_args \"$arg\"" + fi +done + +# Source/default ant configuration +if $no_config ; then + rpm_mode=false +else + # load system-wide ant configuration + if [ -f "/etc/fop.conf" ] ; then + . /etc/fop.conf + fi + + # load user ant configuration + if [ -f "$HOME/.fop/fop.conf" ] ; then + . $HOME/.fop/fop.conf + fi + if [ -f "$HOME/.foprc" ] ; then + . "$HOME/.foprc" + fi + + # provide default configuration values + if [ -z "$rpm_mode" ] ; then + rpm_mode=false + fi + if [ -z "$usejikes" ] ; then + usejikes=$use_jikes_default + fi +fi + +# Setup Java environment in rpm mode +if $rpm_mode ; then + if [ -f /usr/share/java-utils/java-functions ] ; then + . /usr/share/java-utils/java-functions + set_jvm + set_javacmd + fi +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false; +darwin=false; +case "`uname`" in + CYGWIN*) cygwin=true ;; + Darwin*) darwin=true + if [ -z "$JAVA_HOME" ] ; then + JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home + fi + ;; +esac + +if [ -z "$FOP_HOME" -o ! -d "$FOP_HOME" ] ; then + ## resolve links - $0 may be a link to fop's home + PRG="$0" + progname=`basename "$0"` + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi + done + + FOP_HOME=`dirname "$PRG"` + + # make it fully qualified + FOP_HOME=`cd "$FOP_HOME" && pwd` +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin ; then + [ -n "$FOP_HOME" ] && + FOP_HOME=`cygpath --unix "$FOP_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --unix "$JAVA_HOME"` +fi + +if [ -z "$JAVACMD" ] ; then + if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD=`which java 2> /dev/null ` + if [ -z "$JAVACMD" ] ; then + JAVACMD=java + fi + fi +fi + +if [ ! -x "$JAVACMD" ] ; then + echo "Error: JAVA_HOME is not defined correctly." + echo " We cannot execute $JAVACMD" + exit 1 +fi + +if [ -n "$CLASSPATH" ] ; then + LOCALCLASSPATH=$CLASSPATH +fi + +# add fop.jar and fop-hyph.jar, which reside in $FOP_HOME/build +LOCALCLASSPATH=${FOP_HOME}/build/fop.jar:${FOP_HOME}/build/fop-hyph.jar:$LOCALCLASSPATH + +# add in the dependency .jar files, which reside in $FOP_HOME/lib +DIRLIBS=${FOP_HOME}/lib/*.jar +for i in ${DIRLIBS} +do + # if the directory is empty, then it will return the input string + # this is stupid, so case for it + if [ "$i" != "${DIRLIBS}" ] ; then + if [ -z "$LOCALCLASSPATH" ] ; then + LOCALCLASSPATH=$i + else + LOCALCLASSPATH="$i":$LOCALCLASSPATH + fi + fi +done + +# add in user-defined hyphenation JARs +if [ -n "$FOP_HYPHENATION_PATH" ] ; then + LOCALCLASSPATH=$LOCALCLASSPATH:$FOP_HYPHENATION_PATH +fi + +# For Cygwin, switch paths to appropriate format before running java +# For PATHs convert to unix format first, then to windows format to ensure +# both formats are supported. Probably this will fail on directories with ; +# in the name in the path. Let's assume that paths containing ; are more +# rare than windows style paths on cygwin. +if $cygwin; then + if [ "$OS" = "Windows_NT" ] && cygpath -m .>/dev/null 2>/dev/null ; then + format=mixed + else + format=windows + fi + FOP_HOME=`cygpath --$format "$FOP_HOME"` + LCP_TEMP=`cygpath --path --unix "$LOCALCLASSPATH"` + LOCALCLASSPATH=`cygpath --path --$format "$LCP_TEMP"` + if [ -n "$CLASSPATH" ] ; then + CP_TEMP=`cygpath --path --unix "$CLASSPATH"` + CLASSPATH=`cygpath --path --$format "$CP_TEMP"` + fi + CYGHOME=`cygpath --$format "$HOME"` +fi + +# Show script help if requested +if $show_help ; then + fop_exec_args="" + echo $0 '[script options] [FOP options]' + echo 'Script Options:' + echo ' --help, -h print this message and FOP help' + echo ' --noconfig suppress sourcing of /etc/fop.conf,' + echo ' $HOME/.fop/fop.conf, and $HOME/.foprc' + echo ' configuration files' + echo ' --execdebug print FOP exec line generated by this' + echo ' launch script' +fi + +# add a second backslash to variables terminated by a backslash under cygwin +if $cygwin; then + case "$FOP_HOME" in + *\\ ) + FOP_HOME="$FOP_HOME\\" + ;; + esac + case "$CYGHOME" in + *\\ ) + CYGHOME="$CYGHOME\\" + ;; + esac + case "$LOCALCLASSPATH" in + *\\ ) + LOCALCLASSPATH="$LOCALCLASSPATH\\" + ;; + esac + case "$CLASSPATH" in + *\\ ) + CLASSPATH="$CLASSPATH\\" + ;; + esac +fi + +LOGCHOICE= +# The default commons logger for JDK1.4 is JDK1.4Logger. +# To use a different logger, uncomment the one desired below +# LOGCHOICE=-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.NoOpLog +# LOGCHOICE=-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog +# LOGCHOICE=-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger + +LOGLEVEL= +# Logging levels +# Below option is only if you are using SimpleLog instead of the default JDK1.4 Logger. +# To set logging levels for JDK 1.4 Logger, edit the %JAVA_HOME%/JRE/LIB/logging.properties +# file instead. +# Possible SimpleLog values: "trace", "debug", "info" (default), "warn", "error", or "fatal". +# LOGLEVEL=-Dorg.apache.commons.logging.simplelog.defaultlog=INFO + +# Execute FOP using eval/exec to preserve spaces in paths, +# java options, and FOP args +fop_exec_command="exec \"$JAVACMD\" $LOGCHOICE $LOGLEVEL -classpath \"$LOCALCLASSPATH\" $FOP_OPTS org.apache.fop.cli.Main $fop_exec_args" +if $fop_exec_debug ; then + echo $fop_exec_command +fi +eval $fop_exec_command diff --git a/fop.sh b/fop.sh deleted file mode 100755 index 38dbf7105..000000000 --- a/fop.sh +++ /dev/null @@ -1,126 +0,0 @@ -#! /bin/sh -# -# Shell script to run FOP, adapted from the Jakarta-Ant project. - -if [ -f $HOME/.foprc ] ; then - . $HOME/.foprc -fi - -# OS specific support. $var _must_ be set to either true or false. -cygwin=false; -darwin=false; -case "`uname`" in - CYGWIN*) cygwin=true ;; - Darwin*) darwin=true ;; -esac - -if [ -z "$FOP_HOME" ] ; then - # try to find FOP - if [ -d /opt/fop ] ; then - FOP_HOME=/opt/fop - fi - - if [ -d ${HOME}/opt/fop ] ; then - FOP_HOME=${HOME}/opt/fop - fi - - ## resolve links - $0 may be a link to fop's home - PRG=$0 - progname=`basename $0` - - while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '.*/.*' > /dev/null; then - PRG="$link" - else - PRG="`dirname $PRG`/$link" - fi - done - - FOP_HOME=`dirname "$PRG"` - -fi - -# For Cygwin, ensure paths are in UNIX format before anything is touched -if $cygwin ; then - [ -n "$FOP_HOME" ] && - FOP_HOME=`cygpath --unix "$FOP_HOME"` - [ -n "$FOP_HYPHENATION_PATH" ] && - FOP_HYPHENATION_PATH=`cygpath --unix "$FOP_HYPHENATION_PATH"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --unix "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --unix "$CLASSPATH"` -fi - -if [ -z "$JAVACMD" ] ; then - if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD=$JAVA_HOME/jre/sh/java - else - JAVACMD=$JAVA_HOME/bin/java - fi - else - JAVACMD=java - fi -fi - -if [ ! -x "$JAVACMD" ] ; then - echo "Error: JAVA_HOME is not defined correctly." - echo " We cannot execute $JAVACMD" - exit -fi - -if [ -n "$CLASSPATH" ] ; then - LOCALCLASSPATH=$CLASSPATH -fi - -# add fop.jar and fop-hyph.jar, which reside in $FOP_HOME/build -LOCALCLASSPATH=${FOP_HOME}/build/fop.jar:${FOP_HOME}/build/fop-hyph.jar:$LOCALCLASSPATH - -# add in the dependency .jar files, which reside in $FOP_HOME/lib -DIRLIBS=${FOP_HOME}/lib/*.jar -for i in ${DIRLIBS} -do - # if the directory is empty, then it will return the input string - # this is stupid, so case for it - if [ "$i" != "${DIRLIBS}" ] ; then - if [ -z "$LOCALCLASSPATH" ] ; then - LOCALCLASSPATH=$i - else - LOCALCLASSPATH="$i":$LOCALCLASSPATH - fi - fi -done - -# add in user-defined hyphenation JARs -if [ -n "$FOP_HYPHENATION_PATH" ] ; then - LOCALCLASSPATH=$LOCALCLASSPATH:$FOP_HYPHENATION_PATH -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin; then - FOP_HOME=`cygpath --path --windows "$FOP_HOME"` - JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` - LOCALCLASSPATH=`cygpath --path --windows "$LOCALCLASSPATH"` -fi - -LOGCHOICE= -# The default commons logger for JDK1.4 is JDK1.4Logger. -# To use a different logger, uncomment the one desired below -# LOGCHOICE=-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.NoOpLog -# LOGCHOICE=-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog -# LOGCHOICE=-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger - -LOGLEVEL= -# Logging levels -# Below option is only if you are using SimpleLog instead of the default JDK1.4 Logger. -# To set logging levels for JDK 1.4 Logger, edit the %JAVA_HOME%/JRE/LIB/logging.properties -# file instead. -# Possible SimpleLog values: "trace", "debug", "info" (default), "warn", "error", or "fatal". -# LOGLEVEL=-Dorg.apache.commons.logging.simplelog.defaultlog=INFO - -$JAVACMD $LOGCHOICE $LOGLEVEL -classpath "$LOCALCLASSPATH" $FOP_OPTS org.apache.fop.cli.Main "$@" - diff --git a/src/documentation/content/xdocs/trunk/compiling.xml b/src/documentation/content/xdocs/trunk/compiling.xml index 7de1278a8..ad02f3046 100644 --- a/src/documentation/content/xdocs/trunk/compiling.xml +++ b/src/documentation/content/xdocs/trunk/compiling.xml @@ -50,14 +50,14 @@ There is generally no need to setup a classpath. All libraries needed to compile FOP are included in the source distribution and are referenced by the build script. You will only need to adjust the classpath if you build FOP in some other way. See the build - scripts (build.bat for Windows, and build.sh for Unix) for details. + script build.xml for details. </p> </section> <section id="env-java-home"> <title>JAVA_HOME</title> <p> The build script uses <a href="ext:ant">Apache Ant</a>, a popular - Java-based build tool, which requires that the environment variable JAVA_HOME point to + Java-based build tool, which usually requires that the environment variable JAVA_HOME point to your local JDK root directory. This is true even if you use JDK 1.2 or above, which normally does not need this setting. </p> @@ -74,13 +74,11 @@ <section id="build-script"> <title>Run the Build Script</title> <p> - Build FOP by executing the build script (build.xml), which is located in the FOP root directory. - On Windows run "ant.bat", and on Unix run "ant.sh". - The examples below are for running the shell script, but except for the build file extension, - the syntax is identical. + Change to the FOP root directory and build FOP by executing the build script (build.xml) + using the "ant" command. </p> <note> - The "ant.bat" and "ant.sh" are only available on your system if you've properly + The "ant" command is only available on your system if you've properly <a href="ext:ant/manual/">installed Apache Ant</a> and added Ant's location to the PATH environment variable. </note> @@ -91,7 +89,7 @@ You may benefit from looking through this file to learn more about the various build targets. To obtain a complete list of useful build targets: </p> - <source>ant.sh -projecthelp</source> + <source>ant -projecthelp</source> <p>The most useful targets are:</p> <ul> <li> @@ -108,13 +106,13 @@ </li> </ul> <p>To run the build:</p> - <source>ant.sh [target ...]</source> + <source>ant [target ...]</source> <p>For example to do a normal build for the "all" target (which is the default):</p> - <source>ant.sh</source> + <source>ant</source> <p>OR</p> - <source>ant.sh all</source> + <source>ant all</source> <p>To clean the build directory first:</p> - <source>ant.sh clean all</source> + <source>ant clean all</source> <note> If you want to shorten the build time you can just call the "package" target which doesn't perform any automated tests during the build. diff --git a/src/documentation/content/xdocs/trunk/running.xml b/src/documentation/content/xdocs/trunk/running.xml index fdf7aacab..d91cde11b 100644 --- a/src/documentation/content/xdocs/trunk/running.xml +++ b/src/documentation/content/xdocs/trunk/running.xml @@ -90,7 +90,7 @@ <title>Starting FOP as a Standalone Application</title> <p> The usual and recommended practice for starting FOP from the command line is to run the - batch file fop.bat (Windows) or the shell script fop.sh (Unix/Linux). + batch file fop.bat (Windows) or the shell script fop (Unix/Linux). If you write your own scripts, be sure to review these standard scripts to make sure that you get your environment properly configured. </p> |