Hello fellow BSD lovers,
I've created a patch process for patching openjdk6 for BSD (FreeBSD specifically), although I tried to keep all BSD versions in mind when creating my patch.
Welcome to OpenJDK6 on BSD
First let me start with a little background on why I choose to port openjdk6, and then I'll discuss the process I took to do it. I work for Experts Exchange recently we decided to move from Linux to FreeBSD. This decision came after a comprehensive test involving Linux, FreeBSD, and Solaris 10. FreeBSD blew the others away doubling the performance of Linux and outperforming Solaris 10 by a significant margin as well. We have come across several issues with the port java/jdk16, including lack of jmap functionality to track down memory errors and instability running the CMS garbage collector with a heap over 2G. I created the a patch to bring jmap functionality to java/jdk16. My next task was to begin hardening the VM, however it hardly makes sense to work on java/jdk16, because it's missing lots of bugs fixes from sun. openjdk7 looked like the next choice to try and I compiled it up and gave it a try, however a third party library/software I was using didn't work and upon talking with terracotta developers they had no plans to support openjdk7 in the future. I researched what exactly openjdk6 was and decided to give it a try.
How did I perform the Port
I started by duplicating jdk6 to bsd-port6. Then I take the difference between jdk7 and bsd-port and import them. I had trouble using patch -Nu jdk7 bsd-port because there were new files that contained long lines that patch complained about. I whipped up a quick perl script to compare the directories and create the jdk7_bsd_changes_20090126.
newfiles and jdk7_bsd_changes_20090126.
patches directories. Any file the was brand new to bsd-port was copied into jdk7_bsd_changes_20090126.
newfiles to avoid the patch issue with long lines. jdk7_bsd_changes_20090126
.patches contains a separate patch for each file the was changed between jdk7 and bsd-port. Not all of these patches applied cleanly so I then went through about 40 .rej files and applied the patches by hand, keeping track of the changes. When compiling I released the build structure had changed between jdk6 and jdk7 and bsd-port6/hotspot/make/bsd
/ had to be moved to bsd-port6/hotspot/build/bs
d. Makefiles also had to be patched to complete the change. custom-patches contains these patches.
AMMENDMENT: I have modified the process described above as per suggested. Instead of just copying a new file from bsd-port if they didn't exist in jdk7, I now reverse engineer the original process of porting from jdk7 to bsd-port, by taking the linux equivalents from jdk6 as a base, and apply the differences from the linux jdk7 version and the bsd-port version to it. This wasn't terribly easy and lots of hand patching was required. The upside is patch 0.1.0 produced a build envirnment that was mix between jdk7 and jdk6 build, and was hard to debug as a result. From version 0.2.0 and on this patch will simulate the jdk6 build process. Also version 0.2.0 should be completely jdk6 compatible.
Applying the patch.
*) run import_patch.pl
- download jdk6 using mercurial to _jdk6
- dupicate _jdk6 to bsd-port6
- apply jdk7-bsd-changes-20090126
- apply custom-patches
*) now compile, I've included a build_bsd-port6.sh script that I use to start compiling
jdk/src/share/bin/java.c - was hand patched, however I wasn't able to test compiling on Mac OS X, and I worry it won't compile