graalvm / mandrel-packaging

6 stars 8 forks source link
hacktoberfest mandrel

Mandrel Packaging

This repo contains all the necessary scripts and tools to build Mandrel.

Building mandrelJDK locally

export JAVA_HOME=/opt/jvms/openjdk-11.0.8_10
$JAVA_HOME/bin/java -ea build.java --mx-home ~/code/mx --mandrel-repo ~/code/mandrel

where:

This should print something similar to:

INFO [build] Building!
build: Checking SubstrateVM requirements for building ...
build: Checking SubstrateVM requirements for building ...
build: Checking SubstrateVM requirements for building ...
build: Checking SubstrateVM requirements for building ...
INFO [build] Creating JDK!
INFO [build] Congratulations you successfully built Mandrel 20.1.0.1.Final-3-g9abceb5ac7d based on Java 11.0.8+10
INFO [build] You can find your newly built native-image enabled JDK under ./mandrel-java11-20.1.0.1.Final-3-g9abceb5ac7d

More options

Generic

Mandrel related

Maven-related

Building mandrelJDK java parts separately from native parts

If your build infrastructure requires building java parts separately from native parts you can use the following steps.

Step 1: Build the java parts

$JAVA_HOME/bin/java -ea build.java --mx-home ~/code/mx --mandrel-repo ~/code/mandrel --mandrel-home /tmp/java_step --skip-native

Step 2: Build the java parts

/tmp/java_step/bin/java -ea build.java --mx-home ~/code/mx --mandrel-repo ~/code/mandrel --skip-java --skip-clean

After the last step you can delete the intermediate JDK with:

rm -rf /tmp/java_step

Building mandrelJDK on a Mac using a custom build of OpenJDK

Mandrel can be built on a Mac using a custom build of OpenJDK that contains static libraries.

If you want to base Mandrel on a custom JDK, it's important to build the JDK's macOS bundles first, and then extract them into a directory structure that mirrors pre-built JDKs. For example:

$ make bundles
$ cd build/<conf-name>/bundles
$ tar -xzvpf *_bin.tar.gz
$ tar -xzvpf *_bin-static-libs.tar.gz
$ ./<jdk-folder>/Contents/Home/bin/java --version
...
OpenJDK 64-Bit Server VM (...)

Mandrel should then be built setting JAVA_HOME to the macOS-specific java home directory. E.g.

export JAVA_HOME=<path-to-jdk-source>/build/<conf-name>/bundles/<jdk-folder>/Contents/Home
$JAVA_HOME/bin/java -ea build.java --mx-home ~/code/mx --mandrel-repo ~/code/mandrel