Skip to content
Closed
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,17 +160,20 @@ disable the default fB--depth=1 shallow cloning of git repo(s).

-f, --freetype-dir
specify the location of an existing FreeType library.
This is typically used in conjunction with -F.
Do not use with -F, as it would invalidate this switch.
DEPRECATED: Only makes sense for JDKs without a bundled freetype

--freetype-build-param <parameter>
specify any special freetype build parameters (required for some Operating Systems).
DEPRECATED: Only makes sense for JDKs without a bundled freetype

--freetype-version <version>
specify the version of freetype you are building.
DEPRECATED: Only makes sense for JDKs without a bundled freetype

-F, --skip-freetype
skip building Freetype automatically.
This is typically used in conjunction with -f.
set JDK to link against system freetype,
instead of building bundled version

-h, --help
print the man page.
Expand Down
7 changes: 0 additions & 7 deletions build-farm/platform-specific-configurations/aix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,6 @@ then
export CONFIGURE_ARGS_FOR_ANY_PLATFORM="${CONFIGURE_ARGS_FOR_ANY_PLATFORM} --with-extra-ldflags=-lpthread --with-extra-cflags=-lpthread --with-extra-cxxflags=-lpthread"
fi

if [[ "$JAVA_FEATURE_VERSION" -ge 21 ]]; then
# jdk-21+ uses "bundled" FreeType
export BUILD_ARGS="${BUILD_ARGS} --freetype-dir bundled"
else
export BUILD_ARGS="${BUILD_ARGS} --skip-freetype"
fi

if [ "${VARIANT}" == "${BUILD_VARIANT_OPENJ9}" ]; then
export LDR_CNTRL=MAXDATA=0x80000000
fi
Expand Down
8 changes: 0 additions & 8 deletions build-farm/platform-specific-configurations/alpine-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,6 @@ fi
# ccache seems flaky on alpine
export CONFIGURE_ARGS_FOR_ANY_PLATFORM="${CONFIGURE_ARGS_FOR_ANY_PLATFORM} --disable-ccache"

if [[ "$JAVA_FEATURE_VERSION" -ge 21 ]]; then
# jdk-21+ uses "bundled" FreeType
export BUILD_ARGS="${BUILD_ARGS} --freetype-dir bundled"
else
# We don't bundle freetype on alpine anymore, and expect the user to have it.
export BUILD_ARGS="${BUILD_ARGS} --skip-freetype"
fi

## This affects Alpine docker images and also evaluation pipelines
if [ "$(pwd | wc -c)" -gt 83 ]; then
# Use /tmp for alpine in preference to $HOME as Alpine fails gpg operation if PWD > 83 characters
Expand Down
8 changes: 0 additions & 8 deletions build-farm/platform-specific-configurations/linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,6 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "$SCRIPT_DIR/../../sbin/common/constants.sh"
source "$SCRIPT_DIR/../../sbin/common/downloaders.sh"

if [[ "$JAVA_FEATURE_VERSION" -ge 21 ]]; then
# jdk-21+ uses "bundled" FreeType
export BUILD_ARGS="${BUILD_ARGS} --freetype-dir bundled"
else
# Bundling our own freetype can cause problems, so we skip that on linux.
export BUILD_ARGS="${BUILD_ARGS} --skip-freetype"
fi

## This affects Alpine docker images and also evaluation pipelines
if [ "$(pwd | wc -c)" -gt 83 ]; then
# Use /tmp for alpine in preference to $HOME as Alpine fails gpg operation if PWD > 83 characters
Expand Down
5 changes: 0 additions & 5 deletions build-farm/platform-specific-configurations/mac.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ then
fi
if [ "${VARIANT}" == "${BUILD_VARIANT_OPENJ9}" ]; then
export CONFIGURE_ARGS_FOR_ANY_PLATFORM="${CONFIGURE_ARGS_FOR_ANY_PLATFORM} --with-openssl=fetched --enable-openssl-bundling"
export BUILD_ARGS="${BUILD_ARGS} --skip-freetype"
fi
else
if [[ "$JAVA_FEATURE_VERSION" -ge 11 ]]; then
Expand Down Expand Up @@ -76,10 +75,6 @@ else
fi
fi

