Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a temurin-build build arg --use-adoptium-devkit <devkit_tag> #3706

Merged
merged 36 commits into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
e23e778
Add new build arg option to specify an existing folder for openjdk bu…
andrew-m-leonard Mar 11, 2024
dde1091
Add new build arg option to specify an existing folder for openjdk bu…
andrew-m-leonard Mar 11, 2024
e8deae1
Add new build arg option to specify an existing folder for openjdk bu…
andrew-m-leonard Mar 11, 2024
1fc6523
Add new build arg option to specify an existing folder for openjdk bu…
andrew-m-leonard Mar 11, 2024
04c823d
Add new build arg option to specify an existing folder for openjdk bu…
andrew-m-leonard Mar 11, 2024
b22db06
Add new build arg option to specify an existing folder for openjdk bu…
andrew-m-leonard Mar 12, 2024
c61eb07
Add new build arg option to specify an existing folder for openjdk bu…
andrew-m-leonard Mar 12, 2024
df71404
Merge branch 'master' of github.com:adoptium/temurin-build into build…
andrew-m-leonard Mar 12, 2024
c991ba2
Add new build arg option to specify an existing folder for openjdk bu…
andrew-m-leonard Mar 12, 2024
f27b41a
Merge branch 'master' of github.com:adoptium/temurin-build into build…
andrew-m-leonard Mar 14, 2024
05b10c1
Build using a linux devkit
andrew-m-leonard Mar 14, 2024
be12780
Build using a linux devkit
andrew-m-leonard Mar 14, 2024
22a462e
Build using a linux devkit
andrew-m-leonard Mar 14, 2024
e67607c
Build using a linux devkit
andrew-m-leonard Mar 14, 2024
c1f5608
Build using a linux devkit
andrew-m-leonard Mar 14, 2024
5cc48e2
Build using a linux devkit
andrew-m-leonard Mar 14, 2024
0da30fc
Build using a linux devkit
andrew-m-leonard Mar 14, 2024
b318266
Build using a linux devkit
andrew-m-leonard Mar 14, 2024
c2b8222
Build using a linux devkit
andrew-m-leonard Mar 14, 2024
da7a561
Build using a linux devkit
andrew-m-leonard Mar 14, 2024
655bdbe
Build using a linux devkit
andrew-m-leonard Mar 14, 2024
e32f296
Build using a linux devkit
andrew-m-leonard Mar 14, 2024
de00b87
Build using a linux devkit
andrew-m-leonard Mar 14, 2024
e771547
Build using a linux devkit
andrew-m-leonard Mar 14, 2024
475a4f5
Build using a linux devkit
andrew-m-leonard Mar 14, 2024
147b4b2
Reproducible jdk21u linux build fixes and updates for debug symbols
andrew-m-leonard Mar 15, 2024
84f75ec
use devkit
andrew-m-leonard Mar 20, 2024
532e5d1
Merge branch 'master' of github.com:adoptium/temurin-build into use_d…
andrew-m-leonard Mar 21, 2024
2b8a97a
Merge branch 'master' into use_devkit
karianna Mar 24, 2024
8a42206
Merge branch 'master' of github.com:adoptium/temurin-build into use_d…
andrew-m-leonard Mar 25, 2024
336feef
Use a linux devkit
andrew-m-leonard Mar 25, 2024
48e57f9
Merge remote-tracking branch 'andrewleonard/use_devkit' into use_devkit
andrew-m-leonard Mar 25, 2024
f89014b
Merge branch 'master' of github.com:adoptium/temurin-build into use_d…
andrew-m-leonard Mar 27, 2024
3a38468
Update sbin/prepareWorkspace.sh
andrew-m-leonard Mar 28, 2024
41fddc8
Update sbin/prepareWorkspace.sh
andrew-m-leonard Mar 28, 2024
ea4b8e1
Update README.md
andrew-m-leonard Mar 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,11 @@ For reference, OpenJDK version numbers look like 1.8.0_162-b12 (for Java 8) or
(162) or the 3rd position in the semVer version string (4).
This is typically used in conjunction with -b.

--use-adoptium-devkit <Adoptium DevKit release tag>
Download and use the given DevKit from https://github.com/adoptium/devkit-binaries/releases.
The DevKit is downloaded and unpacked to WORKSPACE_DIR/WORKING_DIR/devkit
and will add the configure arg --with-devkit=WORKSPACE_DIR/WORKING_DIR/devkit.

--use-jep319-certs
Use certs defined in JEP319 in Java 8/9. Deprecated, has no effect.

Expand Down
2 changes: 2 additions & 0 deletions build-farm/platform-specific-configurations/linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,8 @@ fi

if [[ "${CONFIGURE_ARGS}" =~ .*"--with-devkit=".* ]]; then
echo "Using gcc from DevKit toolchain specified in configure args"
elif [[ "${BUILD_ARGS}" =~ .*"--use-adoptium-devkit".* ]]; then
echo "Using gcc from Adoptium DevKit toolchain specified in --use-adoptium-devkit build args"
else
if [ "${VARIANT}" == "${BUILD_VARIANT_DRAGONWELL}" ] && [ "$JAVA_FEATURE_VERSION" -eq 11 ] && [ -r /usr/local/gcc9/ ] && [ "${ARCHITECTURE}" == "aarch64" ]; then
# GCC9 rather than 10 requested by Alibaba for now
Expand Down
8 changes: 8 additions & 0 deletions sbin/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,13 @@ addConfigureArgIfValueIsNotEmpty() {
fi
}

