This repo contains all the necessary scripts and tools to build Mandrel.
JAVA_HOME=/opt/jvms/openjdk-11.0.8+4/ MX_HOME=~/code/mx MANDREL_REPO=~/code/mandrel MANDREL_HOME=./mandrelJDK ./buildJDK.sh
where:
JAVA_HOME
is the path to the OpenJDK you want to use for building mandrel. Defaults to/opt/jdk
.MX_HOME
is the path where you cloned https://github.com/graalvm/mx. Defaults to/opt/mx
.MANDREL_REPO
is the path where you cloned https://github.com/graalvm/mandrel. Defaults to/tmp/mandrel
.MANDREL_HOME
is the path where you want mandrel to be installed, after completion you will be able to use this asJAVA_HOME
or/andGRAALVM_HOME
in your projects (e.g. quarkus). Defaults to/opt/mandrelJDK
You can also add VERBOSE=true
to see the commands run by the script and MANDREL_VERSION
to define the version to be shown when running native-image --version
(e.g. 20.1.0). Defaults to the result of git describe
in MANDREL_REPO
.
- docker or podman or root access to a Fedora/CentOS/RHEL VM
- ansible
TLDR:
git clone https://github.com/mandrel/mandrel-packaging
cd mandrel-packaging
make
By default make
:
- Creates a docker image named
mandrel-packaging
- Starts the newly created image
The Makefile
includes two targets:
build-image
is used to create themandrel-packaging
docker imagerun-image
is used to start themandrel-packaging
image
These two targets can be further customized through the following environment variables:
DOCKER
defines the command to be used instead ofdocker
, e.g.podman
(defaults todocker
)IMAGE_NAME
defines the name of the docker image (defaults tomandrel-packaging
)BOOT_CONTAINER
defines the name of the container used to bootstrap the image inmake build-image
(defaults to$(IMAGE_NAME)-boot
)PLAYBOOK
defines the ansible playbook to be used bymake build-image
to setup the image (defaults toansible/playbook.yml
)PLAYBOOK_CONF
defines the configuration to be used by the ansible playbook (defaults tomandrel20.1-openjdk
)DOCKER_RUN_OPTIONS
defines additional options to be passed todocker run
throughmake run-image
(by default it's empty)AT
defines whether commands executed bymake
will be printed out or not (defaults to@
, i.e suppress output), set to empty to show commands
When trying out changes in different parts of mandrel we want a fast way to test them out in the mandrel-packaging
image.
To achieve this we can use docker volumes.
To use a local copy of mandrel source code:
export DOCKER_RUN_OPTIONS="-v path/to/mandrel/repo:/tmp/mandrel:Z ${DOCKER_RUN_OPTIONS}"
make run-image
To use a local copy of mx:
export DOCKER_RUN_OPTIONS="-v path/to/mx/repo:/opt/mx:Z ${DOCKER_RUN_OPTIONS}"
make run-image
To use a different JDK:
export DOCKER_RUN_OPTIONS="-v path/to/jdk:/opt/jdk:Z ${DOCKER_RUN_OPTIONS}"
make run-image
To use a local copy of mandrel-packaging scripts:
export DOCKER_RUN_OPTIONS="-v $pwd:/root:Z ${DOCKER_RUN_OPTIONS}"
make run-image
To use the local m2 repository:
export DOCKER_RUN_OPTIONS="-v $HOME/.m2:/root/.m2:Z ${DOCKER_RUN_OPTIONS}"
make run-image
To use the local mx cache:
export DOCKER_RUN_OPTIONS="-v $HOME/.mx:/root/.mx:Z ${DOCKER_RUN_OPTIONS}"
make run-image
To avoid building everything from scratch when editing the ansible playbook make refresh-image
can be used.
This will:
- Start a container named
mandrel-packaging-boot
from themandrel-packaging
image - Run the ansible playbook on
mandrel-packaging-boot
- Commit the changes to the
mandrel-packaging
image - Stop and remove the
mandrel-packaging-boot
container
Instead of using containers it's also possible to use Fedora/CentOS/RHEL VMs using:
ansible-playbook -i root@example.com, ansible/playbook.yml
The ansible playbook supports different configurations (found under ansible/configurations
).
To use a different configuration than the default (e.g. mandrel20.1-labsjdk
) issue:
ansible-playbook -i root@example.com, ansible/playbook.yml -e configuration=mandrel20.1-labsjdk
To create a new configuration just copy an existing one and edit the values to your needs.