2006-08-17 [mones] 2.4.0cvs55
[claws.git] / manual / xml2pdf
index ec6c845bca29917b171e2f1abe28777a9265c67e..be4218f95558865db5aec75012f4ee3cf02aebfe 100644 (file)
@@ -10,6 +10,35 @@ then
        exit 1
 fi
 
+test -z "$JAVA" && \
+       JAVA=`which java`
+test -z "$JAVA" && \
+       JAVA="$JAVA_HOME/bin/java"
+if [ ! -x "$JAVA" ]
+then
+       echo 'error: java not found in your $PATH or in $JAVA_HOME/bin'
+       exit 1
+fi
+
+test -z "$SAXON" && \
+       SAXON=`which saxon`
+if [ -z "$SAXON" ]
+then
+       test -z "$SAXONJAR" && \
+               SAXONJAR='/usr/share/java/saxon.jar'
+       if [ ! -f "$SAXONJAR" ]
+       then
+               SAXONJAR='/usr/local/share/java/saxon.jar'
+               if [ ! -f "$SAXONJAR" ]
+               then
+                       echo "error: neither saxon nor saxon.jar were found"
+                       exit 1
+               fi
+       fi
+       SAXON="$JAVA -jar $SAXONJAR"
+fi
+
+
 if [ -n "$XML_CATALOG_FILES" ]
 then
        CATALOG_FILES=$XML_CATALOG_FILES
@@ -19,6 +48,9 @@ else
 fi
 KEY="http://docbook.sourceforge.net/release/xsl/current"
 
+# manual base name
+SCM=sylpheed-claws-manual
+
 for CATALOG in $CATALOG_FILES
 do
        if [ -s "$CATALOG" ]
@@ -38,9 +70,10 @@ do
                if [ -n "$DOCBOOKXSLPATH" ]
                then
                        echo "docbook-xsl path found: $DOCBOOKXSLPATH"
-                       sed "s|@DOCBOOK_XSL_PATH@|$DOCBOOKXSLPATH|g" "$1" > sylpheed-claws-manual.xsl && \
-                               saxon -o sylpheed-claws-manual.fo "$2" sylpheed-claws-manual.xsl && \
-                               fop -fo sylpheed-claws-manual.fo -pdf sylpheed-claws-manual.pdf
+                       sed "s|@DOCBOOK_XSL_PATH@|$DOCBOOKXSLPATH|g" "$1" \
+                           > ${SCM}.xsl && \
+                               $SAXON -o ${SCM}.fo "$2" ${SCM}.xsl && \
+                               fop -fo ${SCM}.fo -pdf ${SCM}.pdf
                        exit $?
                fi
        fi