First, install Mercurial and the forest extension. If you have Macports, this is as easy as
$ sudo port install mercurial
$ sudo port install hg-forest
Now check out the OpenJDK bsd-port tree:
$ hg fclone http://hg.openjdk.java.net/bsd-port/bsd-port
You have to download soylatte16-amd64-1.0.3.tar.bz2 from
http://landonf.bikemonkey.org/static/soylatte/#get
and unpack it. This is needed for bootstrapping the build.
Use this build script:
export SOYLATTE_HOME=$HOME/src/soylatte16-amd64-1.0.3
export JAVA_HOME=$SOYLATTE_HOME
cd bsd-port
time env -i PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin \
make \
CC=gcc-4.0 CXX=g++-4.0 \
ALT_BOOTDIR=$SOYLATTE_HOME \
JAVA_TOOLS_DIR=$SOYLATTE_HOME/bin \
ALLOW_DOWNLOADS=true \
ALT_FREETYPE_HEADERS_PATH=/usr/X11R6/include \
ALT_FREETYPE_LIB_PATH=/usr/X11R6/lib \
ANT_HOME=/usr/share/ant \
NO_DOCS=true \
HOTSPOT_BUILD_JOBS=1
This is based on Sam Pullara's Building OpenJDK 1.7.0 post. I just had to add ALLOW_DOWNLOADS=true to avoid this error:
ERROR: Cannot find source for project jaxp.
When you run the script (if all goes well) you should get a lot of output that ends with
Control bsd i586 1.7.0-internal all build finished: 10-09-30 15:37
On my MacBook Pro (Core i7, 4 GB RAM, SSD) this took a little over 20 minutes.
Now move your newly built JDK somewhere more sensible:
$ mv bsd-port/build/bsd-i586/j2sdk-image ~/jdk7
Test the install:
$ jdk7/bin/java -version
openjdk version "1.7.0-internal"
OpenJDK Runtime Environment (build 1.7.0-internal-kjetilod_2010_09_30_15_15-b00)
OpenJDK Server VM (build 19.0-b05, mixed mode)
Project Lambda
For bonus points, here's how you build Project Lambda (based on a post by Rémi Forax to the lambda-dev mailing list):
Checkout the source:
$ hg clone http://hg.openjdk.java.net/
Build it with Ant (I just used 1.7.1 which comes with MacOS X):
$ cd lambda/langtools/
$ ant -Dboot.java.home=$HOME/jdk7 -f make/build.xml
From Rémi's post:
To run the compiler:
/bin/java -cp classes.jar
com.sun.tools.javac.Main yoursource.java
and to run your code:
/bin/java -cp classes.jar:. YourClass
1 comment:
Please check out the official Build instructions, we are always looking for people to update them.
http://wikis.sun.com/display/OpenJDK/Darwin10Build
Post a Comment