if [[ "$JAVA_FEATURE_VERSION" -ge 21 ]]; then
# jdk-21+ uses "bundled" FreeType
export BUILD_ARGS="${BUILD_ARGS} --freetype-dir bundled"
fi

# The configure option '--with-macosx-codesign-identity' is supported in JDK8 OpenJ9 and JDK11 and JDK14+
if [[ ( "$JAVA_FEATURE_VERSION" -eq 11 ) || ( "$JAVA_FEATURE_VERSION" -ge 14 ) ]]
Expand Down
2 changes: 1 addition & 1 deletion build-farm/platform-specific-configurations/solaris.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# shellcheck source=sbin/common/constants.sh
source "$SCRIPT_DIR/../../sbin/common/constants.sh"

export BUILD_ARGS="${BUILD_ARGS} --skip-freetype --make-args SHELL=/bin/bash"
export BUILD_ARGS="${BUILD_ARGS} --make-args SHELL=/bin/bash"

if [ "${ARCHITECTURE}" == "x64" ]; then
export CUPS="--with-cups=/opt/sfw/cups"
Expand Down
15 changes: 0 additions & 15 deletions build-farm/platform-specific-configurations/windows.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ then
export CONFIGURE_ARGS_FOR_ANY_PLATFORM="${CONFIGURE_ARGS_FOR_ANY_PLATFORM} --with-openssl=fetched --enable-openssl-bundling"
if [ "${JAVA_TO_BUILD}" == "${JDK8_VERSION}" ]
then
export BUILD_ARGS="${BUILD_ARGS} --skip-freetype"
# https://github.com/adoptium/temurin-build/issues/243
export INCLUDE="C:\Program Files\Debugging Tools for Windows (x64)\sdk\inc;$INCLUDE"
export PATH="/c/cygwin64/bin:/usr/bin:$PATH"
Expand All @@ -85,7 +84,6 @@ then
else
if [ "${JAVA_TO_BUILD}" == "${JDK8_VERSION}" ]
then
export BUILD_ARGS="${BUILD_ARGS} --freetype-version 2.5.3"
export PATH="/cygdrive/c/openjdk/make-3.82/:$PATH"
elif [ "${JAVA_TO_BUILD}" == "${JDK11_VERSION}" ]
then
Expand All @@ -112,19 +110,6 @@ then
then
export INCLUDE="C:\Program Files\Debugging Tools for Windows (x64)\sdk\inc;$INCLUDE"
export PATH="$PATH:/c/cygwin64/bin"
export BUILD_ARGS="${BUILD_ARGS} --skip-freetype"
elif [ "${JAVA_TO_BUILD}" == "${JDK9_VERSION}" ]
then
export BUILD_ARGS="${BUILD_ARGS} --freetype-version 2.5.3"
elif [ "${JAVA_TO_BUILD}" == "${JDK10_VERSION}" ]
then
export BUILD_ARGS="${BUILD_ARGS} --freetype-version 2.5.3"
elif [ "$JAVA_FEATURE_VERSION" -lt 19 ]
then
export BUILD_ARGS="${BUILD_ARGS} --skip-freetype"
elif [ "$JAVA_FEATURE_VERSION" -ge 19 ]
then
export BUILD_ARGS="${BUILD_ARGS} --skip-freetype"
fi

