[pkg-java] r5267 - in trunk/batik/debian: . manpages

fourmond at alioth.debian.org fourmond at alioth.debian.org
Wed Jan 2 21:04:14 UTC 2008


Author: fourmond
Date: 2008-01-02 21:04:14 +0000 (Wed, 02 Jan 2008)
New Revision: 5267

Added:
   trunk/batik/debian/NEWS
   trunk/batik/debian/libbatik-java.install
   trunk/batik/debian/manpages/
   trunk/batik/debian/manpages/rasterizer.1
   trunk/batik/debian/manpages/squiggle.1
   trunk/batik/debian/manpages/svgpp.1
   trunk/batik/debian/manpages/ttf2svg.1
   trunk/batik/debian/wrappers.sh
Modified:
   trunk/batik/debian/changelog
   trunk/batik/debian/control
   trunk/batik/debian/libbatik-java.dirs
   trunk/batik/debian/rasterizer.sh
   trunk/batik/debian/rules
   trunk/batik/debian/squiggle.sh
   trunk/batik/debian/svgpp.sh
   trunk/batik/debian/ttf2svg.sh
Log:
[batik] Putting batik back into shape again

Added: trunk/batik/debian/NEWS
===================================================================
--- trunk/batik/debian/NEWS	                        (rev 0)
+++ trunk/batik/debian/NEWS	2008-01-02 21:04:14 UTC (rev 5267)
@@ -0,0 +1,8 @@
+batik (1.6-4) unstable; urgency=low
+
+  rasterizer now launches by default with -scriptSecurityOff, as it fails 
+  to run most of the times if that is not the case. Beware when running
+  rasterizer over untrusted sources. See rasterizer(1) for details
+  
+
+ -- Vincent Fourmond <fourmond at debian.org>  Wed, 02 Jan 2008 21:43:47 +0100

Modified: trunk/batik/debian/changelog
===================================================================
--- trunk/batik/debian/changelog	2008-01-02 13:39:32 UTC (rev 5266)
+++ trunk/batik/debian/changelog	2008-01-02 21:04:14 UTC (rev 5267)
@@ -1,9 +1,20 @@
 batik (1.6-4) UNRELEASED; urgency=low
 
-  * debian/watch: added. 
+  [ Mark Howard ]
+  * debian/watch: added.
 
