To build OpenJDK from source requires an already working OpenJDK to be available. Further it needs to be an OpenJDK of the same, or the previous major version. That is, to build OpenJDK 21 an existing OpenJDK version 21 or 20 must be available to the build. This is called the "boot-jdk", and can be set by the --with-boot-jdk argument to the configure scripts. If no boot-jdk was specified, the OpenJDK build system will look for a suitable OpenJDK version already installed on the system, and use that if one was found.
The FreeBSD Ports system is a set of hierarchial makefiles to build and package software for the operating system from source. The way the OpenJDK ports have dealt with obtaining a valid boot-jdk has traditionally been one of two ways:
- A dependency on the previous OpenJDK version where available.
- A dependency on a special "bootstrap-jdk" port, which downloads a prebuilt OpenJDK version suitable to be used as a boot-jdk for this build.
The second method was only used for OpenJDK versions 8, 11 and 17, as neither of these had ports for previous versions that they could depend on. For the rest, they all depended on their previous version to either already be installed on the system, or to be recursively built and installed by the ports system itself.
This had some disadvantages:
- The recursive nature of these dependencies meant that for all but a few versions, several OpenJDK versions could potentially need to be both built and installed to the system if trying to install a particular version from the ports tree.
- Even in the case where a special bootstrap-jdk port was available, it meant that the prebuilt bootstrap-jdk would be installed onto the system.
To solve these issues, I have change the way OpenJDK ports now are being bootstrapped. I have introduced separate prebuilt boot-jdks for all the currently maintained OpenJDK versions supported by the ports system, and instead of installing the boot-jdk, these are now just extracted and used by the build itself.
This means it should now be significantly quicker and easier to install any specific OpenJDK version from ports, and it frees us from having to maintain ports for ancient OpenJDK versions no longer supported by the upstream OpenJDK project.
The prebuilt boot-jdks are extracted from the official pkgs built by the FreeBSD package build servers. The exception is the boot-jdks for PowerPC architectures, where there are no official packages available. In this case the boot-jdks have been provided by another project member, Piotr Kubaj.