CUDA_VERSION=9.1
Expand Down
4 changes: 2 additions & 2 deletions cyclonedx-lib/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@
<arg value="--name"/>
<arg value="makejdk_any_platform_args"/>
<arg value="--value"/>
<arg value="--clean-git-repo --jdk-boot-dir /usr/lib/jvm/jdk-16 --configure-args --disable-warnings-as-errors --enable-ccache --enable-dtrace --target-file-name OpenJDK17-jdk_x64_linux_hotspot_17_35.tar.gz --release --clean-libs --tag jdk-17+35_adopt --skip-freetype --use-jep319-certs --create-debug-image --build-variant hotspot jdk17"/>
<arg value="--clean-git-repo --jdk-boot-dir /usr/lib/jvm/jdk-16 --configure-args --disable-warnings-as-errors --enable-ccache --enable-dtrace --target-file-name OpenJDK17-jdk_x64_linux_hotspot_17_35.tar.gz --release --clean-libs --tag jdk-17+35_adopt --use-jep319-certs --create-debug-image --build-variant hotspot jdk17"/>
<arg value="--jsonFile"/>
<arg value="${testSBOMFile}"/>
</java>
Expand Down Expand Up @@ -768,7 +768,7 @@
<arg value="--name"/>
<arg value="makejdk_any_platform_args"/>
<arg value="--value"/>
<arg value="--clean-git-repo --jdk-boot-dir /usr/lib/jvm/jdk-16 --configure-args --disable-warnings-as-errors --enable-ccache --enable-dtrace --target-file-name OpenJDK17-jdk_x64_linux_hotspot_17_35.tar.gz --release --clean-libs --tag jdk-17+35_adopt --skip-freetype --use-jep319-certs --create-debug-image --build-variant hotspot jdk17"/>
<arg value="--clean-git-repo --jdk-boot-dir /usr/lib/jvm/jdk-16 --configure-args --disable-warnings-as-errors --enable-ccache --enable-dtrace --target-file-name OpenJDK17-jdk_x64_linux_hotspot_17_35.tar.gz --release --clean-libs --tag jdk-17+35_adopt --use-jep319-certs --create-debug-image --build-variant hotspot jdk17"/>
<arg value="--xmlFile"/>
<arg value="${testSBOMFile_xml}"/>
</java>
Expand Down
9 changes: 6 additions & 3 deletions makejdk-any-platform.1
Original file line number Diff line number Diff line change
Expand Up @@ -115,17 +115,20 @@ disable the default \fB--depth=1\fR shallow cloning of git repo(s).
.TP
.BR \-f ", " \-\-freetype-dir " " \fI<path>\fR
specify the location of an existing FreeType library.
This is typically used in conjunction with \fB<-F>\fR.
Do not use with \fB<-F>\fR, as it would invalidate this switch.
DEPRECATED: Only makes sense for JDKs without a bundled freetype
.TP
.BR \-\-freetype-build-param " " \fI<parameter>\fR
specify any special freetype build parameters (required for some OS's).
DEPRECATED: Only makes sense for JDKs without a bundled freetype
.TP
.BR \-\-freetype-version " " \fI<version>\fR
specify the version of freetype you are building.
DEPRECATED: Only makes sense for JDKs without a bundled freetype
.TP
.BR \-F ", " \-\-skip-freetype
skip building Freetype automatically.
This is typically used in conjunction with \fB<-f>\fR.
set JDK to link against system freetype,
instead of building the bundled version
.TP
.BR \-h ", " \-\-help
print this help.
Expand Down
135 changes: 123 additions & 12 deletions sbin/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ configureDevKitConfigureParameter() {
addConfigureArg "--with-devkit=" "${BUILD_CONFIG[ADOPTIUM_DEVKIT_LOCATION]}"
fi
fi
}
}

