Last modified 1999/04/02

Unfortunately, Java2 really needs a running Java2 in order to build. I provide a very minimal Java2 for FreeBSD so that you can try porting. I doubt that these instructions are sufficient!

This is what I think I needed to do to get as far as building a (limping along) JVM on FreeBSD.

I use ksh to build the JDK, no particular reason, you'll need to salt this to taste:

Setup intial variables

BASE is set to the directory where you'd like to build the JDK. You'll need lots of free space there. JAVA2SRC is set to the JDK1.2 gzipped tar archive. PATCHES is set to the file you downloaded with the patches. MINIMALCLASSES is set to the file you downloaded with the set of minimal classes. MINIMALBIN is set to the file you downloaded with the set of minimal binaries and libraries.
BASE=/jdk/jdk1.2X
JAVA2SRC=javasrc1.2.tar.gz
PATCHES=patches.gz
MINIMALCLASSES=minimalclasses.tar.gz
MINIMALBIN=minimalbinlib.tar.gz

Unpack the source

JAVASRC=$BASE/javasrc
mkdir -p $BASE
cd $BASE
tar xvfz $JAVA2SRC javasrc/ext javasrc/src/share javasrc/src/solaris \
  javasrc/build/share javasrc/build/solaris

Make the FreeBSD directories

You'll be using a symbolic link tree.

cd $JAVASRC/src; mkdir freebsd; cd freebsd; lndir ../solaris
cd $JAVASRC/build; mkdir freebsd; cd freebsd; lndir ../solaris

Patch the source

cd $JAVASRC; zcat $PATCHES | patch

Unpack the minimal set of Java2 classes

cd $JAVASRC/build/freebsd; mkdir classes; cd classes
	tar xvfz $MINIMALCLASSES
cp com/sun/tools/javah/resources/SunOS_sparc.properties \
	com/sun/tools/javah/resources/FreeBSD_i386.properties

Unpack the minimal set of Java2 binaries and libraries

cd $JAVASRC/build/freebsd; tar xvfz $MINIMALBIN


Build java2

Now for the fun stuff. The jvm now builds well enough to run "javac", but fails when running "javah" (with the assembler version of ExecuteJava).

Due to limitations on dlopen(), you'll need a symbolic link for ALT_BOOTDIR

ln -s $JAVASRC/build/freebsd /tmp/jdk1.2

cd $JAVASRC/build/freebsd

USE_EXECUTEJAVA_C=yes \
  CC_VERSION=gcc ALT_MOTIF_DIR=/usr/dt ALT_MOTIF_LIB=/usr/dt/lib \
  ALT_MOTIF_SO=so.2.1 ALT_MOTIF_INC=/usr/dt/include  \
  ALT_JAVAHOME=$JAVASRC/build gmake PLATFORM=freebsd \
  ALT_BOOTDIR=/tmp/jdk1.2 \
  HPIS=green PRIVATIZE_JVM_SYMBOLS=false

NOTES