created an patch and install process for openjdk6

Andrew John Hughes gnu_andrew at
Fri Jan 30 13:26:29 PST 2009

2009/1/30 Brian Gardner <brian at>:
> 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 chose 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/bsd.  Makefiles also had to be patched to
> complete the change.  custom-patches contains these patches.
> Applying the patch.
> *) run
>  - 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 script that I use to
> start compiling
> Notes of Custom Patches
> COPIED FROM bsd-port to bsd-port6
> jdk/src/solaris/native/java/io/UnixFileSystem_md.c
> jdk/src/solaris/classes/java/lang/
> jdk/src/solaris/bin/java_md.c
> jdk/src/share/classes/sun/tools/jar/
> jdk/make/sun/awt/Makefile
> jdk/make/tools/freetypecheck/Makefile
> jdk/src/share/bin/java.c
> jdk/src/share/native/common/check_code.c
> jdk/src/share/transport/socket/socketTransport.c
> jdk/src/solaris/native/java/lang/UNIXProcess_md.c
> jdk/src/solaris/native/sun/nio/ch/Net.c
> hotspot/src/share/vm/runtime/os.cpp
> hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp
> hotspot/src/share/vm/utilities/macros.hpp
> hotspot/src/share/vm/utilities/vmError.cpp
> hotspot/src/share/vm/gc_implementation/includeDB_gc_concurrentMarkSweep
> hotspot/src/share/vm/gc_implementation/includeDB_gc_parNew
> jdk/make/common/internal/BinaryPlugs.gmk
> jdk/make/common/shared/Platform.gmk
> hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp
> hotspot/src/cpu/x86/vm/
> hotspot/src/cpu/x86/vm/interpreterRT_x86_32.cpp
> hotspot/src/cpu/x86/vm/runtime_x86_32.cpp
> jdk/src/share/classes/java/lang/
> mv bsd-port6/hotspot/make/bsd bsd-port6/hotspot/build/bsd
> 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

This is good to see.  My personal thoughts for a while have been that
the BSD port would work better as a patchset rather than a completely
separate tree, and the small amount of affected files here backs that
up.  I'll try and look at it in more detail at some point.
Andrew :-)

IcedTea/OpenJDK Software Engineer
Red Hat, Inc. (

Support Free Java!
Contribute to GNU Classpath and the OpenJDK

PGP Key: 94EFD9D8 (
Fingerprint: F8EF F1EA 401E 2E60 15FA  7927 142C 2591 94EF D9D8

More information about the bsd-port-dev mailing list