# Configure the DevKit if required
configureDevKitConfigureParameter() {
if [[ -n "${BUILD_CONFIG[USE_ADOPTIUM_DEVKIT]}" ]]; then
addConfigureArg "--with-devkit=" "${BUILD_CONFIG[WORKSPACE_DIR]}/${BUILD_CONFIG[WORKING_DIR]}/devkit"
fi
}

# Configure the boot JDK
configureBootJDKConfigureParameter() {
addConfigureArgIfValueIsNotEmpty "--with-boot-jdk=" "${BUILD_CONFIG[JDK_BOOT_DIR]}"
Expand Down Expand Up @@ -536,6 +543,7 @@ configureZlibLocation() {
configureCommandParameters() {
configureVersionStringParameter
configureBootJDKConfigureParameter
configureDevKitConfigureParameter
configureShenandoahBuildParameter
configureMacOSCodesignParameter
configureDebugParameters
Expand Down
8 changes: 8 additions & 0 deletions sbin/common/config_init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ TARGET_DIR
TARGET_FILE_NAME
TMP_CONTAINER_NAME
TMP_SPACE_BUILD
USE_ADOPTIUM_DEVKIT
USE_DOCKER
USE_JEP319_CERTS
USE_SSH
Expand All @@ -122,6 +123,7 @@ WORKSPACE_DIR
# <WORKSPACE_DIR>/config Configuration /openjdk/config $(pwd)/workspace/config
# <WORKSPACE_DIR>/<WORKING_DIR> Build area /openjdk/build $(pwd)/workspace/build/
# <WORKSPACE_DIR>/<WORKING_DIR>/<OPENJDK_SOURCE_DIR> Source code /openjdk/build/src $(pwd)/workspace/build/src
# <WORKSPACE_DIR>/<WORKING_DIR>/devkit DevKit download /openjdk/build/devkit $(pwd)/workspace/build/devkit
# <WORKSPACE_DIR>/target Destination of built artifacts /openjdk/target $(pwd)/workspace/target

# Helper code to perform index lookups by name
Expand Down Expand Up @@ -356,6 +358,9 @@ function parseConfigurationArguments() {
"--use-jep319-certs" )
BUILD_CONFIG[USE_JEP319_CERTS]=true;;

"--use-adoptium-devkit")
BUILD_CONFIG[USE_ADOPTIUM_DEVKIT]="$1"; shift;;

"--user-openjdk-build-root-directory" )
BUILD_CONFIG[USER_OPENJDK_BUILD_ROOT_DIRECTORY]="$1"; shift;;

Expand Down Expand Up @@ -600,6 +605,9 @@ function configDefaults() {

BUILD_CONFIG[CLEAN_LIBS]=false

# Default to no Adoptium DevKit
BUILD_CONFIG[USE_ADOPTIUM_DEVKIT]=""

# By default dont backport JEP318 certs to < Java 10
BUILD_CONFIG[USE_JEP319_CERTS]=false

Expand Down
77 changes: 63 additions & 14 deletions sbin/prepareWorkspace.sh
Original file line number Diff line number Diff line change
Expand Up @@ -330,21 +330,8 @@ checkingAndDownloadingAlsa() {
curl -o "alsa-lib.tar.bz2" "$ALSA_BUILD_URL"
curl -o "alsa-lib.tar.bz2.sig" "https://www.alsa-project.org/files/pub/lib/alsa-lib-${ALSA_LIB_VERSION}.tar.bz2.sig"

## This affects riscv64 & Alpine docker images and also evaluation pipelines
if ( [ -r /etc/alpine-release ] && [ "$(pwd | wc -c)" -gt 83 ] ) || \
( [ "${BUILD_CONFIG[OS_KERNEL_NAME]}" == "linux" ] && [ "${BUILD_CONFIG[OS_ARCHITECTURE]}" == "riscv64" ] && [ "$(pwd | wc -c)" -gt 83 ] ); then
# Use /tmp in preference to $HOME as fails gpg operation if PWD > 83 characters
# Also cannot create ~/.gpg-temp within a docker context
GNUPGHOME="$(mktemp -d /tmp/.gpg-temp.XXXXXX)"
else
GNUPGHOME="${BUILD_CONFIG[WORKSPACE_DIR]:-$PWD}/.gpg-temp"
fi
if [ ! -d "$GNUPGHOME" ]; then
mkdir -m 700 "$GNUPGHOME"
fi
export GNUPGHOME
setupGpg

echo "GNUPGHOME=$GNUPGHOME"
# Should we clear this directory up after checking?
# Would this risk removing anyone's existing dir with that name?
# Erring on the side of caution for now
Expand Down Expand Up @@ -577,6 +564,67 @@ prepareMozillaCacerts() {
fi
}

# Create and setup GNUPGHOME
setupGpg() {
## This affects riscv64 & Alpine docker images and also evaluation pipelines
if ( [ -r /etc/alpine-release ] && [ "$(pwd | wc -c)" -gt 83 ] ) || \
( [ "${BUILD_CONFIG[OS_KERNEL_NAME]}" == "linux" ] && [ "${BUILD_CONFIG[OS_ARCHITECTURE]}" == "riscv64" ] && [ "$(pwd | wc -c)" -gt 83 ] ); then
# Use /tmp in preference to $HOME as fails gpg operation if PWD > 83 characters
# Also cannot create ~/.gpg-temp within a docker context
GNUPGHOME="$(mktemp -d /tmp/.gpg-temp.XXXXXX)"
else
GNUPGHOME="${BUILD_CONFIG[WORKSPACE_DIR]:-$PWD}/.gpg-temp"
fi
if [ ! -d "$GNUPGHOME" ]; then
mkdir -m 700 "$GNUPGHOME"
fi
export GNUPGHOME

echo "GNUPGHOME=$GNUPGHOME"
}

# Download the required DevKit if necessary
downloadDevkit() {
if [[ -n "${BUILD_CONFIG[USE_ADOPTIUM_DEVKIT]}" ]]; then
rm -rf "${BUILD_CONFIG[WORKSPACE_DIR]}/${BUILD_CONFIG[WORKING_DIR]}/devkit"
mkdir -p "${BUILD_CONFIG[WORKSPACE_DIR]}/${BUILD_CONFIG[WORKING_DIR]}/devkit"

local devkit_tar="${BUILD_CONFIG[WORKSPACE_DIR]}/${BUILD_CONFIG[WORKING_DIR]}/devkit/devkit.tar.xz"

setupGpg

# Determine DevKit tarball to download for this arch and release
local devkitUrl="https://github.com/adoptium/devkit-binaries/releases/download/${BUILD_CONFIG[USE_ADOPTIUM_DEVKIT]}"
local devkit_target="${BUILD_CONFIG[OS_ARCHITECTURE]}-linux-gnu"
local devkit="devkit-${BUILD_CONFIG[USE_ADOPTIUM_DEVKIT]}-${devkit_target}"

# Download tarball and GPG sig
echo "Downloading DevKit : ${devkitUrl}/${devkit}.tar.xz"
curl -L --fail --silent --show-error -o "${devkit_tar}" "${devkitUrl}/${devkit}.tar.xz"
curl -L --fail --silent --show-error -o "${devkit_tar}.sig" "${devkitUrl}/${devkit}.tar.xz.sig"

# GPG verify
gpg --keyserver keyserver.ubuntu.com --recv-keys 3B04D753C9050D9A5D343F39843C48A565F8F04B
echo -e "5\ny\n" | gpg --batch --command-fd 0 --expert --edit-key 3B04D753C9050D9A5D343F39843C48A565F8F04B trust;
gpg --verify "${devkit_tar}.sig" "${devkit_tar}" || exit 1

tar xpJf "${devkit_tar}" -C "${BUILD_CONFIG[WORKSPACE_DIR]}/${BUILD_CONFIG[WORKING_DIR]}/devkit"
rm "${devkit_tar}"
rm "${devkit_tar}.sig"

# Validate devkit.info matches value passed in and current architecture
local devkitInfo="${BUILD_CONFIG[WORKSPACE_DIR]}/${BUILD_CONFIG[WORKING_DIR]}/devkit/devkit.info"
if ! grep "ADOPTIUM_DEVKIT_RELEASE=${BUILD_CONFIG[USE_ADOPTIUM_DEVKIT]}" "${devkitInfo}" || ! grep "ADOPTIUM_DEVKIT_TARGET=${devkit_target}" "${devkitInfo}"; then
echo "ERROR: Devkit does not match required release and architecture:"
echo " Required: ADOPTIUM_DEVKIT_RELEASE=${BUILD_CONFIG[USE_ADOPTIUM_DEVKIT]}"
echo " Downloaded: $(grep ADOPTIUM_DEVKIT_RELEASE= "${devkitInfo}")"
echo " Required: ADOPTIUM_DEVKIT_TARGET=${devkit_target}"
echo " Downloaded: $(grep ADOPTIUM_DEVKIT_TARGET= "${devkitInfo}")"
exit 1
fi
fi
}

# Download all of the dependencies for OpenJDK (Alsa, FreeType etc.)
downloadingRequiredDependencies() {
if [[ "${BUILD_CONFIG[CLEAN_LIBS]}" == "true" ]]; then
Expand Down Expand Up @@ -695,6 +743,7 @@ function configureWorkspace() {
if [[ "${BUILD_CONFIG[ASSEMBLE_EXPLODED_IMAGE]}" != "true" ]]; then
createWorkspace
downloadingRequiredDependencies
downloadDevkit
relocateToTmpIfNeeded
checkoutAndCloneOpenJDKGitRepo
applyPatches
Expand Down
Loading