- -- Mark Howard <mh at debian.org>  Sat, 29 Dec 2007 09:25:06 +0000
+  [ Vincent Fourmond ]
+  * Created a /usr/lib/java/wrappers.sh for the various programs
+    provided by libbatik-java, to make them work in more various
+    environments.
+  * Manual pages for svgpp, rasterizer, squiggle and ttf2svg
+    (Closes: #458021)
+  * rasterizer now launches by default with -scriptSecurityOff so it
+    works again (Closes: #413103). Added an option to turn security back on.
+  * Comply with policy 3.7.3
 
+ -- Vincent Fourmond <fourmond at debian.org>  Wed, 02 Jan 2008 22:03:24 +0100
+
 batik (1.6-3) unstable; urgency=low
 
   * Add wrapper scripts (rasterizer.sh squiggle.sh svgpp.sh ttf2svg.sh)

Modified: trunk/batik/debian/control
===================================================================
--- trunk/batik/debian/control	2008-01-02 13:39:32 UTC (rev 5266)
+++ trunk/batik/debian/control	2008-01-02 21:04:14 UTC (rev 5267)
@@ -2,8 +2,9 @@
 Section: contrib/libs
 Priority: optional
 Maintainer: Debian Java Maintainers <pkg-java-maintainers at lists.alioth.debian.org>
-Uploaders: Arnaud Vandyck <avdyk at debian.org>, Wolfgang Baer <WBaer at gmx.de>, Michael Koch <konqueror at gmx.de>
-Standards-Version: 3.7.2
+Uploaders: Arnaud Vandyck <avdyk at debian.org>, Wolfgang Baer <WBaer at gmx.de>, Michael Koch <konqueror at gmx.de>, 
+ Vincent Fourmond <fourmond at debian.org>
+Standards-Version: 3.7.3
 Build-Depends: debhelper (>= 4.2.30), cdbs
 Build-Depends-Indep: j2sdk1.4 | java2-compiler, ant, libbsf-java, libxalan2-java, rhino, libavalon-framework-java (>= 4.2.0-1), libcommons-io-java, libcommons-logging-java
 

Modified: trunk/batik/debian/libbatik-java.dirs
===================================================================
--- trunk/batik/debian/libbatik-java.dirs	2008-01-02 13:39:32 UTC (rev 5266)
+++ trunk/batik/debian/libbatik-java.dirs	2008-01-02 21:04:14 UTC (rev 5267)
@@ -1 +1,2 @@
 usr/share/java
+usr/lib/java

Added: trunk/batik/debian/libbatik-java.install
===================================================================
--- trunk/batik/debian/libbatik-java.install	                        (rev 0)
+++ trunk/batik/debian/libbatik-java.install	2008-01-02 21:04:14 UTC (rev 5267)
@@ -0,0 +1 @@
+debian/wrappers.sh usr/lib/java/
\ No newline at end of file

Added: trunk/batik/debian/manpages/rasterizer.1
===================================================================
--- trunk/batik/debian/manpages/rasterizer.1	                        (rev 0)
+++ trunk/batik/debian/manpages/rasterizer.1	2008-01-02 21:04:14 UTC (rev 5267)
@@ -0,0 +1,263 @@
+.\" Man page for rasterizer, based on the output of help2man
+.\"
+.\" Copyright 2007 by Vincent Fourmond
+.\"
+.\" You may distribute, copy and modify this manual page under the same
+.\" terms as batik itself.
+.\"
+
+.TH RASTERIZER "1" "January 2008" "SVG conversion" "User Commands"
+.SH NAME
+rasterizer \- SVG conversion
+
+.SH SYNOPSIS
+
+.B rasterizer 
+.I [options] files
+
+.SH DESCRIPTION
+
+Rasterizer is a program to convert SVG files to various formats,
+namely PNG, JPEG and PDF.
+
+.SH OPTIONS
+.TP
+\fB\-d\fR <dir|file>
+.IP
+output directory. If there is a single input file, this can be a file.
+.TP
+\fB\-m\fR <mimeType>
+.IP
+output mime type. Should be one of 
+.IR image/jpg ,\  image/jpeg ,\  image/jpe ,\  image/png ,
+.IR image/tiff \ or \ application/pdf .
+.TP
+\fB\-w\fR <width>
+.IP
+output width. This is a floating point value.
+.TP
+\fB\-h\fR <height>
+.IP
+output height. This is a floating point value.
+.TP
+\fB\-maxw\fR <width>
+.IP
+Maximum output width. This is a floating point value.
+.TP
+\fB\-maxh\fR <height>
+.IP
+Maximum output height. This is a floating point value.
+.TP
+\fB\-a\fR <area>
+.IP
+output area. The format for <area> is x,y,w,h, where x, y, w and h
+are floating point values.
+.TP
+\fB\-bg\fR <color>
+.IP
+ouput color. The format for <color> is a.r.g.b, where a, r, g and b
+are integer values.
+.TP
+\fB\-cssMedia\fR <media>
+.IP
+CSS media type for which the source SVG files should be
+converted.
+.TP
+\fB\-cssAlternate\fR <alternate>
+.IP
+CSS alternate stylesheet to use when converting the source
+SVG files.
+.TP
+\fB\-cssUser\fR <userStylesheet>
+.IP
+CSS user stylesheet URI to apply to converted SVG documents
+in addition to any other referened or embeded stylesheets.
+.TP
+\fB\-font\-family\fR <defaultFontFamily>
+.IP
+Value used as a default when no font\-family value
+is specified.
+.TP
+\fB\-lang\fR <userLanguage>
+.IP
+User language to use when converting SVG documents.
+.TP
+\fB\-q\fR <quality>
+.IP
+Quality for the output image. This is only relevant for the
+image/jpeg mime type.
+.TP
+\fB\-indexed\fR (1|2|4|8)
+.IP
+Reduces the image to given number of bits per pixel using an
+adaptive pallete, resulting in an Indexed image.  This is
+currently only supported for PNG conversion.
+.TP
+\fB\-dpi\fR <resolution>
+.IP
+Resolution for the ouptut image.
+.TP
+\fB\-validate\fR
+.IP
+Controls whether the source SVG files should be validated.
+.TP
+\fB\-onload\fR
+.IP
+Controls if the source SVG files must be rasterize after
+dispatching the 'onload' event.
+.TP
+\fB\-scriptSecurityOff\fR removes any security check on the scripts running
+.IP
+as a result of dispatching the onload event.
+.TP
+\fB\-anyScriptOrigin\fR controls whether scripts can be loaded from
+.IP
+any location. By default, scripts can only be loaded from
+.IP
+the same location as the document referencing them.
+.TP
+\fB\-scripts\fR <listOfAllowedScripts> List of script types (i.e.,
+.IP
+values for the type attribute in the <script> tag) which
+should be loaded.
+.TP
+\fB\-d\fR <dir|file>
+.IP
+output directory. If there is a single input file, this can be a file.
+.TP
+\fB\-m\fR <mimeType>
+.IP
+output mime type.
+.TP
+\fB\-w\fR <width>
+.IP
+output width. This is a floating point value.
+.TP
+\fB\-h\fR <height>
+.IP
+output height. This is a floating point value.
+.TP
+\fB\-maxw\fR <width>
+.IP
+Maximum output width. This is a floating point value.
+.TP
+\fB\-maxh\fR <height>
+.IP
+Maximum output height. This is a floating point value.
+.TP
+\fB\-a\fR <area>
+.IP
+output area. The format for <area> is x,y,w,h, where x, y, w and h
+are floating point values.
+.TP
+\fB\-bg\fR <color>
+.IP
+ouput color. The format for <color> is a.r.g.b, where a, r, g and b
+are integer values.
+.TP
+\fB\-cssMedia\fR <media>
+.IP
+CSS media type for which the source SVG files should be
+converted.
+.TP
+\fB\-cssAlternate\fR <alternate>
+.IP
+CSS alternate stylesheet to use when converting the source
+SVG files.
+.TP
+\fB\-cssUser\fR <userStylesheet>
+.IP
+CSS user stylesheet URI to apply to converted SVG documents
+in addition to any other referened or embeded stylesheets.
+.TP
+\fB\-font\-family\fR <defaultFontFamily>
+.IP
+Value used as a default when no font\-family value
+is specified.
+.TP
+\fB\-lang\fR <userLanguage>
+.IP
+User language to use when converting SVG documents.
+.TP
+\fB\-q\fR <quality>
+.IP
+Quality for the output image. This is only relevant for the
+image/jpeg mime type.
+.TP
+\fB\-indexed\fR (1|2|4|8)
+.IP
+Reduces the image to given number of bits per pixel using an
+adaptive pallete, resulting in an Indexed image.  This is
+currently only supported for PNG conversion.
+.TP
+\fB\-dpi\fR <resolution>
+.IP
+Resolution for the ouptut image.
+.TP
+\fB\-validate\fR
+.IP
+Controls whether the source SVG files should be validated.
+.TP
+\fB\-onload\fR
+.IP
+Controls if the source SVG files must be rasterize after
+dispatching the 'onload' event.
+.TP
+.B \-scriptSecurityOff
+removes any security check on the scripts running
+as a result of dispatching the onload event. Always enabled, as in
+most cases, 
+.B rasterizer
+just fails to run without this option. See
+.I \-scriptSecurityOn
+
+.TP
+.B \-scriptSecurityOn
+If this is the 
+.I first
+argument on the command-line, turn security back on. You'll most
+likely be hit by the possible bug mentioned below.
+
+.TP
+.B \-anyScriptOrigin
+controls whether scripts can be loaded from
+any location. By default, scripts can only be loaded from
+the same location as the document referencing them.
+.TP
+.B \-scripts\fR <listOfAllowedScripts> 
+List of script types (i.e.,
+values for the type attribute in the <script> tag) which
+should be loaded.
+
+.SH BUGS
+
+If 
+.B rasterizer 
+fails with an error in the spirit of:
+
+Exception in thread "main" java.security.AccessControlException: access denied (java.util.PropertyPermission java.security.policy write)
+        at java.security.AccessControlContext.checkPermission(AccessControlContext.java:323)
+        at java.security.AccessController.checkPermission(AccessController.java:546)
+        at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
+        at java.lang.System.setProperty(System.java:727)
+
+Run it with the
+.I -scriptSecurityOff
+option on. It seems in some cases the security design is slighlty too
+strong. This might become the default some day.
+
+.SH AUTHORS 
+
+.B rasterizer 
+is part of 
+.BR batik ,
+written by the Apache Software Foundation.
+
+This manual page was written by Vincent Fourmond <fourmond at debian.org>
+for the Debian Project, but may be used by others.
+
+.SH SEE ALSO
+
+The web page of 
+.BR batik ,
+http://xml.apache.org/batik

Added: trunk/batik/debian/manpages/squiggle.1
===================================================================
--- trunk/batik/debian/manpages/squiggle.1	                        (rev 0)
+++ trunk/batik/debian/manpages/squiggle.1	2008-01-02 21:04:14 UTC (rev 5267)
@@ -0,0 +1,39 @@
+.\" Man page for squiggle
+.\"
+.\" Copyright 2007 by Vincent Fourmond
+.\"
+.\" You may distribute, copy and modify this manual page under the same
+.\" terms as batik itself.
+.\"
+.TH SQUIGGLE "1" "January 2008" "Browser for SVG files" "User Commands"
+.SH NAME
+squiggle \- browser for SVG files
+
+.SH
+.B squiggle
+
+.SH DESCRIPTION
+
+.B squiggle
+is a graphical browser for SVG files.
+
+.SH BUGS
+
+.B squiggle
+is currently broken in debian. Startup will fail with a security error. 
+
+.SH AUTHORS 
+
+.B squiggle 
+is part of 
+.BR batik ,
+written by the Apache Software Foundation.
+
+This manual page was written by Vincent Fourmond <fourmond at debian.org>
+for the Debian Project, but may be used by others.
+
+.SH SEE ALSO
+
+The web page of 
+.BR batik ,
+http://xml.apache.org/batik

Added: trunk/batik/debian/manpages/svgpp.1
===================================================================
--- trunk/batik/debian/manpages/svgpp.1	                        (rev 0)
+++ trunk/batik/debian/manpages/svgpp.1	2008-01-02 21:04:14 UTC (rev 5267)
@@ -0,0 +1,72 @@
+.\" Man page for svgpp, based on the output of help2man
+.\"
+.\" Copyright 2007 by Vincent Fourmond
+.\"
+.\" You may distribute, copy and modify this manual page under the same
+.\" terms as batik itself.
+.\"
+.TH SVGPP "1" "January 2008" "Pretty printer for SVG" "User Commands"
+.SH NAME
+svgpp \- pretty-printer for SVG files
+
+.SH
+.B svgpp
+.I [options] <input file> [<output file>]
+
+.SH DESCRIPTION
+
+.B svgpp
+pretty-prints SVG code to standard output.
+
+
+.SH OPTIONS
+
+.TP
+\fB\-xml\-decl\fR <string>
+The value to set to the XML declaraction.
+
+.TP
+\fB\-system\-id\fR <string>
+
+The value to set to the system ID of the doctype.
+.TP
+\fB\-tab\-width\fR <number>
+
+Sets the tabulation width. The default is 4.
+
+.TP
+\fB\-doc\-width\fR <number>
+Sets the document preferred number of columns. The default is 80.
+
+.TP
+\fB\-no\-format\fR
+Disables any formatting. Useful for doctype modifications,
+newline conversion, ...
+
+.TP
+\fB\-public\-id\fR <string>
+The value to set to the public ID of the doctype.
+.TP
+\fB\-newline\fR (cr | cr\-lf | lf)
+Specifies the type of newline to output. Possible values are:
+cr (mac), cr\-lf (dos), lf (unix \- the default).
+.TP
+\fB\-doctype\fR (change | remove)
+Removes or changes the DOCTYPE declaration. change is used
+in conjonction with the \fB\-public\-id\fR and \fB\-system\-id\fR options.
+
+.SH AUTHORS 
+
+.B svgpp 
+is part of 
+.BR batik ,
+written by the Apache Software Foundation.
+
+This manual page was written by Vincent Fourmond <fourmond at debian.org>
+for the Debian Project, but may be used by others.
+
+.SH SEE ALSO
+
+The web page of 
+.BR batik ,
+http://xml.apache.org/batik

Added: trunk/batik/debian/manpages/ttf2svg.1
===================================================================
--- trunk/batik/debian/manpages/ttf2svg.1	                        (rev 0)
+++ trunk/batik/debian/manpages/ttf2svg.1	2008-01-02 21:04:14 UTC (rev 5267)
@@ -0,0 +1,66 @@
+.\" Man page for svgpp, based on the output of help2man
+.\"
+.\" Copyright 2007 by Vincent Fourmond
+.\"
+.\" You may distribute, copy and modify this manual page under the same
+.\" terms as batik itself.
+.\"
+.TH TTF2SVG "1" "January 2008" "Font converter for SVG" "User Commands"
+.SH NAME
+svgpp \- font converter for SVG
+
+.SH
+.B ttf2svg
+.I <ttf-path> [-l <range-begin>] [-h <range-end>] [-autorange] [-ascii] [-id <id>] [-o <output-path>] [-testcard]
+
+
+.SH DESCRIPTION
+
+Converts a true type font into a SVG font. 
+.I <ttf-path> 
+is the path of the font file to convert.
+
+.SH OPTIONS
+
+
+.TP
+.BI -l \ range-begin \ -h \ range-end
+specifies the range of characters (by codepoint, in decimal) to be
+converted,
+
+.TP
+.B -ascii
+forces usage of the ASCII character map in the font, instead of the
+Unicode character map, 
+
+.TP
+.BI -id \ id
+specifies the value for the id attribute of the generated font
+element,
+
+.TP
+.BI -o \ output-path
+specifies the pathname of the output SVG document containing the
+generated SVG font
+
+.TP
+.B -testcard
+specifies that a sequence of SVG text elements should be appended to
+the output SVG file to test the characters in the SVG font, providing
+an easy way to validate that generated SVG font visually. 
+
+.SH AUTHORS 
+
+.B ttf2svg
+is part of 
+.BR batik ,
+written by the Apache Software Foundation.
+
+This manual page was written by Vincent Fourmond <fourmond at debian.org>
+for the Debian Project, but may be used by others.
+
+.SH SEE ALSO
+
+The web page of 
+.BR batik ,
+http://xml.apache.org/batik

Modified: trunk/batik/debian/rasterizer.sh
===================================================================
--- trunk/batik/debian/rasterizer.sh	2008-01-02 13:39:32 UTC (rev 5266)
+++ trunk/batik/debian/rasterizer.sh	2008-01-02 21:04:14 UTC (rev 5267)
@@ -1,29 +1,19 @@
 #!/bin/sh
 
-# Use JAVACMD if it is set.  If not, check JAVA_HOME, and fall back to
-# 'java' if both are unset.
-find_java_runtime() {
-    if [ -z "$JAVACMD" ] && [ "$JAVA_HOME" ] ; then
-	JAVACMD="$JAVA_HOME/bin/java"
-    fi
-    [ "$JAVACMD" ] || JAVACMD=java
-    [ "$JAVA_ARGS" ] || JAVA_ARGS=
-}
+# Include the wrappers utility script
+. /usr/lib/java/wrappers.sh
 
-find_jars() {
-    JAVA_CLASSPATH=
-    for jar in $@ ; do
-	if [ -r $DESTDIR/usr/share/java/$jar ]; then
-	    JAVA_CLASSPATH=$JAVA_CLASSPATH:$DESTDIR/usr/share/java/$jar
-	else
-	    echo "error: Unable to locate $jar in $DESTDIR/usr/share/java/"
-	fi
-    done
-}
+# We need sun runtime.
+find_java_runtime sun
+find_jars xercesImpl.jar batik-all.jar fop-transcoder.jar 
+find_jars avalon-framework.jar commons-logging.jar commons-io.jar
 
-[ "$DESTDIR" ] || DESTDIR=
-find_java_runtime
-find_jars xercesImpl.jar batik-all.jar
+# We see if there is a -scriptSecurityOn in the commandline
+if [ "$1" != -scriptSecurityOn ]; then
+    extra_args="-scriptSecurityOff"
+else
+    shift
+    extra_args=""
+fi
 
-exec $JAVACMD $JAVA_ARGS -cp $JAVA_CLASSPATH \
-  org.apache.batik.apps.rasterizer.Main $@
+run_java org.apache.batik.apps.rasterizer.Main $extra_args "$@"

Modified: trunk/batik/debian/rules
===================================================================
--- trunk/batik/debian/rules	2008-01-02 13:39:32 UTC (rev 5266)
+++ trunk/batik/debian/rules	2008-01-02 21:04:14 UTC (rev 5267)
@@ -12,7 +12,7 @@
 include /usr/share/cdbs/1/class/ant.mk
 include /usr/share/cdbs/1/rules/simple-patchsys.mk
 
-JAVA_HOME_DIRS       := /usr/lib/j2sdk1.4-sun /usr/lib/j2sdk1.4-ibm /usr/lib/j2sdk1.4-blackdown /usr/local/IBMJava2-ppc-142
+JAVA_HOME_DIRS       := /usr/lib/j2sdk1.4-sun /usr/lib/j2sdk1.4-ibm /usr/lib/j2sdk1.4-blackdown /usr/local/IBMJava2-ppc-142  /usr/lib/jvm/java-6-sun/
 ANT_HOME             := /usr/share/ant
 DEB_JARS             := $(ANT_HOME)/lib/ant-launcher.jar bfs gnujaxp js xalan2 
 DEB_ANT_COMPILER     := modern

Modified: trunk/batik/debian/squiggle.sh
===================================================================
--- trunk/batik/debian/squiggle.sh	2008-01-02 13:39:32 UTC (rev 5266)
+++ trunk/batik/debian/squiggle.sh	2008-01-02 21:04:14 UTC (rev 5267)
@@ -1,29 +1,9 @@
 #!/bin/sh
 
-# Use JAVACMD if it is set.  If not, check JAVA_HOME, and fall back to
-# 'java' if both are unset.
-find_java_runtime() {
-    if [ -z "$JAVACMD" ] && [ "$JAVA_HOME" ] ; then
-	JAVACMD="$JAVA_HOME/bin/java"
-    fi
-    [ "$JAVACMD" ] || JAVACMD=java
-    [ "$JAVA_ARGS" ] || JAVA_ARGS=
-}
+# Include the wrappers utility script
+. /usr/lib/java/wrappers.sh
 
-find_jars() {
-    JAVA_CLASSPATH=
-    for jar in $@ ; do
-	if [ -r $DESTDIR/usr/share/java/$jar ]; then
-	    JAVA_CLASSPATH=$JAVA_CLASSPATH:$DESTDIR/usr/share/java/$jar
-	else
-	    echo "error: Unable to locate $jar in $DESTDIR/usr/share/java/"
-	fi
-    done
-}
-
-[ "$DESTDIR" ] || DESTDIR=
 find_java_runtime
 find_jars xercesImpl.jar batik-all.jar
 
-exec $JAVACMD $JAVA_ARGS -cp $JAVA_CLASSPATH \
-  org.apache.batik.apps.svgbrowser.Main $@
+run_java org.apache.batik.apps.svgbrowser.Main "$@"

Modified: trunk/batik/debian/svgpp.sh
===================================================================
--- trunk/batik/debian/svgpp.sh	2008-01-02 13:39:32 UTC (rev 5266)
+++ trunk/batik/debian/svgpp.sh	2008-01-02 21:04:14 UTC (rev 5267)
@@ -1,29 +1,9 @@
 #!/bin/sh
 
-# Use JAVACMD if it is set.  If not, check JAVA_HOME, and fall back to
-# 'java' if both are unset.
-find_java_runtime() {
-    if [ -z "$JAVACMD" ] && [ "$JAVA_HOME" ] ; then
-	JAVACMD="$JAVA_HOME/bin/java"
-    fi
-    [ "$JAVACMD" ] || JAVACMD=java
-    [ "$JAVA_ARGS" ] || JAVA_ARGS=
-}
+# Include the wrappers utility script
+. /usr/lib/java/wrappers.sh
 
-find_jars() {
-    JAVA_CLASSPATH=
-    for jar in $@ ; do
-	if [ -r $DESTDIR/usr/share/java/$jar ]; then
-	    JAVA_CLASSPATH=$JAVA_CLASSPATH:$DESTDIR/usr/share/java/$jar
-	else
-	    echo "error: Unable to locate $jar in $DESTDIR/usr/share/java/"
-	fi
-    done
-}
-
-[ "$DESTDIR" ] || DESTDIR=
 find_java_runtime
 find_jars xercesImpl.jar batik-all.jar
 
-exec $JAVACMD $JAVA_ARGS -cp $JAVA_CLASSPATH \
-  org.apache.batik.apps.svgpp.Main $@
+run_java org.apache.batik.apps.svgpp.Main "$@"

Modified: trunk/batik/debian/ttf2svg.sh
===================================================================
--- trunk/batik/debian/ttf2svg.sh	2008-01-02 13:39:32 UTC (rev 5266)
+++ trunk/batik/debian/ttf2svg.sh	2008-01-02 21:04:14 UTC (rev 5267)
@@ -1,29 +1,9 @@
 #!/bin/sh
 
-# Use JAVACMD if it is set.  If not, check JAVA_HOME, and fall back to
-# 'java' if both are unset.
-find_java_runtime() {
-    if [ -z "$JAVACMD" ] && [ "$JAVA_HOME" ] ; then
-	JAVACMD="$JAVA_HOME/bin/java"
-    fi
-    [ "$JAVACMD" ] || JAVACMD=java
-    [ "$JAVA_ARGS" ] || JAVA_ARGS=
-}
+# Include the wrappers utility script
+. /usr/lib/java/wrappers.sh
 
-find_jars() {
-    JAVA_CLASSPATH=
-    for jar in $@ ; do
-	if [ -r $DESTDIR/usr/share/java/$jar ]; then
-	    JAVA_CLASSPATH=$JAVA_CLASSPATH:$DESTDIR/usr/share/java/$jar
-	else
-	    echo "error: Unable to locate $jar in $DESTDIR/usr/share/java/"
-	fi
-    done
-}
-
-[ "$DESTDIR" ] || DESTDIR=
 find_java_runtime
 find_jars xercesImpl.jar batik-all.jar
 
-exec $JAVACMD $JAVA_ARGS -cp $JAVA_CLASSPATH \
-  org.apache.batik.apps.ttf2svg.Main $@
+run_java org.apache.batik.apps.ttf2svg.Main "$@"

Added: trunk/batik/debian/wrappers.sh
===================================================================
--- trunk/batik/debian/wrappers.sh	                        (rev 0)
+++ trunk/batik/debian/wrappers.sh	2008-01-02 21:04:14 UTC (rev 5267)
@@ -0,0 +1,107 @@
+# Functions for execution of Java wrapper scripts
+
+# Some initializations:
+[ "$DESTDIR" ] || DESTDIR=
+[ "$JAVA_CLASSPATH" ] || JAVA_CLASSPATH=
+
+
+# Use JAVACMD if it is set.  If not, check JAVA_HOME, and fall back to
+# 'java' if both are unset.
+
+java_show_debug() {
+    if [ "$DEBUG" ]; then
+	echo "[debug] $0: $@" >&2;
+    fi
+}
+
+
+# Try to find a Java runtime and set JAVA_HOME and JAVACMD accordingly.
+# If JAVACMD exists, nothing is done. If JAVA_HOME exists, only that
+# is searched.
+#
+# In the other cases, the runtime is looked for according to one of the
+# following arguments:
+#  * 2 : java runtime 2 
+#  * swing : a JVM that has swing
+#  * fullxml: a JVM that has all XML classes, including
+#    javax.xml.stream.util.StreamReaderDelegate
+#
+# If JAVA_DEBUG is set, we try to use jdb rather than java, if it is
+# present.
+#
+# This information is currently *far from complete* !!!
+find_java_runtime() {
+    # First, some variables
+    sun_java="/usr/lib/jvm/java-6-sun /usr/lib/jvm/java-1.5.0-sun /usr/lib/j2sdk1.4-sun " 
+    gcj2="/usr/lib/jvm/java-*-gcj-4.* "
+    icedtea="/usr/lib/jvm/java-7-icedtea"
+    if [ "$JAVACMD" ]; then
+	java_show_debug "Using already set JAVACMD = $JAVACMD"
+	return 0;		# Nothing to do
+    fi
+
+    if [ -z "$JAVA_HOME" ]; then
+        # We now try to look for a reasonable JAVA_HOME.
+        # First, narrow the choices, approximately according to what
+        # was asked
+	case $1 in
+	    2) DIRS="$icedtea $gcj2 $sun_java";
+		;;
+	    # So far, only Sun and IcedTea have swing...
+	    swing) DIRS="$icedtea $sun_java";
+		;;
+	    sun) DIRS="$sun_java" # To make sure only sun is found...
+		;;
+	    xml) DIRS="$icedtea /usr/lib/jvm/java-6-sun ";
+		;;
+	    *) DIRS=/usr/lib/jvm/*
+		DIRS="$DIRS /usr/lib/kaffe"
+		;;
+	esac
+        # And pick up the first one that works
+	for dir in $DIRS; do
+	    if [ -x $dir/bin/java ]; then
+		JAVA_HOME=$dir
+		break;
+	    fi
+	done
+    fi
+    if [ "$JAVA_HOME" ] ; then
+	if [ "$JAVA_DEBUG" ] && [ -x "$JAVA_HOME/bin/jdb" ]; then
+	    JAVACMD="$JAVA_HOME/bin/jdb"
+	else
+	    JAVACMD="$JAVA_HOME/bin/java"
+	fi
+	java_show_debug "Found JAVA_HOME = $JAVA_HOME"
+	java_show_debug "Found JAVACMD = $JAVACMD"
+	return 0		# Fine
+    else
+	echo "$0: no appropriate java environment found, aborting" >& 2
+	exit 1;
+    fi
+
+}
+
+# Find jars and add them to the classpath
+find_jars() {
+    for jar in $@ ; do
+	if [ -r $DESTDIR/usr/share/java/$jar ]; then
+	    JAVA_CLASSPATH=$JAVA_CLASSPATH:$DESTDIR/usr/share/java/$jar
+	elif [ -r $DESTDIR/usr/share/java/$jar.jar ]; then 
+	    JAVA_CLASSPATH=$JAVA_CLASSPATH:$DESTDIR/usr/share/java/$jar.jar
+	else
+	    echo "error: Unable to locate $jar in $DESTDIR/usr/share/java/" >&2
+	fi
+    done
+}
+
+# Runs the program !
+run_java() {
+    if [ "$JAVA_CLASSPATH" ]; then
+	cp="-cp $JAVA_CLASSPATH";
+    else
+	cp="";
+    fi
+    java_show_debug "Runnning $JAVACMD $JAVA_ARGS $cp $@"
+    exec $JAVACMD $JAVA_ARGS $cp "$@"
+}
\ No newline at end of file




More information about the pkg-java-commits mailing list