From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lists.gentoo.org ([140.105.134.102] helo=robin.gentoo.org) by nuthatch.gentoo.org with esmtp (Exim 4.54) id 1FBxBB-000726-5I for garchives@archives.gentoo.org; Wed, 22 Feb 2006 16:49:29 +0000 Received: from robin.gentoo.org (localhost [127.0.0.1]) by robin.gentoo.org (8.13.5/8.13.5) with SMTP id k1MGmvmK031442; Wed, 22 Feb 2006 16:48:57 GMT Received: from smtp06.web.de (smtp06.web.de [217.72.192.224]) by robin.gentoo.org (8.13.5/8.13.5) with ESMTP id k1MGmvu2026429 for ; Wed, 22 Feb 2006 16:48:57 GMT Received: from [84.136.109.181] (helo=anomalie.manna.org) by smtp06.web.de with asmtp (TLSv1:AES256-SHA:256) (WEB.DE 4.105 #340) id 1FBxAe-0003pK-00; Wed, 22 Feb 2006 17:48:57 +0100 Date: Wed, 22 Feb 2006 17:51:02 +0100 From: Hanno Meyer-Thurow To: gentoo-java@lists.gentoo.org Cc: world.root@gmail.com Subject: Re: [gentoo-java] work on gcj for gentoo Message-Id: <20060222175102.7fe10cf2.h.mth@web.de> In-Reply-To: <20060221160425.b1478bdc.h.mth@web.de> References: <20060221160425.b1478bdc.h.mth@web.de> X-Mailer: Sylpheed version 2.1.9 (GTK+ 2.8.9; i686-pc-linux-gnu) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-java@gentoo.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="Multipart=_Wed__22_Feb_2006_17_51_02_+0100_0b4thYBzwGdoWSRh" Sender: h.mth@web.de X-Sender: h.mth@web.de X-Archives-Salt: 752cc9fa-75f0-4aa3-98da-60902c53130e X-Archives-Hash: d265649aa74f8fe14adca8a66d06a87d This is a multi-part message in MIME format. --Multipart=_Wed__22_Feb_2006_17_51_02_+0100_0b4thYBzwGdoWSRh Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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 --Multipart=_Wed__22_Feb_2006_17_51_02_+0100_0b4thYBzwGdoWSRh Content-Type: text/x-patch; name="ant-core-ecj.diff" Content-Disposition: attachment; filename="ant-core-ecj.diff" Content-Transfer-Encoding: 7bit --- 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; + } +} --Multipart=_Wed__22_Feb_2006_17_51_02_+0100_0b4thYBzwGdoWSRh-- -- gentoo-java@gentoo.org mailing list