This is an automated email from the git hooks/post-receive script.

ebourg-guest pushed a commit to branch master
in repository ecj.

commit 4e69bc0d56cbcdf834f951134e31cd090e785bd2
Author: Matthias Klose <d...@debian.org>
Date:   Sat Jun 11 17:57:46 2005 +0000

    Import Debian changes 3.0.1-5
    
    ecj-bootstrap (3.0.1-5) unstable; urgency=low
    
      * Add a /usr/bin/ecj binary.
---
 com/sun/tools/javac/Config.java |  50 +++++++++++
 com/sun/tools/javac/Main.java   | 191 ++++++++++++++++++++++++++++++++++++++++
 debian/changelog                |   6 ++
 debian/copyright                |  47 +++++++++-
 debian/ecj-bootstrap.dirs       |   2 -
 debian/ecj-bootstrap.install    |   2 -
 debian/ecj-bootstrap.postinst   |   7 ++
 debian/ecj-bootstrap.prerm      |   5 ++
 debian/rules                    |  17 +++-
 ecj-bootstrap                   |  18 ++++
 10 files changed, 339 insertions(+), 6 deletions(-)

diff --git a/com/sun/tools/javac/Config.java b/com/sun/tools/javac/Config.java
new file mode 100644
index 0000000..1f76f4e
--- /dev/null
+++ b/com/sun/tools/javac/Config.java
@@ -0,0 +1,50 @@
+/* Config.java.in -- configuration values for tools.jar
+   Copyright (C) 2004  Red Hat
+
+This file is part of java-gcj-compat.
+
+java-gcj-compat 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, or (at your option)
+any later version.
+
+java-gcj-compat 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 java-gcj-compat; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 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. */
+
+package com.sun.tools.javac;
+
+/*
+ * This class makes values calculated by configure available to the
+ * tools.jar implementation.
+ */
+public interface Config
+{
+  /**
+   * The directory where required jars are installed.
+   */
+  String JAR_INST_DIR = "/usr/share/java";
+}
diff --git a/com/sun/tools/javac/Main.java b/com/sun/tools/javac/Main.java
new file mode 100644
index 0000000..ea0af57
--- /dev/null
+++ b/com/sun/tools/javac/Main.java
@@ -0,0 +1,191 @@
+/* Main.java -- implement com.sun.tools.javac.Main
+   Copyright (C) 2004  Red Hat
+
+This file is part of java-gcj-compat.
+
+java-gcj-compat 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, or (at your option)
+any later version.
+
+java-gcj-compat 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 java-gcj-compat; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 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. */
+
+package com.sun.tools.javac;
+
+import java.io.*;
+import java.net.*;
+import java.lang.reflect.*;
+
+public class Main
+{
+  Constructor ecjConstructor = null;
+  Method ecjMethod = null;
+
+  public Main () throws Exception
+  {
+    String classname = "org.eclipse.jdt.internal.compiler.batch.Main";
+    Class klass = null;
+    try
+      {
+       klass = Class.forName (classname);
+      }
+    catch (ClassNotFoundException e)
+      {
+       File jar = new File (Config.JAR_INST_DIR + "/jdtcore.jar");
+       if (!jar.exists () || !jar.canRead ())
+         throw e;
+
+       ClassLoader loader = new URLClassLoader(new URL[] {jar.toURL ()});
+       try
+         {
+           klass = loader.loadClass (classname);
+         }
+       catch (ClassNotFoundException f)
+         {
+           throw e;
+         }
+      }
+
+    ecjConstructor = klass.getConstructor (new Class[] {
+      PrintWriter.class, PrintWriter.class, Boolean.TYPE});
+    ecjMethod = klass.getMethod ("compile", new Class[] {String[].class});
+  }
+    
+  // Expand a extensions directory list into a classpath.
+  private String expandExtDirs (String extdirs)
+  {
+    StringBuffer paths = new StringBuffer("");
+    String[] dirs = extdirs.split (File.pathSeparator);
+    for (int i = 0; i < dirs.length; i++)
+      {
+       File dir = new File (dirs[i]);
+       if (dir.isDirectory ())
+         {
+           File[] files = dir.listFiles ();
+           for (int j = 0; j < files.length; j++)
+             {
+               paths.append (File.pathSeparator);
+               paths.append (files[j].getAbsolutePath());
+             }
+         }
+      }
+    return paths.toString ();
+  }
+
+  public int compile (String[] args) throws Exception
+  {
+    // FIXME: Remove arguments supported by javac but not by ecj.  We
+    // should add support for these to ecj.
+    int removeCount = 0;
+
+    // We must manually add sourcepath to the classpath.
+    int classpathIndex = -1;
+    String sourcepath = null;
+
+    // We must set the bootclasspath if this isn't already done for us.
+    boolean hasBootclasspath = false;
+
+    // We add the extensions directory to the end of the bootclasspath.
+    // Default to the running JVM's extensions directory.
+    String extdirs = System.getProperty ("java.ext.dirs");
+
+    for (int i = 0; i < args.length; i++)
+      {
+        if (args[i].equals ("-bootclasspath"))
+          {
+            hasBootclasspath = true;
+          }
+        if (args[i].equals ("-classpath"))
+          {
+            classpathIndex = i+1;
+          }
+        if (args[i].equals ("-extdirs"))
+          {
+           extdirs = args[i+1];
+            args[i] = "-REMOVETHISARGUMENT";
+            args[i + 1] = "-REMOVETHISARGUMENT";
+           removeCount += 2;
+          }
+        else if (args[i].equals ("-sourcepath"))
+          {
+            sourcepath = args[i+1];
+            args[i] = "-REMOVETHISARGUMENT";
+            args[i + 1] = "-REMOVETHISARGUMENT";
+            removeCount += 2;
+          }
+        else if (args[i].equals ("-O"))
+          {
+            args[i] = "-REMOVETHISARGUMENT";
+            removeCount++;
+          }
+      }
+
+    // Append the sourcepath to the classpath.
+    if (sourcepath != null && classpathIndex != -1)
+      args[classpathIndex] += File.pathSeparator + sourcepath;
+
+    String[] strippedArgs = new String[args.length - removeCount 
+                                       + (hasBootclasspath ? 0 : 2)];
+    int k = 0;
+    for (int i = 0; i < args.length; i++)
+      {
+        if (!args[i].equals ("-REMOVETHISARGUMENT"))
+         {
+           if (!args[i].equals ("-bootclasspath"))
+             strippedArgs[k++] = args[i];
+           else
+             {
+               strippedArgs[k++] = args[i++];
+               strippedArgs[k++] = args[i] + File.pathSeparator + 
expandExtDirs (extdirs);
+             }
+         }
+      }
+    if (! hasBootclasspath)
+      {
+        strippedArgs[k++] = "-bootclasspath";
+        strippedArgs[k++] = System.getProperty ("sun.boot.class.path")
+         + File.pathSeparator + expandExtDirs (extdirs);
+      }
+    
+    Object ecjInstance = ecjConstructor.newInstance (new Object[] {
+      new PrintWriter (System.out),
+      new PrintWriter (System.err),
+      Boolean.FALSE});
+    return ((Boolean) ecjMethod.invoke (ecjInstance, new Object[] {
+      strippedArgs})).booleanValue() ? 0 : -1;
+  }
+
+  public static void main (String[] args) throws Exception
+  {
+    Main javac = new Main ();
+
+    int result = javac.compile (args);
+
+    Runtime.getRuntime ().exit (result);
+  }
+}
diff --git a/debian/changelog b/debian/changelog
index 6066240..2e13bf0 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+ecj-bootstrap (3.0.1-5) unstable; urgency=low
+
+  * Add a /usr/bin/ecj binary.
+
+ -- Matthias Klose <d...@debian.org>  Sat, 11 Jun 2005 17:57:46 +0000
+
 ecj-bootstrap (3.0.1-4) unstable; urgency=low
 
   * Upload to unstable.
