It is often useful to test Fedora Core JPackages against GCJ HEAD. java-gcjHEAD-compat is a package that provides a GCJ HEAD JVM alternative alongside the normal java-gcj-compat and SDK alternatives.
These instructions assume a ~/.rpmmacros file like this:
$ cat ~/.rpmmacros %_topdir /home/overholt/rpmbuild
and a GCC installation in /home/overholt/install.
1. Check java-1.4.2-gcj-compat out of Fedora CVS
$ cvs -d :pserver:anonymous@cvs.fedora.redhat.com:/cvs/dist co java-1.4.2-gcj-compat
2. Change to the devel directory
$ cd java-1.4.2-gcj-compat/devel
3. Build an SRPM
$ make srpm
4. Ensure that your built gcc is ahead of the system compiler in your path
$ export PATH=/home/overholt/install/bin:$PATH
5. Build java-1.4.2-gcjHEAD-compat RPMS
$ rpmbuild --rebuild \ --define "custom 1" \ --define "gcj_prefix /home/overholt/install" \ --define "origin gcjHEAD" \ java-1.4.2-gcj-compat-<version>.src.rpm
6. Install the RPMs produced by rpmbuild
$ sudo rpm -Uvh ~/rpmbuild/RPMS/<arch>/*gcjHEAD*
7. Set the java and javac alternatives to gcjHEAD
$ sudo /usr/sbin/update-alternatives --config javac $ sudo /usr/sbin/update-alternatives --config java
8. Verify the alternatives
$ readlink -f /usr/bin/java $ readlink -f /usr/bin/javac
This approach is general, so it can be applied to any number of GCC installations by modifying the arguments to rpmbuild.