adoptium / installer

Installer scripts for Eclipse Temurin binaries
Apache License 2.0
148 stars 74 forks source link

Mac Installer to include Mac OS X Java Tools support #3

Closed karianna closed 5 years ago

karianna commented 6 years ago

See https://github.com/AdoptOpenJDK/openjdk-build/issues/321 for the history

lenborje commented 6 years ago

(I've entered the very same comment in the referenced thread. Copied here for convenience.)

I don't know if I point out something everybody already knows, but anyway...

When I build the JDK on my Mac, make images builds the requisite MacOS-friendly directory tree under build/macosx-x86_64-normal-server-release/images/jdk-bundle/jdk-11.jdk/, in addition to the "standard linux tree" under build/macosx-x86_64-normal-server-release/images/jdk/:

$ tree -L 3 build/macosx-x86_64-normal-server-release/images/jdk-bundle/jdk-11.jdk
build/macosx-x86_64-normal-server-release/images/jdk-bundle/jdk-11.jdk
└── Contents
    ├── Home
    │   ├── bin
    │   ├── conf
    │   ├── demo
    │   ├── include
    │   ├── jmods
    │   ├── legal
    │   ├── lib
    │   ├── man
    │   └── release
    ├── Info.plist
    └── MacOS
        └── libjli.dylib -> ../Home/lib/jli/libjli.dylib
$ tree -L 1 build/macosx-x86_64-normal-server-release/images/jdk
build/macosx-x86_64-normal-server-release/images/jdk
├── bin
├── conf
├── demo
├── include
├── jmods
├── legal
├── lib
├── man
└── release

So it seems to that a "correct" MacOS installation archive could be created by simply selecting the jdk-bundle sub-directory when creating it.

lenborje commented 6 years ago

A trivial command example which builds an unsigned PKG installer from the jdk-bundle:

$ pkgbuild --root build/macosx-x86_64-normal-server-release/images/jdk-bundle/jdk-11.jdk --install-location /Library/Java/JavaVirtualMachines/jdk-11.jdk --identifier net.adoptopenjdk.openjdk --version 11.0.0 build/macosx-x86_64-normal-server-release/OpenJDK-11.pkg

A 'real' pkg should of course be correctly signed, probably have another identifier, etc etc.

gdams commented 6 years ago

@lenborje this looks really interesting, let's try and jump on a call sometime and investigate this further.

rubin55 commented 6 years ago

Is there any progress on this? I would like to transition to AdoptOpenJDK for my Development needs since coming 25th will be a new world for Java development in general (Java 11 becomes stable, anything prior to that is now not publicly supported anymore so I don't want to run an Oracle JVM -> what are my options -> AdoptOpenJDK).

This issue is surprisingly blocking to a macos user :-)

karianna commented 6 years ago

@rubin55 A volunteer will have to pick this up - the core team is still working on some cross platform infra and build issues.

lenborje commented 6 years ago

What is needed? As I’ve shown above, it is trivial to create an unsigned installer pkg. I have zero knowledge of how the build infrastructure is set up, so I do not know what is missing there. You would need an active Apple Developer account to sign the package, but apart from that, I guess it would only require an additional one-liner statement in a build script.

rubin55 commented 6 years ago

For those who want to run the currently provided AdoptOpenJDK as downloadable at https://adoptopenjdk.net/ , Here are some pointers. The below is tested with the current latest OpenJDK with HotSpot, version 1.8.0 r172 for MacOS:

Make sure you have root privileges:

  1. First make sure you don't currently have a JDK 8 at /Library/Java/JavaVirtualMachines/1.8.0.jdk
  2. Download OpenJDK8_x64_Mac_jdk8u172-b11.tar.gz
  3. Download my hand-crafted Info.plist.zip
  4. Create directory: mkdir -p /Library/Java/JavaVirtualMachines/1.8.0.jdk/Contents/MacOS
  5. Enter directory: cd /Library/Java/JavaVirtualMachines/1.8.0.jdk/Contents
  6. Unpack the archive: tar xzf /full/path/to/downloaded/OpenJDK8_x64_Mac_jdk8u172-b11.tar.gz
  7. Rename the directory: mv jdk8u172-b11 Home
  8. Unpack the Info.plist: unzip /full/path/to/downloaded/Info.plist Info.plist
  9. Enter directory: cd MacOS
  10. Link JNI library: ln -s ../Home/jre/lib/jli/libjli.dylib A. Check if AdoptOpenJDK shows up: /usr/libexec/java_home -V B. Start another (non-root) terminal, run: export JAVA_HOME=$(/usr/libexec/java_home -v 1.8) C. After that, verify the running Java version: java -version

The above was tested with various Java command line tools, like maven, javac. Additionally, I've tested various Java graphical applications, like Eclipse and MuleSoft Anypoint Studio.

karianna commented 6 years ago

@lenborje We have an Apple developer account and we do sign the existing Mac binaries. Are you a member on our #build channel in slack?

lenborje commented 6 years ago

No, I’m not. What’s the URL?

karianna commented 6 years ago

@lenborje https://www.adoptopenjdk.net/slack.html

korzha commented 5 years ago

Thanks @rubin55 !

Today I decided to migrate to AdoptOpenJDK on my mac from OracleJDK because of recent news. I installed it with homebrew but everything went broken since /usr/libexec doesnt recognize it.

So I wrote a small script to install latest AdoptOpenJDK 10 on macos following @rubin55 's instructions. Now everything works as before. Hope that helps others as well.

breun commented 5 years ago

I'm the maintainer of the OpenJDK ports in MacPorts. I'm currently using Oracle's OpenJDK builds, but I'm considering AdoptOpenJDK's builds.

I think it would be great if the AdoptOpenJDK releases for macOS would be ready to go when unpacked under /Library/Java/JavaVirtualMachines, just like the Oracle OpenJDK builds, because otherwise MacPorts would have to duplicate the stuff the installer does in order to construct the directory structure expected by these macOS tools.

gdams commented 5 years ago

Hi all I am currently working on getting these brew recipes to install to /Library/Java/JavaVirtualMachines. The main issue right now is that brew doesn't seem to be able to run with sudo which is needed to create folders in that directory. It appears that brew casks might be able to do this but I'm still against using casks as that's designed for installing applications into /Applications

karianna commented 5 years ago

I think we might have to bite the bullet and go with cask... We can follow the similar recipe other OpenJDK and Oracle JDK casks

breun commented 5 years ago

Ah, I see that the AdoptOpenJDK binaries for macOS now use the directory layout expected by macOS tools: https://blog.adoptopenjdk.net/2018/10/macos-binary-changes

karianna commented 5 years ago

Yes, we're pushing out one last release and then we'll update the homebrew tap's here and the casks at homebrew-core (and deprecate our tap versions in due course).

gdams commented 5 years ago

closing as the installers now work with this