GentooBuildInstructions

From IcedTea

Jump to: navigation, search

Though this process was originally tested under Gentoo 2007.0 ~x86, it should be possible to modify it to build IcedTea on many other distributions. Following the steps below will allow you to build IcedTea:

Contents

The Automated Method

Packages for IcedTea6 (emerge icedtea6) and IcedTea (emerge icedtea) are now available in the Java overlay. You also need to keyword the ebuilds in /etc/portage/package.keywords:

dev-java/gcj-jdk ~amd64
sys-devel/gcc ~amd64
~dev-java/eclipse-ecj-3.3.0 ~amd64
dev-java/icedtea6 ~amd64
dev-java/icedtea ~amd64
dev-java/ant-core ~amd64
virtual/jdk ~amd64

Replace ~amd64 with your own architecture.

You can then simply do:

emerge -pv icedtea6

which will show you what will be downloaded, built and installed in order to build IcedTea6. If you get warnings about masked packages, you will need to add them to /etc/portage/package.keywords as above.

The overlay works with any JDK that satisfies the virtual dependency jdk-1.5. However, by default Gentoo uses the proprietary Sun or IBM JDKs to fulfill this. The overlay also includes gcj 4.3 as recommended elsewhere on this wiki. Adding the following to /etc/portage/package.mask:

dev-java/sun-jdk
dev-java/ibm-jdk
dev-java/jrockit
dev-java/diablo
dev-java/sun-jre-bin
dev-java/blackdown-jdk

will ensure that you have a fully Free Java environment, and will cause the IcedTea6 build to automatically install gcj 4.3. With the 2.2 version of Portage currently in development, it is now finally possible to mask packages based on license.

If you have any problems with this, please file a bug in Gentoo Bugzilla and CC gnu_andrew@member.fsf.org. My thanks to the Gentoo developers who developed the gcj, gcj-jdk and icedtea builds available in other Gentoo overlays (java-gcj-overlay and java-experimental) upon which these builds were based.

The Manual Method

Install Required Packages

For Gentoo, you can use this command to get the required packages:

emerge -av mercurial xalan xalan-serializer xerces cups lesstif eclipse-ecj

On other distributions, the package names should be similar, but you may need the *-dev or *-devel versions (e.g lesstif-devel).

Obtaining a 1.5 compliant JDK

Building IcedTea requires a compiler capable of compiling Java source code using the 1.5 language extensions and a virtual machine which can handle 1.5 bytecode. It also relies on other Java tools (jar, javah, javap, rmic). You can configure their locations with the following options:

  • --with-java: specify location of the 1.5 java vm
  • --with-ecj: use ecj to compile, the path to it can optionally be specified
  • --with-javac: use javac to compile, the path to it can optionally be specified
  • --with-javah: specify location of the javah
  • --with-jar: specify location of the jar
  • --with-rmic: specify location of the rmic

Note that IcedTea uses multiple VMs and compilers:

  • It will create a 'javac' from javac.in using the ecj.jar and the java it finds or which is selected by --with-java. This is used to compile the IcedTea plugs.
  • The Ant langtools build uses whatever VM you have set to run Ant and gets its compiler via tools.jar (usually).
  • --with-ecj/--with-javac is first used in the CORBA build. --with-ecj is used in preference and will fail if -1.5 is not passed to it beforehand.

Using GCJ

IcedTea defaults to using GCJ. Only the unreleased 4.3 tree (and the RedHat backport) is 1.5 compliant (see BuildRequirements). For Gentoo users, the easiest way to obtain this is to use the GCJ overlay, instructions are posted here:

http://overlays.gentoo.org/proj/java/wiki/GCJ_as_a_JDK

If you prefer to use svn sources, you can get the RedHat gcc branch.

svn co svn://gcc.gnu.org/svn/gcc/branches/redhat/gcc-4_1-branch gcc
mkdir gcc-build
cd gcc-build
../gcc/configure --prefix=<installation dir> --exec-prefix=<installation dir>/<architecture>
make && make install

Setup Your PATH

In order to use the 1.5 compatible VM you have just built, you need to have it in your PATH. That can be done by adding the bin directory of the gcc installation to your PATH. This will not be necessary if you used the GCJ overlay and already have it setup in your PATH.

export PATH=<gcc installation dir>/<architecture>/bin:$PATH

Get the IcedTea Sources

If you do not already have the IcedTea sources, you will need to check them out using Mercurial.

hg clone http://icedtea.classpath.org/hg/icedtea

Configure and Build IcedTea

You will need to tell configure where to find the libgcj-4.x.x.jar you just built, as well as where to find ecj. If it does not find xalan and xerces by itself, you will also need to pass options to configure so it can find those packages. The following will work under Gentoo if you built gcc from the svn sources on the RedHat branch.

cd icedtea
./configure --with-ecj=/usr/bin/ecj-3.2
--with-ecj-jar=/usr/share/eclipse-ecj-3.2/lib/ecj.jar
--with-libgcj-jar=<gcc installation dir>/share/java/libgcj-4.1.3.jar  
--with-xalan2-jar=/usr/share/xalan/lib/xalan.jar 
--with-xalan2-serializer-jar=/usr/share/xalan-serializer/lib/serializer.jar 
--with-xerces2-jar=/usr/share/xerces-2/lib/xercesImpl.jar
make
Personal tools