diff --git a/debian/copyright b/debian/copyright
index fc1fd2d..c898694 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -2,8 +2,13 @@ This package was debianized by Jerry Haltom 
<was...@larvalstage.net> on
 Thu, 10 Feb 2005 14:47:15 -0600
 
 It was downloaded from dev.eclipse.org cvs. 
+The ecj script is taken from java-gcj-compat 
(ftp://sources.redhat.com/pub/rhug/)
 
-This software is copyright (c) 2000, 2004 IBM Corporation and others.
+This software is copyright (c) 2000, 2004 IBM Corporation and others,
+licensed under the Common Public License - v 1.0.
+
+The ecj script is Copyright (C) 2004  Red Hat, licensed under the GPL with
+a special exception.
 
 Copyright:
 
@@ -235,3 +240,43 @@ intellectual property laws of the United States of 
America. No party to
 this Agreement will bring a legal action under this Agreement more than 
 one year after the cause of action arose. Each party waives its rights 
 to a jury trial in any resulting litigation. 
+
+
+Copyright ecj script:
+
+/* Main.java -- implement com.sun.tools.javac.Main
+   Copyright (C) 2004  Red Hat
+
+This file is part of java-gcj-compat.
+
+java-gcj-compat 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, or (at your option)
+any later version.
+
+java-gcj-compat 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 java-gcj-compat; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 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. */
diff --git a/debian/ecj-bootstrap.dirs b/debian/ecj-bootstrap.dirs
deleted file mode 100644
index b7aaa60..0000000
--- a/debian/ecj-bootstrap.dirs
+++ /dev/null
@@ -1,2 +0,0 @@
-usr/share/java
-usr/share/ant/lib
diff --git a/debian/ecj-bootstrap.install b/debian/ecj-bootstrap.install
deleted file mode 100644
index 2571ecd..0000000
--- a/debian/ecj-bootstrap.install
+++ /dev/null
@@ -1,2 +0,0 @@
-build/dist/ecj.jar             usr/share/java
-build/dist/ecj-adapter.jar     usr/share/ant/lib
diff --git a/debian/ecj-bootstrap.postinst b/debian/ecj-bootstrap.postinst
new file mode 100644
index 0000000..3dbf24d
--- /dev/null
+++ b/debian/ecj-bootstrap.postinst
@@ -0,0 +1,7 @@
+#! /bin/sh -e
+
+update-alternatives --quiet --install /usr/bin/ecj ecj /usr/bin/ecj-bootstrap 
3 \
+
+#  --slave /usr/share/man/man1/ecj.1.gz ecj.1.gz 
/usr/share/man/man1/ecj-bootstrap.1.gz
+
+#DEBHELPER#
diff --git a/debian/ecj-bootstrap.prerm b/debian/ecj-bootstrap.prerm
new file mode 100644
index 0000000..f5e4bd8
--- /dev/null
+++ b/debian/ecj-bootstrap.prerm
@@ -0,0 +1,5 @@
+#! /bin/sh -e
+
+update-alternatives --quiet --remove ecj /usr/bin/ecj-bootstrap
+
+#DEBHELPER#
diff --git a/debian/rules b/debian/rules
index 4c39c6e..136bdaf 100755
--- a/debian/rules
+++ b/debian/rules
@@ -51,6 +51,9 @@ build/stamp:
        /usr/bin/fastjar -c -C build/bin/antadapter . -f 
build/dist/ecj-adapter.jar
        rm -rf build/bin
 
+       gcj-4.0 -C -d . -I . com/sun/tools/javac/Config.java
+       gcj-4.0 -C -d . -I . com/sun/tools/javac/Main.java
+       fastjar cMf ecj-bootstrap-tools.jar ./com/sun/tools/javac/Config.class 
com/sun/tools/javac/Main.class
 
        #/usr/bin/gcj-$(gcc_version) \
        #    -Wl,-Bsymbolic -shared -fPIC -fjni -findirect-dispatch \
@@ -62,7 +65,19 @@ build/stamp:
        #    -o build/dist/ecj build/dist/ecj.jar
 
        touch build/stamp
-       
+
+install/ecj-bootstrap::
+       mkdir -p debian/ecj-bootstrap/usr/share/java
+       install -m 644 build/dist/ecj.jar debian/ecj-bootstrap/usr/share/java/
+
+       mkdir -p debian/ecj-bootstrap/usr/share/ant1.6/lib
+       install -m 644 build/dist/ecj-adapter.jar 
debian/ecj-bootstrap/usr/share/ant$(ant_version)/lib/
+       dh_link usr/share/ant$(ant_version)/lib/ecj-adapter.jar 
usr/share/ant/lib/ecj-adapter.jar
+
+       mkdir -p debian/ecj-bootstrap/usr/bin
+       install -m 644 ecj-bootstrap-tools.jar 
debian/ecj-bootstrap/usr/share/java/
+       install -m 755 ecj-bootstrap debian/ecj-bootstrap/usr/bin/
 
 clean::
        rm -rf build
+       rm -f com/sun/tools/javac/*.class ecj-bootstrap-tools.jar
diff --git a/ecj-bootstrap b/ecj-bootstrap
new file mode 100644
index 0000000..458d5b5
--- /dev/null
+++ b/ecj-bootstrap
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+case $CLASSPATH in
+*/usr/share/java/ecj-bootstrap-tools.jar*) ;;
+*) CLASSPATH=$CLASSPATH${CLASSPATH:+:}/usr/share/java/ecj-bootstrap-tools.jar
+esac
+
+case $CLASSPATH in
+*/usr/share/java/ecj.jar*) ;;
+*) CLASSPATH=$CLASSPATH:/usr/share/java/ecj.jar
+esac
+
+export CLASSPATH
+
+exec /usr/bin/gij-4.0 \
+    -Dgnu.gcj.precompiled.db.path=/var/lib/gcj-4.0/classmap.db \
+    -Djava.ext.dirs=/usr/lib/java-ext:/usr/share/java-ext \
+    com.sun.tools.javac.Main ${1+"$@"}

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-java/ecj.git

_______________________________________________
pkg-java-commits mailing list
pkg-java-comm...@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-java-commits

Reply via email to