hello there,

following my previous patch re. the above, here is a more serious, and 
working version --tested with jamvm:

* a jarsigner.sh.in template is used by...

* configure.ac to generate a jarsigner.sh.  this is a plain shell script 
that (a) attempts to locate a suitable java executable and launches it 
with the correct options to invoke the jarsigner main class.

* the Makefile, generated from the Makefile.am in the tools folder will 
copy+customize the jarsigner.sh into ${bindir}/jarsigner.

as Michael Koch suggested, no BASH is looked up, instead the shell 
template has the /bin/sh hard-wired.  the search for a JAVA executable 
is nevertheless done in the script instead of configure.ac.


comments are welcome.


the ChangeLog entry will look like so:

2006-03-28  Raif S. Naffah  <[EMAIL PROTECTED]>

        * configure.ac: Generate tools/jarsigner.sh from tools/jarsigner.sh.in
        * tools/gnu/classpath/tools/jarsigner.sh.in: New file
        * tools/Makefile.am: Generate jarsigner in $(bindir)


cheers;
rsn
Index: jarsigner.sh.in
===================================================================
RCS file: jarsigner.sh.in
diff -N jarsigner.sh.in
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ jarsigner.sh.in	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,63 @@
+#!/bin/sh
+
+## Copyright 2006 Free Software Foundation, Inc.
+##
+## This file is a part of GNU Classpath.
+##
+## GNU Classpath is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2 of the License, or (at
+## your option) any later version.
+##
+## GNU Classpath is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with GNU Classpath; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
+## USA
+##
+## Linking this library statically or dynamically with other modules is
+## making a combined work based on this library.  Thus, the terms and
+## conditions of the GNU General Public License cover the whole
+## combination.
+##
+## As a special exception, the copyright holders of this library give you
+## permission to link this library with independent modules to produce an
+## executable, regardless of the license terms of these independent
+## modules, and to copy and distribute the resulting executable under
+## terms of your choice, provided that you also meet, for each linked
+## independent module, the terms and conditions of the license of that
+## module.  An independent module is a module which is not derived from
+## or based on this library.  If you modify this library, you may extend
+## this exception to your version of the library, but you are not
+## obligated to do so.  If you do not wish to do so, delete this
+## exception statement from your version.
+##
+##
+## A simple script to launch the GNU Classpath jarsigner tool.
+##
+
[EMAIL PROTECTED]@
[EMAIL PROTECTED]@/@PACKAGE@
+tools_cp=${tools_dir}/tools.zip
+
+# find the java executable...
+if [ -z "${JAVA}" ] ; then
+  if [ -n "${JAVA_HOME}"  ] ; then
+    if [ -x "${JAVA_HOME}/jre/sh/java" ] ; then
+      JAVA="${JAVA_HOME}/jre/sh/java"
+    else
+      JAVA="${JAVA_HOME}/bin/java"
+    fi
+  else
+    JAVA=`which java 2> /dev/null `
+    if [ -z "${JAVA}" ] ; then
+        JAVA=java
+    fi
+  fi
+fi
+
+exec "${JAVA}" -cp "${tools_cp}" gnu.classpath.tools.jarsigner.Main $@
Index: Makefile.am
===================================================================
RCS file: /cvsroot/classpath/classpath/tools/Makefile.am,v
retrieving revision 1.7
diff -u -r1.7 Makefile.am
--- Makefile.am	10 Mar 2006 01:49:42 -0000	1.7
+++ Makefile.am	27 Mar 2006 13:39:50 -0000
@@ -19,6 +19,15 @@
 endif
 endif

