### Background (from JBS)

The devkit creation makefiles under make/devkit have been more or less 
untouched since they were first introduced. While they have served us well 
there are some key challenges which are slowly becoming more urgent to address.

One such issue relates to the logic for creating the sysroot. Currently, it is 
implemented using wget with a set of pattern to download packages directly from 
the upstream yum repo. One problem with this is that it will download all 
packages which happen to match the pattern, no matter if those packages are 
actually needed or not. More problematically though, using wget like this does 
not (necessarily) work for more recent linux distribution versions/repositories.

The dnf tool is the native solution for downloading packages, including 
dependencies etc.

The sysroot logic could also benefit from being split out into its own file, 
making the fairly involved Tools.gmk slightly less complex.

A secondary goal of this cleanup is to make it possible to reuse the logic 
(especially the sysroot logic) for creating devkit equivalents for building 
project Detroit.

### About the change

The goal of this change was, initially, to change the sysroot logic to use dnf. 
In making the required changes I relatively quickly I realized that the 
Tools.gmk file was long overdue for cleanup. I chose to split out the sysroot 
logic to a separate file but couldn't resist making some fairly significant, 
(_mostly_) cosmetic changes to Tools.gmk while at it, moving it closer to the 
general style of the JDK build system. That said, a lot of the logic in 
Tools.gmk remains "old-style" even after this change.

Some specific things worth highlighting:

- I've tried to adjust formatting to closer match the JDK build system style, 
but I'm sure there are places/cases where it's off.
- I updated versions and URLs to reflect the latest reality, and adjusted the 
documentation in Makefile accordingly.
- To avoid having to call the Sysroot.gmk file twice (first to download 
packages and then to create the actual sysroot) I updated the logic to not 
depend on parse time globing. Specifically, what used to be `RPM_FILE_LIST` is 
now handled in the recipe instead.
- I fixed some missing dependencies which were most likely not actual problems, 
unless running with parallelism (which is not needed - Tools.gmk sets BUILDPAR 
where relevant). Even with these fixes parallelism is unlikely to work well.
- I dropped some packages which no longer exist (assuming they did in the first 
place, many years ago). Specifying invalid/non-existent packages to wget would 
just result in no packages being downloaded. With dnf it's a hard failure, 
which I argue is a good thing.
- I dropped the ffi header links - AFAICT that is no longer a problem in any of 
the distributions/versions we use.
- I added `--disable-libgomp` for GCC. I see that others have run into the same 
issue and I have no reason to believe it's needed for the JDK.
- I also added `--disable-libsanitizer` for riscv64 to work around a GCC issue. 
If somebody else things it's important and wants to have a look I'd appreciate 
the help.

### Testing

I generated devkits for aarch64, x64 (OL) and armhfp, ppc64le, riscv64, s390x 
(Fedora). I then used those devkits to build the (mainline) JDK. All worked 
with two exceptions:

- I ran into a build problem with armhfp but AFAICT it is pre-existing, 
unrelated to my changes. As a matter of fact, I was unable to build the armhfp 
devkit using the mainline devkit version (without my changes)
- On the same general note, the mainline version is broken for riscv64 (the 
repo URL is dead). I located an alternative version which works.

I will want to do additional testing but would appreciate a review or two 
first. TYIA!

---------
- [x] I confirm that I make this contribution in accordance with the [OpenJDK 
Interim AI Policy](https://openjdk.org/legal/ai).

-------------

Commit messages:
 - 8385552: Improve devkit/sysroot creation

Changes: https://git.openjdk.org/jdk/pull/31303/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=31303&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8385552
  Stats: 652 lines in 5 files changed: 325 ins; 190 del; 137 mod
  Patch: https://git.openjdk.org/jdk/pull/31303.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/31303/head:pull/31303

PR: https://git.openjdk.org/jdk/pull/31303

Reply via email to