User:Arthurzam/OpenJDK Bootstrap

Bootstrapping is a lengthy process. Each OpenJDK version  needs existing version   or. For our users on some arches, where we can't provide, it means the users need to have some sort of bootstrap binary provided by us. We have a special process for creating those bootstrap binaries.

Finding bootstrap origin
We need to find a source for initial bootstrap itself:


 * 1) Use binary from other distributions. Collect all parts of openjdk from another distribution and unpack into some place (preferably inside  ). Extract all parts just so we don't need to find what is needed or missing - this is used just as a part of process, so no need to be minimalist. Try to run   from that directory, and check that no missing shared libraries are requested. You may want to preinstall all dependencies of .  Then edit manually the ebuild. You will need to remove the dependencies on slotted openjdk, edit the   function, so it will look something like (note that   should exist)ː And hope that everything works (it most definitely can fail).
 * 2) Bootstrap from previously built openjdk or  or . In this case we will need to traverse across major versions, one by one (8 to 9 to ... to 17 for example). We should use the gentoo-bootstrap overlay, which holds ebuilds for all those intermediate openjdk versions. You can enable it usingː


 * 1) Bootstrap from nothing. In case you don't have anything to base on, and you must support this arch (are you really sure?), here is a theoretical possibility to use bootstrap from nearly nothing, shown in gentoo-bootstrap overlay. I have tried it once for , it failed, and I never tried it again. It might work for you (please update me).

Bootstrapping
I recommend to use a new container with clean stage3.

Prepare the profile & dependencies' USE flagsː

Install all dependencies of openjdk needed (if it complains about cyclic dependency between same slot openjdk, edit the ebuild to remove those).

Prepare the binary package for openjdk (edit the wanted slot)ː

Now you should have a built binary package, which we can convert into bootstrap tarball, using the following scriptː

And then run this script over the generated tarball (fix the version values)ː

Uploading and Enabling

 * 1) Upload the tarball. Currently the ebuild code is planned to download from arthurzam's devspace, but maybe we can improve it in future.
 * 2) You should add an global variable for your new tarball version. You should use   format for it.
 * 3) Insert the tarball to   using a call to the   function (which is a nice exercise in bash environment conditional expansion).

Now is the hard part, keywording and masking. You want to keyword the ebuild for the arch, but mask it for all profiles under the arch which aren't supported. Then unmask for supported profiles and unforce  USE flag. Look at existing examples in tree to see examples for it. I very recommend to create a separate branch and open a PR, and call for another dev to review it, and also run CI over it. It is very easy to breakǃ