How to build openjdk7 for customized FreeBSD system

Xu Zhe xzpeter at
Sat Jun 8 11:46:23 UTC 2013

? 6/8/13 5:23 PM, Chris Rees ??:
> On 8 Jun 2013 04:05, "Peter Xu" <xzpeter at
> <mailto:xzpeter at>> wrote:
> >
> > I did this in a stupid way. I am sending this out in case someone
> met the
> > same problem (or to say, you want to build openjdk on an platform
> that have
> > no older version of JDK supported).
> >
> > The main idea is, firstly find a generic FreeBSD 8.2 system, build the
> > openjdk7 package (well, there is no problem on generic system, as
> long as
> > you are using the port collections corresponding to that specific
> version I
> > suppose). Then, we can leverage all the Java-built output (includes
> > *.class, *.jar, and some *.java/*.[ch] if they are auto-generated by the
> > build system using JVM) in the generic systems, replacing all the
> > $(JAVAC_CMD) and $(JAVAH_CMD) lines in Makefiles with something like
> (or we
> > can try direct copy of the object files, but sometimes we still need
> to do
> > this since the dependencies of 'make' are not the JAR files sometimes):
> >
> >
> > Or to say, we do fetch the good 'jar' from the generic systems
> instead of
> > invoking a sick JVM and build it until we met error and stop the make
> > process.
> >
> > I suppose all these things need some knowledge on the Makefile
> structure of
> > openjdk. This is nasty work, but it did work for us.
> >
> > Another solution I thought about is cross-compile the whole JDK on a
> > generic system, and copy all the private C libraries on the private
> system
> > to the generic one before-hand (this may only be working when the
> generic
> > system has cross-toolchain I suppose, or in my case that the two systems
> > are using the same CPU arch). Just an idea, no need to try currently.
> I'm really pleased you fixed it in the end; I'd just succeeded in
> making you a package too, but never mind.
> Now you have time to migrate your hacks to later FreeBSD, and even get
> some of them committed ;)
> Chris
Hi, Chris,

Thanks for the attempt to help. :)

However, I am not quite sure on the migrate thing. Do you mean that, I
can re-arrange the hack so that openjdk on FreeBSD would support build
across two machines (or to say, to seperate Java/native code build)?


More information about the freebsd-ports mailing list