# Configure the boot JDK
configureBootJDKConfigureParameter() {
Expand Down Expand Up @@ -253,6 +253,98 @@ patchFreetypeWindows() {
fi
}

# Returns the version numbers in version-numbers.conf as a space-seperated list of integers.
# e.g. 17 0 1 5
# or 8 0 0 432
# Build number will not be included, as that is not stored in this file.
versionNumbersFileParser() {
funcName="versionNumbersFileParser"
buildSrc="${BUILD_CONFIG[WORKSPACE_DIR]}/${BUILD_CONFIG[WORKING_DIR]}/${BUILD_CONFIG[OPENJDK_SOURCE_DIR]}"
jdkVersion="${BUILD_CONFIG[OPENJDK_FEATURE_NUMBER]}"

# Find version-numbers.conf (or equivalent) and confirm we can read it.
numbersFile="${buildSrc}/common/autoconf/version-numbers"
[ "$jdkVersion" -eq 11 ] && numbersFile="${buildSrc}/make/autoconf/version-numbers"
[ "$jdkVersion" -ge 17 ] && numbersFile="${buildSrc}/make/conf/version-numbers.conf"
[ ! -r "${numbersFile}" ] && echo "ERROR: build.sh: ${funcName}: JDK version file not found: ${numbersFile}" >&2 && exit 1

fileVersionString=""
error=""
if [ "$jdkVersion" -eq 8 ]; then
# jdk8 uses this format: jdk8u482-b01
fileVersionString="jdk8u$(grep "JDK_UPDATE_VERSION" "${numbersFile}" | head -1 | grep -Eo '[0-9]+')" || error="true"
[[ ! "${fileVersionString}" =~ ^jdk8u[0-9]+$ || $error ]] && echo "ERROR: build.sh: ${funcName}: version file could not be parsed." >&2 && exit 1
else
# File parsing logic for jdk11+.
patchNo="$(grep "DEFAULT_VERSION_PATCH" "${numbersFile}" | head -1 | grep -Eo '[0-9]+')" || error="true"
updateNo="$(grep "DEFAULT_VERSION_UPDATE" "${numbersFile}" | head -1 | grep -Eo '[0-9]+')" || error="true"
interimNo="$(grep "DEFAULT_VERSION_INTERIM" "${numbersFile}" | head -1 | grep -Eo '[0-9]+')" || error="true"
featureNo="$(grep "DEFAULT_VERSION_FEATURE" "${numbersFile}" | head -1 | grep -Eo '[0-9]+')" || error="true"

[[ ! "${patchNo}" =~ ^0$ ]] && fileVersionString=".${patchNo}"
[[ ! "${updateNo}.${fileVersionString}" =~ ^[0\.]+$ ]] && fileVersionString=".${updateNo}${fileVersionString}"
[[ ! "${interimNo}.${fileVersionString}" =~ ^[0\.]+$ ]] && fileVersionString=".${interimNo}${fileVersionString}"
fileVersionString="jdk-${featureNo}${fileVersionString}"

[[ ! "${fileVersionString}" =~ ^jdk\-[0-9]+[0-9\.]*$ || $error ]] && echo "ERROR: build.sh: ${funcName}: version file could not be parsed." >&2 && exit 1
fi

# Returning the formatted jdk version string.
echo "${fileVersionString}"
}

# This function attempts to compare the jdk version from version-numbers.conf with arg 1.
# We will then return whichever version is bigger/later.
# e.g. 17.0.1+32 > 17.0.0+64
# If any errors or unusual circumstances are detected, we simply return arg1 to avoid destabilising the build.
# Note: For error messages, use 'echo message >&2' to ensure the error isn't intercepted by the subshell.
compareToOpenJDKFileVersion() {
funcName="compareToOpenJDKFileVersion"
# First, sanity checking on the arg.
if [ $# -eq 0 ]; then
echo "compareToOpenJDKFileVersion_was_called_with_no_args"
exit 1
elif [ $# -gt 1 ]; then
echo "ERROR: build.sh: ${funcName}: Too many arguments (>1) were passed to this function." >&2
echo "$1"
exit 1
fi

# Check if arg 1 looks like a jdk version string.
# Example: JDK11+: jdk-21.0.10+2
# Example: JDK8 : jdk8u482-b01
if [[ ! "$1" =~ ^jdk\-[0-9]+[0-9\.]*(\+[0-9]+)?$ ]]; then
if [[ ! "$1" =~ ^jdk8u[0-9]+(\-b[0-9][0-9]+)?$ ]]; then
echo "ERROR: build.sh: ${funcName}: The JDK version passed to this function did not match the expected format." >&2
echo "$1"
exit 1
fi
fi

# Retrieve the jdk version from version-numbers.conf (minus the build number).
if ! fileVersionString="$(versionNumbersFileParser)"; then
# This is to catch versionNumbersFileParser failures.
echo "ERROR: build.sh: ${funcName}: versionNumbersFileParser has failed." >&2
echo "$1"
exit 1
fi

if [[ "$1" =~ ^${fileVersionString}.*$ ]]; then
# The file version matches the function argument.
echo "$1"
return
fi

# The file version does not match the function argument.
# Returning the file version.
[ "${BUILD_CONFIG[OPENJDK_FEATURE_NUMBER]}" -eq 8 ] && fileVersionString+="-b00"
[ "${BUILD_CONFIG[OPENJDK_FEATURE_NUMBER]}" -gt 8 ] && fileVersionString+="+0"

echo "WARNING: build.sh: ${funcName}: JDK version in source does not match the supplied version (likely the latest git tag)." >&2
echo "WARNING: The JDK version in source will be used instead." >&2
echo "${fileVersionString}"
}

getOpenJdkVersion() {
local version

Expand Down Expand Up @@ -548,22 +640,34 @@ configureAlsaLocation() {
fi
}

setBundledFreeType() {
echo "Freetype set from bundled in jdk"
freetypeDir=${BUILD_CONFIG[FREETYPE_DIRECTORY]:-bundled}
}

setFreeTypeFromExternalSrcs() {
echo "Freetype set from local sources"
addConfigureArg "--with-freetype-src=" "${BUILD_CONFIG[WORKSPACE_DIR]}/libs/freetype"
}

setFreeTypeFromInstalled() {
echo "Freetype set from installed binary"
freetypeDir=${BUILD_CONFIG[FREETYPE_DIRECTORY]:-"${BUILD_CONFIG[WORKSPACE_DIR]}/${BUILD_CONFIG[WORKING_DIR]}/installedfreetype"}
}

configureFreetypeLocation() {
if [[ ! "${CONFIGURE_ARGS}" =~ "--with-freetype" ]]; then
if [[ "${BUILD_CONFIG[FREETYPE]}" == "true" ]]; then
local freetypeDir="${BUILD_CONFIG[FREETYPE_DIRECTORY]}"
if [[ "$OSTYPE" == "cygwin" ]] || [[ "$OSTYPE" == "msys" ]]; then
case "${BUILD_CONFIG[OPENJDK_CORE_VERSION]}" in
jdk8* | jdk9* | jdk10*) addConfigureArg "--with-freetype-src=" "${BUILD_CONFIG[WORKSPACE_DIR]}/libs/freetype" ;;
*) freetypeDir=${BUILD_CONFIG[FREETYPE_DIRECTORY]:-bundled} ;;
esac
if isFreeTypeInSources ; then
setBundledFreeType
else
case "${BUILD_CONFIG[OPENJDK_CORE_VERSION]}" in
jdk8* | jdk9* | jdk10*) freetypeDir=${BUILD_CONFIG[FREETYPE_DIRECTORY]:-"${BUILD_CONFIG[WORKSPACE_DIR]}/${BUILD_CONFIG[WORKING_DIR]}/installedfreetype"} ;;
*) freetypeDir=${BUILD_CONFIG[FREETYPE_DIRECTORY]:-bundled} ;;
esac
if [[ "$OSTYPE" == "cygwin" ]] || [[ "$OSTYPE" == "msys" ]]; then
setFreeTypeFromExternalSrcs
else
setFreeTypeFromInstalled
fi
fi

if [[ -n "$freetypeDir" ]]; then
echo "setting freetype dir to ${freetypeDir}"
addConfigureArg "--with-freetype=" "${freetypeDir}"
Expand Down Expand Up @@ -2074,7 +2178,14 @@ getOpenJDKTag() {
echo "${BUILD_CONFIG[BRANCH]}"
else
echo " getOpenJDKTag(): Determining tag from checked out repository.." 1>&2
getFirstTagFromOpenJDKGitRepo
tagString=$(getFirstTagFromOpenJDKGitRepo)
# Now we check if the version in the code is later than the version we have so far.
# This prevents an issue where the git repo tags do not match the version string in the source.
# Without this code, we can create builds where half of the version strings do not match.
# This results in nonsensical -version output, incorrect folder names, and lots of failures
# relating to those two factors.
tagString=$(compareToOpenJDKFileVersion "$tagString")
echo "${tagString}"
fi
}

Expand Down
Loading
Loading