+bin_SCRIPTS = jarsigner
+CLEANFILES = $(bin_SCRIPTS)
+EXTRA_DIST = jarsigner.sh.in
+
+jarsigner: $(srcdir)/jarsigner.sh
+	rm -f $(bindir)/jarsigner
+	cat $(srcdir)/jarsigner.sh > $(bindir)/jarsigner
+	chmod ugo+x $(bindir)/jarsigner
+
 # All our example java source files
 TOOLS_JAVA_FILES = $(srcdir)/gnu/classpath/tools/*.java $(srcdir)/gnu/classpath/tools/*/*.java $(srcdir)/gnu/classpath/tools/*/*/*.java

@@ -30,7 +39,7 @@
 BUILT_SOURCES = $(TOOLS_ZIP)

 # The templates that must be included into the generated zip file.
-GRMIC_TEMPLATES = $(srcdir)/gnu/classpath/tools/giop/grmic/templates/*.jav
+GRMIC_TEMPLATES = $(srcdir)/gnu/classpath/tools/giop/grmic/templates/*.jav
 RMIC_TEMPLATES = $(srcdir)/gnu/classpath/tools/rmi/rmic/templates/*.jav

 TOOLS_TEMPLATES = $(GRMIC_TEMPLATES) $(RMIC_TEMPLATES)
@@ -38,8 +47,9 @@
 # This covers the built-in help texts, both for giop and rmic subpackages.
 GIOP_HELPS = $(srcdir)/gnu/classpath/tools/giop/*.txt
 RMI_HELPS = $(srcdir)/gnu/classpath/tools/rmi/*.txt
+SECURITY_HELPS = $(srcdir)/gnu/classpath/tools/jarsigner/*.txt

-TOOLS_HELPS = $(GIOP_HELPS) $(RMI_HELPS)
+TOOLS_HELPS = $(GIOP_HELPS) $(RMI_HELPS) $(SECURITY_HELPS)

 # The tool specific README files.
 READMES = $(srcdir)/gnu/classpath/tools/giop/README
@@ -74,11 +84,13 @@
 $(TOOLS_ZIP): $(TOOLS_JAVA_FILES)
 	mkdir -p classes/gnu/classpath/tools/giop/grmic/templates
 	mkdir -p classes/gnu/classpath/tools/rmi/rmic/templates
+	mkdir -p classes/gnu/classpath/tools/jarsigner
 	cp $(RMIC_TEMPLATES) classes/gnu/classpath/tools/rmi/rmic/templates
-	cp $(GRMIC_TEMPLATES) classes/gnu/classpath/tools/giop/grmic/templates
+	cp $(GRMIC_TEMPLATES) classes/gnu/classpath/tools/giop/grmic/templates
 	cp $(RMI_HELPS) classes/gnu/classpath/tools/rmi/
 	cp $(GIOP_HELPS) classes/gnu/classpath/tools/giop/
-	$(JCOMPILER) -d classes $(TOOLS_JAVA_FILES)
+	cp $(SECURITY_HELPS) classes/gnu/classpath/tools/jarsigner/
+	$(JCOMPILER) -d classes $(TOOLS_JAVA_FILES)
 	(cd classes; \
 	if test "$(ZIP)" != ""; then $(ZIP) -r ../$(TOOLS_ZIP) .; fi; \
 	if test "$(FASTJAR)" != ""; then $(FASTJAR) cf ../$(TOOLS_ZIP) .; fi; \
Index: configure.ac
===================================================================
RCS file: /cvsroot/classpath/classpath/configure.ac,v
retrieving revision 1.139
diff -u -r1.139 configure.ac
--- configure.ac	10 Mar 2006 01:36:10 -0000	1.139
+++ configure.ac	27 Mar 2006 13:40:38 -0000
@@ -621,6 +621,7 @@
 lib/gen-classlist.sh
 lib/copy-vmresources.sh
 tools/Makefile
+tools/jarsigner.sh
 examples/Makefile
 examples/Makefile.jawt])
 AC_CONFIG_COMMANDS([gen-classlist],[chmod 755 lib/gen-classlist.sh])

Attachment: pgpj4BK3wANcD.pgp
Description: PGP signature

Reply via email to