Project Proposal: BSD port

Martin Buchholz martinrb at
Sat Aug 2 18:17:36 UTC 2008

I mostly agree with Volker.

The JDK code base has historically been targeted at a
small number (like 10) of very specific build environments.
The "must be windows or solaris or linux" assumption
is a big one, but just one of many.
Introducing a configure step is probably the right idea.
The BSD port is a fine time to make OpenJDK at least
more generally portable to any kind of Unix.
BSD porters: Please don't just add else-if-BSD everywhere.

On the other hand, I don't dislike #ifdefs as much as
others (e.g. Volker) do.  They need to be isolated, certainly,
but with careful coding they have their place.
I think #ifdefs are very much preferable to copying the
entire src/solaris tree to src/bsd, for example.

Unfortunately, there seems to be no way to change the
portability layer of OpenJDK without introducing some instability.
Good pre-integration testing is key.


On Sat, Aug 2, 2008 at 1:14 AM, Volker Simonis <volker.simonis at> wrote:
> On 8/2/08, Rob Ross <rob.ross at> wrote:
>> I'm trying to clarify my understanding of what this means for a Mac-native
>> version of OpenJDK.
>> One of the implementation details of this project will be, for example, the
>> addition of a "BSD" directory under .../jdk/src/, to go along with the
>> existing "linux", "solaris", "windows", folders.
>> Is this correct?
> I think this is a crucial question and the answer is not as clear as
> it may seem at a first glance. The problem is, that currently the
> "linux" directory contains only the Linux man-pages while the
> "solaris" directory contains all the "*nix" coding. While Linux and
> Solaris obviously share a great amount of code, the differences
> between the systems are factored out by numerous "ifdef" cascades.
> There are also a lot of places in the code which implicitely assume
> that the code is onlycompiled on Solaris and Linux (e.g. "ifndef
> SOLARIS" is used as a marker for Linux).
> Now that many new ports are created, I think this code organization
> should be seriously reconsidered, because:
> - if every port just changes the existing "solaris" source tree and
> inserts just one more cascade of platform specific macros it will
> become impossible to merge two or more of these ports together (i.e.
> to have one source repository which builds on every supported
> platform). But I think t his must be the final goal - having one
> source repository which contains as many ports as possible.
> - if every port makes a copy of the current solaris directory (i.e.
> the "bsd" directory in this context) this would make merging different
> ports easier. But it would also lead to a considerable amount of code
> duplication and maintaining the new ports would be a nightmare,
> because any changes to the original "solaris" directory, would have to
> be integrated in all the copies for the different ports.
> So in my opinion, the right way to go would be to factor out the
> common "*nix" code into a generic, say "Posix" directory and let the
> different platform directories ("solaris", "linix", "bsd", "haiku",
> ...) only contain the differences with regard to the common "Posix"
> directory (much like the "hotspot" directory is organized into a
> "shared", "cpu", "os" and "os_cpu" part).
> The drawback of this solution is that it would require a considerable
> amount of work (and a lot of work from Sun) because the code for the
> Solaris and Linux ports would have to be changed.
> Probably it would be wise, if the porters group would sponsor such an
> effort in the first place, if it is really interested in having many
> stable platform ports in the future.

More information about the discuss mailing list