BuildingOpenJDK
From IcedTea
IcedTea makes it easy to build OpenJDK, but sometimes it's necessary to build it yourself from a Mercurial forest, notably when upstreaming patches.
Assuming you want to build the tl repository (which covers a lot of the JDK, including the core libraries, networking, security, etc.) then you can proceed as follows:
$ hg fclone http://hg.openjdk.java.net/jdk7/tl $ cd tl $ unset JAVAC JAVACFLAGS JAVA_HOME JDK_HOME LD_LIBRARY_PATH CLASSPATH $ (echo Building in ${BUILD_DIR} && LANG=C make ALT_BOOTDIR=${ICEDTEA6_INSTALL} \ ALT_OUTPUTDIR=${BUILD_DIR} \ ALT_PARALLEL_COMPILE_JOBS=$PARALLEL_JOBS \ HOTSPOT_BUILD_JOBS=$PARALLEL_JOBS \ ALT_JIBX_LIBS_PATH=${JIBX_DIR} \ ANT=/usr/bin/ant \ QUIETLY="" )
-
BUILD_DIRis the location where you want the resulting build to end up. If you don't specifyALT_OUTPUTDIR, then the build will be written to tl/build. I find it useful to separate the build directory to make it easier to keep the forest and delete the build. It also means you can place the two on different discs to speed up the build a little. -
PARALLEL_JOBSalso speeds up the build by enabling you to make use of multiple CPUs where available; this works like make -jn (which unfortunately doesn't work for OpenJDK) i.e. for n CPUs, setPARALLEL_JOBSto n+1. -
ICEDTEA6_INSTALL= is the location of an install of IcedTea6 to use to bootstrap the new JDK - <code>JIBX_DIR is the location of the JIBX 1.1.6 dependencies (bcel.jar, xpp3.jar, jibx-run.jar, jibx-bind.jar) for building the Nimbus look and feel. Alternatively you can specify
DISABLE_NIMBUS="true"to disable this part of the build. -
QUIETLYmakes the HotSpot build more verbose, so you can see the invocations of e.g.javac
If you are building the IcedTea forest, you also have the option of building with the Zero port from Gary Benson of Red Hat. Add:
CORE_BUILD=true ZERO_BUILD=true
The architecture and libffi location can be set automatically by running jdk/make/jdk_generic_profile.sh prior to make. Alternatively, you can set them as follows (replace amd64 with your architecture if required, the ARCHDEF version does need to be capitalised).
ZERO_LIBARCH=amd64 \ ZERO_ARCHDEF=AMD64 \ ZERO_BITSPERWORD=64 \ ZERO_ENDIANNESS=little \ ZERO_ARCHFLAG=-m64 \ LIBFFI_LIBS="-lffi" \

