[fedora-java] New aot-compile syntax?

Gary Benson gbenson at redhat.com
Fri Apr 22 15:56:15 UTC 2005


While I've been nativifying various bits of the Tomcat stack I've kept
finding myself with bits of specfile like:

  for jar in %{name} %{name}-launcher; do
      aot-compile build/lib/$jar.jar build/lib/lib$jar.jar.so
  done

The attached patch changes aot-compile's syntax to allow that bit f
spec to be rewritten as:

 aot-compile build/lib/%{name}.jar build/lib/%{name}-launcher.jar

With the attached patch you can pass build options to gcc by putting
them before the jars on the command line:

 aot-compile -march=i386 -mtune=pentium4 build/lib/%{name}.jar

or (more likely):
 
 aot-compile $RPM_OPTS build/lib/%{name}.jar

Anyone see any problems?

Cheers,
Gary

[ gbenson at redhat.com ][ I am Red Hat ][ http://inauspicious.org/ ]
-------------- next part --------------
Index: aot-compile.in
===================================================================
RCS file: /cvs/rhug/java-gcj-compat/aot-compile.in,v
retrieving revision 1.1
diff -u -r1.1 aot-compile.in
--- aot-compile.in	14 Apr 2005 22:12:54 -0000	1.1
+++ aot-compile.in	22 Apr 2005 15:34:44 -0000
@@ -4,12 +4,21 @@
 : ${1?"
 aot-compile:  Natively-compile a given JAR
 
-  Usage: $0 SRC_JARFILE DEST_SO_NAME BUILD_OPTIONS
-    SRC_JARFILE - the jar file we want to process
-    DEST_SO_NAME - the destination name of the .so of the compiled JAR
+  Usage: $0 [BUILD_OPTIONS] JARS
+    JARS - jar files we want to process
     BUILD_OPTIONS - a list of gcj options
       (outside of -findirect-dispatch -shared -Wl,-Bsymbolic)
 "}
 
- at GCJ_BIN_DIR@/gcj at gcc_suffix@ $3 -findirect-dispatch \
-  -shared -Wl,-Bsymbolic -o $2 $1
+unset opts
+while [ ! -z "$1" ]; do
+    (echo -- "$1" | grep -q '\.jar$') && break
+    opts="$opts${opts:+ }$1"
+    shift
+done
+while  [ ! -z "$1" ]; do
+    @GCJ_BIN_DIR@/gcj at gcc_suffix@ \
+        $opts -findirect-dispatch -shared -Wl,-Bsymbolic \
+        -o `dirname $1`/lib`basename $1`.so $1
+    shift
+done


More information about the fedora-devel-java-list mailing list