Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 767136

Summary: dev-java/ant-core-1.10.9: Is it possible to depend on either jdk 8 or jdk 11 ?
Product: Gentoo Linux Reporter: Klaus Kusche <klaus.kusche>
Component: Current packagesAssignee: Java team <java>
Status: UNCONFIRMED ---    
Severity: normal CC: ionen
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 805008    
Attachments: hacky ebuild to build on JDK 11 for amd64

Description Klaus Kusche 2021-01-25 08:31:44 UTC
The only piece of software depending on java in my system is libreoffice.
Libreoffice requires *two* versions of jdk:
- Libreoffice itself depends on jdk 11
- Libreoffice depends on ant, which depends on jdk 8

No other jdk or jre dependencies on my system.
So two huge jdk's get installed just for libreoffice.

Can't ant also use jdk 11?
I was unable to find any definite answer about that question on the internet,
and I don't know arch linux and arch packages in detail,
but I think their ant depends on either jdk 8 or jdk 11?
Comment 1 onkobu 2021-08-18 19:39:37 UTC
In an act of desparation I managed to bump ant-core to 1.10.11 and DEPEND on >=virtual/jdk-11

1. unmask virtual/jdk11, ~amd64 as well as /etc/portage/package.unmask
2. emerge virtual/jdk11, it will be slotted next to virtual/jdk-1.8 (I assume openjdk-11 or openjdk-bin-11 is already installed otherwise I expect it to be installed)
3. do the magic with USE flag gentoo-vm from Bug805008 (gentoo-vm is still masked)
4. have a local ebuild (attached)
5. emerge ant-core
6. run ant -diagnostics

I am uncertain whether eselect java-vm in #3 is necessary for the ebuild of 4. I learned the hard way that there is a python-helper depend-java-query that determines JVM based on DEPEND and RDEPEND. This helper seems to work only with virtual packages. I had no success directly using openjdk nor openjdk-bin in DEPEND and REDEPEND.

Since I'm absolutely new to writing ebuild I also simply removed all the other architectures since repoman complained about architecture things like sparc stuff (repoman --digest=y -d full from https://wiki.gentoo.org/wiki/Custom_ebuild_repository#Simple_version_bump_of_an_ebuild_in_the_local_repository)

I also dropped removal of JDK9+ stuff.

Finally there seems to be two TAR balls, one with the source and another layered on top with patches. The latter is also referenced through the version number. Since I didn't bother setting up something on Codeberg/ Github I simply hard coded it to the previous version. I didn't change anything other than that and it worked out.

Would be great if somebody could assist getting the ebuild straight and this is all blocked by masked virtual/jdk-11. I couldn't find a bug tracking this. Neither is there a roadmap linked anywhere in the Wiki.
Comment 2 onkobu 2021-08-18 19:40:49 UTC
Created attachment 733957 [details]
hacky ebuild to build on JDK 11 for amd64