public inbox for gentoo-java@lists.gentoo.org
 help / color / mirror / Atom feed
From: Hanno Meyer-Thurow <h.mth@web.de>
To: gentoo-java@lists.gentoo.org
Cc: world.root@gmail.com
Subject: Re: [gentoo-java] work on gcj for gentoo
Date: Wed, 22 Feb 2006 17:51:02 +0100	[thread overview]
Message-ID: <20060222175102.7fe10cf2.h.mth@web.de> (raw)
In-Reply-To: <20060221160425.b1478bdc.h.mth@web.de>

[-- Attachment #1: Type: text/plain, Size: 1459 bytes --]

Hi list!
I got ant-core built by native ecj. I added a simple Ecj CompilerAdapter
for ant-core to use -Dbuild.compiler=ecj which seems to work. That
CompilerAdapter is a copy of Gcj CompilerAdapter plus infos from
http://sources.redhat.com/ml/rhug-rhats/2004-05/msg00002.html

Now if one Java developer could help to improve the CompilerAdapter
for Ecj I would be very happy.

Why I add another CompilerAdaper for Ecj?
I have to delete the one from ecj because of missing ant-core at that
point. I also want to use the ecj binary instead of gij / ecj.jar.

How did I get there?
I put my ecj binary to ${JAVA_HOME}/bin/ecj-native.
I add a wrapper script as ${JAVA_HOME}/bin/ecj.
Which looks like
	"ecj-native -bootclasspath /opt/gcj-jdk-4.1/share/java/libgcj-4.1.0-pre20060219.jar $@"

JAVA_HOME=/opt/gcj-jdk-4.1


My diff to ant-core is attached.
I will update my overlay soon.

Any help or pointers are welcomed!
Especially of sanitizing all this.


Another thing I came across. Something to worry about?

nb ~ # ldd /opt/gcj-jdk-4.1/lib/libgcj.so.7
	...
	libgcc_s.so.1 => /usr/lib/gcc/i686-pc-linux-gnu/4.1.0-pre20060219/libgcc_s.so.1 (0xb6a51000)
	...
nb ~ # ldd /opt/gcj-jdk-4.1/lib/libgij.so.7
	...
	libgcc_s.so.1 => /opt/gcj-jdk-4.1/lib/libgcc_s.so.1 (0xb6a4c000)
	...
nb ~ # ldd /opt/gcj-jdk-4.1/lib/lib-gnu-java-awt-peer-gtk.so.7
	...
	libgcc_s.so.1 => /usr/lib/gcc/i686-pc-linux-gnu/4.1.0-pre20060219/libgcc_s.so.1 (0xb7780000)
	...


Regards,
Hanno

[-- Attachment #2: ant-core-ecj.diff --]
[-- Type: text/x-patch, Size: 5062 bytes --]

--- build.sh.orig	2006-02-22 00:24:13.000000000 +0100
+++ build.sh	2006-02-22 00:26:46.000000000 +0100
@@ -41,5 +41,5 @@
   ANT_INSTALL="-emacs"
 fi
 
-bootstrap/bin/ant -lib lib/optional "$ANT_INSTALL" $*
+bootstrap/bin/ant -lib lib/optional -Dbuild.compiler=ecj "$ANT_INSTALL" $*
 
--- bootstrap.sh.orig	2006-02-22 17:06:18.000000000 +0100
+++ bootstrap.sh	2006-02-22 17:05:45.000000000 +0100
@@ -126,7 +126,7 @@
 
 echo ... Compiling Ant Classes
 
-"${JAVAC}" $BOOTJAVAC_OPTS -d ${CLASSDIR} ${TOOLS}/bzip2/*.java ${TOOLS}/tar/*.java ${TOOLS}/zip/*.java \
+${JAVAC} $BOOTJAVAC_OPTS -d ${CLASSDIR} ${TOOLS}/bzip2/*.java ${TOOLS}/tar/*.java ${TOOLS}/zip/*.java \
     ${TOOLS}/ant/util/regexp/RegexpMatcher.java \
     ${TOOLS}/ant/util/regexp/RegexpMatcherFactory.java \
     ${TOOLS}/ant/types/*.java \
@@ -150,7 +150,7 @@
 
 echo ... Building Ant Distribution
 
-"${JAVACMD}" -classpath "${CLASSPATH}" -Dant.home=. $ANT_OPTS org.apache.tools.ant.Main -emacs "$@" bootstrap
+"${JAVACMD}" -classpath "${CLASSPATH}" -Dbuild.compiler=ecj -Dant.home=. $ANT_OPTS org.apache.tools.ant.Main -emacs "$@" bootstrap
 ret=$?
 if [ $ret != 0 ]; then  
   echo ... Failed Building Ant Distribution !
--- src/main/org/apache/tools/ant/taskdefs/compilers/CompilerAdapterFactory.java.orig	2006-02-22 16:43:17.000000000 +0100
+++ src/main/org/apache/tools/ant/taskdefs/compilers/CompilerAdapterFactory.java	2006-02-22 16:43:41.000000000 +0100
@@ -120,6 +120,9 @@
             if (compilerType.equalsIgnoreCase("kjc")) {
                 return new Kjc();
             }
+            if (compilerType.equalsIgnoreCase("ecj")) {
+                return new Ecj();
+            }
             if (compilerType.equalsIgnoreCase("gcj")) {
                 return new Gcj();
             }
--- /dev/null	2005-12-16 14:04:54.000000000 +0100
+++ src/main/org/apache/tools/ant/taskdefs/compilers/Ecj.java	2006-02-22 16:45:18.000000000 +0100
@@ -0,0 +1,99 @@
+/*
+ * Copyright  2001-2005 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+package org.apache.tools.ant.taskdefs.compilers;
+
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.types.Commandline;
+import org.apache.tools.ant.types.Path;
+
+/**
+ * The implementation of the ecj compiler.
+ * This is primarily a cut-and-paste from the jikes.
+ *
+ * @since Ant 1.4
+ */
+public class Ecj extends DefaultCompilerAdapter {
+
+    /**
+     * Performs a compile using the ecj compiler.
+     */
+    public boolean execute() throws BuildException {
+        Commandline cmd;
+        attributes.log("Using ecj compiler", Project.MSG_VERBOSE);
+        cmd = setupECJCommand();
+
+        int firstFileName = cmd.size();
+        logAndAddFilesToCompile(cmd);
+
+        return
+            executeExternalCompile(cmd.getCommandline(), firstFileName) == 0;
+    }
+
+    protected Commandline setupECJCommand() {
+        Commandline cmd = new Commandline();
+        Path classpath = new Path(project);
+
+        // ecj doesn't support bootclasspath dir (-bootclasspath)
+        // so we'll emulate it for compatibility and convenience.
+        if (bootclasspath != null) {
+            classpath.append(bootclasspath);
+        }
+
+        // ecj doesn't support an extension dir (-extdir)
+        // so we'll emulate it for compatibility and convenience.
+        classpath.addExtdirs(extdirs);
+
+        classpath.append(getCompileClasspath());
+
+        // Gcj has no option for source-path so we
+        // will add it to classpath.
+        if (compileSourcepath != null) {
+            classpath.append(compileSourcepath);
+        } else {
+            classpath.append(src);
+        }
+
+        cmd.setExecutable("ecj");
+
+        if (destDir != null) {
+            cmd.createArgument().setValue("-d");
+            cmd.createArgument().setFile(destDir);
+
+            if (!destDir.exists() && !destDir.mkdirs()) {
+                throw new BuildException("Can't make output directories. "
+                                         + "Maybe permission is wrong. ");
+            }
+        }
+
+        cmd.createArgument().setValue("-classpath");
+        cmd.createArgument().setPath(classpath);
+
+        if (encoding != null) {
+            cmd.createArgument().setValue("-encoding " + encoding);
+        }
+        if (debug) {
+            cmd.createArgument().setValue("-g");
+        }
+
+        addCurrentCompilerArgs(cmd);
+
+        return cmd;
+    }
+}

  parent reply	other threads:[~2006-02-22 16:49 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-21 15:04 [gentoo-java] work on gcj for gentoo Hanno Meyer-Thurow
2006-02-21 15:42 ` Karl Trygve Kalleberg
2006-02-21 18:14   ` Hanno Meyer-Thurow
2006-02-21 18:21     ` Karl Trygve Kalleberg
2006-02-21 15:45 ` Joshua Nichols
2006-02-21 15:55   ` Joshua Nichols
2006-02-21 17:53   ` Hanno Meyer-Thurow
2006-02-22  8:16   ` Andrew Cowie
2006-02-27 22:38     ` Hanno Meyer-Thurow
2006-03-01 12:30       ` Andrew Cowie
2006-03-01 14:38         ` Hanno Meyer-Thurow
2006-02-28  7:34     ` [RESEND] " Hanno Meyer-Thurow
2006-02-22 16:51 ` Hanno Meyer-Thurow [this message]
2006-02-23  2:09 ` Andrew Cowie
2006-02-23 11:25   ` Hanno Meyer-Thurow
2006-02-24 17:26     ` Hanno Meyer-Thurow
2006-02-25 14:43       ` Hanno Meyer-Thurow
2006-02-28 10:25 ` Hanno Meyer-Thurow
2006-02-28 20:37   ` Hanno Meyer-Thurow
2006-03-02 10:35   ` Hanno Meyer-Thurow
2006-03-11 20:51 ` Hanno Meyer-Thurow
2006-03-12 18:25   ` Hanno Meyer-Thurow

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060222175102.7fe10cf2.h.mth@web.de \
    --to=h.mth@web.de \
    --cc=gentoo-java@lists.gentoo.org \
    --cc=world.root@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox