JDK on OpenBSD 4.1

Posted by face on October 15, 2007

JDK 1.5 in the 4.1 ports is crufty at this point. I recommend back porting the current HEAD version (assuming you already have your ports tree configured and up to date, are part of the wsrc group, and the wsrc group has write permissions to /usr/ports. If my assumption is wrong, please configure your ports tree as suggested here 15.3 – Working with ports ):

Before we start lets get the manual files and put them in /usr/distfiles:

Now Lets update the port, install prerequisites as binaries to save time, and build the package (You probably need to up datasize-cur in /etc/login.conf for the user building java to be 1024M, mine was when I just built it):

setenv CVSROOT anoncvs@anoncvs3.usa.openbsd.org:/cvs
setenv PKG_PATH ftp://ftp2.usa.openbsd.org/pub/OpenBSD/4.1/packages/i386
sudo pkg_add gtar-1.16.1p0 zip unzip bzip2 openmotif libiconv kaffe jikes nspr gmake wget
cd /usr/ports/devel/jdk/1.5
cvs up -rHEAD .

This updated jdk/1.5/Makefile will fail in OpenBSD 4.1 after several hours with the following error: /bin/sh: syntax error: `(' unexpected. I tracked this down to the \(TM\) in the COMMENT-main and COMMENT-jre in the Makefile. Remove these \(TM\)s in those two comment variables in the Makefile with your favorite editor and we can continue.

cd /usr/distfiles
wget http://www.java.net/download/tiger/tiger_u12/jdk-1_5_0_12-fcs-src-b04-jrl-02_may_2007.jar
wget http://www.java.net/download/tiger/tiger_u12/jdk-1_5_0_12-fcs-bin-b04-jrl-02_may_2007.jar
wget http://www.apache.org/dist/xml/xalan-j/xalan-j_2_7_0-bin.tar.gz
cd /usr/ports/devel/jdk/1.5
make makesum # Need to rebuild checksums as 4.2 OpenBSD uses longer keys
make package  # This will take a while...a long while

After several hours we should have a shiny new native JDK for OpenBSD. We can install it now:

unsetenv PKG_PATH
pkg_add /usr/packages/i386/all/jdk-
chmod -R +r,+x /usr/local/jdk-1.5.0   #Let's let everyone run it

Digg! Delicious! Technorati Blinklist Furl Reddit