Skip to content

Commit 8aebddb

Browse files
2 parents b7593b6 + ead463b commit 8aebddb

File tree

18 files changed

+793
-735
lines changed

18 files changed

+793
-735
lines changed

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,17 +160,20 @@ disable the default fB--depth=1 shallow cloning of git repo(s).
160160

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

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

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

171174
-F, --skip-freetype
172-
skip building Freetype automatically.
173-
This is typically used in conjunction with -f.
175+
set JDK to link against system freetype,
176+
instead of building bundled version
174177

175178
-h, --help
176179
print the man page.

build-farm/platform-specific-configurations/aix.sh

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,6 @@ then
5757
export CONFIGURE_ARGS_FOR_ANY_PLATFORM="${CONFIGURE_ARGS_FOR_ANY_PLATFORM} --with-extra-ldflags=-lpthread --with-extra-cflags=-lpthread --with-extra-cxxflags=-lpthread"
5858
fi
5959

60-
if [[ "$JAVA_FEATURE_VERSION" -ge 21 ]]; then
61-
# jdk-21+ uses "bundled" FreeType
62-
export BUILD_ARGS="${BUILD_ARGS} --freetype-dir bundled"
63-
else
64-
export BUILD_ARGS="${BUILD_ARGS} --skip-freetype"
65-
fi
66-
6760
if [ "${VARIANT}" == "${BUILD_VARIANT_OPENJ9}" ]; then
6861
export LDR_CNTRL=MAXDATA=0x80000000
6962
fi

build-farm/platform-specific-configurations/alpine-linux.sh

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,6 @@ fi
2626
# ccache seems flaky on alpine
2727
export CONFIGURE_ARGS_FOR_ANY_PLATFORM="${CONFIGURE_ARGS_FOR_ANY_PLATFORM} --disable-ccache"
2828

29-
if [[ "$JAVA_FEATURE_VERSION" -ge 21 ]]; then
30-
# jdk-21+ uses "bundled" FreeType
31-
export BUILD_ARGS="${BUILD_ARGS} --freetype-dir bundled"
32-
else
33-
# We don't bundle freetype on alpine anymore, and expect the user to have it.
34-
export BUILD_ARGS="${BUILD_ARGS} --skip-freetype"
35-
fi
36-
3729
## This affects Alpine docker images and also evaluation pipelines
3830
if [ "$(pwd | wc -c)" -gt 83 ]; then
3931
# Use /tmp for alpine in preference to $HOME as Alpine fails gpg operation if PWD > 83 characters

build-farm/platform-specific-configurations/linux.sh

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,6 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
1818
source "$SCRIPT_DIR/../../sbin/common/constants.sh"
1919
source "$SCRIPT_DIR/../../sbin/common/downloaders.sh"
2020

21-
if [[ "$JAVA_FEATURE_VERSION" -ge 21 ]]; then
22-
# jdk-21+ uses "bundled" FreeType
23-
export BUILD_ARGS="${BUILD_ARGS} --freetype-dir bundled"
24-
else
25-
# Bundling our own freetype can cause problems, so we skip that on linux.
26-
export BUILD_ARGS="${BUILD_ARGS} --skip-freetype"
27-
fi
28-
2921
## This affects Alpine docker images and also evaluation pipelines
3022
if [ "$(pwd | wc -c)" -gt 83 ]; then
3123
# Use /tmp for alpine in preference to $HOME as Alpine fails gpg operation if PWD > 83 characters

build-farm/platform-specific-configurations/mac.sh

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ then
4545
fi
4646
if [ "${VARIANT}" == "${BUILD_VARIANT_OPENJ9}" ]; then
4747
export CONFIGURE_ARGS_FOR_ANY_PLATFORM="${CONFIGURE_ARGS_FOR_ANY_PLATFORM} --with-openssl=fetched --enable-openssl-bundling"
48-
export BUILD_ARGS="${BUILD_ARGS} --skip-freetype"
4948
fi
5049
else
5150
if [[ "$JAVA_FEATURE_VERSION" -ge 11 ]]; then
@@ -76,10 +75,6 @@ else
7675
fi
7776
fi
7877

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

8479
# The configure option '--with-macosx-codesign-identity' is supported in JDK8 OpenJ9 and JDK11 and JDK14+
8580
if [[ ( "$JAVA_FEATURE_VERSION" -eq 11 ) || ( "$JAVA_FEATURE_VERSION" -ge 14 ) ]]

build-farm/platform-specific-configurations/solaris.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
1717
# shellcheck source=sbin/common/constants.sh
1818
source "$SCRIPT_DIR/../../sbin/common/constants.sh"
1919

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

2222
if [ "${ARCHITECTURE}" == "x64" ]; then
2323
export CUPS="--with-cups=/opt/sfw/cups"

build-farm/platform-specific-configurations/windows.sh

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ then
6868
export CONFIGURE_ARGS_FOR_ANY_PLATFORM="${CONFIGURE_ARGS_FOR_ANY_PLATFORM} --with-openssl=fetched --enable-openssl-bundling"
6969
if [ "${JAVA_TO_BUILD}" == "${JDK8_VERSION}" ]
7070
then
71-
export BUILD_ARGS="${BUILD_ARGS} --skip-freetype"
7271
# https://github.com/adoptium/temurin-build/issues/243
7372
export INCLUDE="C:\Program Files\Debugging Tools for Windows (x64)\sdk\inc;$INCLUDE"
7473
export PATH="/c/cygwin64/bin:/usr/bin:$PATH"
@@ -85,7 +84,6 @@ then
8584
else
8685
if [ "${JAVA_TO_BUILD}" == "${JDK8_VERSION}" ]
8786
then
88-
export BUILD_ARGS="${BUILD_ARGS} --freetype-version 2.5.3"
8987
export PATH="/cygdrive/c/openjdk/make-3.82/:$PATH"
9088
elif [ "${JAVA_TO_BUILD}" == "${JDK11_VERSION}" ]
9189
then
@@ -112,19 +110,6 @@ then
112110
then
113111
export INCLUDE="C:\Program Files\Debugging Tools for Windows (x64)\sdk\inc;$INCLUDE"
114112
export PATH="$PATH:/c/cygwin64/bin"
115-
export BUILD_ARGS="${BUILD_ARGS} --skip-freetype"
116-
elif [ "${JAVA_TO_BUILD}" == "${JDK9_VERSION}" ]
117-
then
118-
export BUILD_ARGS="${BUILD_ARGS} --freetype-version 2.5.3"
119-
elif [ "${JAVA_TO_BUILD}" == "${JDK10_VERSION}" ]
120-
then
121-
export BUILD_ARGS="${BUILD_ARGS} --freetype-version 2.5.3"
122-
elif [ "$JAVA_FEATURE_VERSION" -lt 19 ]
123-
then
124-
export BUILD_ARGS="${BUILD_ARGS} --skip-freetype"
125-
elif [ "$JAVA_FEATURE_VERSION" -ge 19 ]
126-
then
127-
export BUILD_ARGS="${BUILD_ARGS} --skip-freetype"
128113
fi
129114

130115
CUDA_VERSION=9.1

cyclonedx-lib/build.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@
380380
<arg value="--name"/>
381381
<arg value="makejdk_any_platform_args"/>
382382
<arg value="--value"/>
383-
<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"/>
383+
<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"/>
384384
<arg value="--jsonFile"/>
385385
<arg value="${testSBOMFile}"/>
386386
</java>
@@ -768,7 +768,7 @@
768768
<arg value="--name"/>
769769
<arg value="makejdk_any_platform_args"/>
770770
<arg value="--value"/>
771-
<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"/>
771+
<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"/>
772772
<arg value="--xmlFile"/>
773773
<arg value="${testSBOMFile_xml}"/>
774774
</java>

makejdk-any-platform.1

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,17 +115,20 @@ disable the default \fB--depth=1\fR shallow cloning of git repo(s).
115115
.TP
116116
.BR \-f ", " \-\-freetype-dir " " \fI<path>\fR
117117
specify the location of an existing FreeType library.
118-
This is typically used in conjunction with \fB<-F>\fR.
118+
Do not use with \fB<-F>\fR, as it would invalidate this switch.
119+
DEPRECATED: Only makes sense for JDKs without a bundled freetype
119120
.TP
120121
.BR \-\-freetype-build-param " " \fI<parameter>\fR
121122
specify any special freetype build parameters (required for some OS's).
123+
DEPRECATED: Only makes sense for JDKs without a bundled freetype
122124
.TP
123125
.BR \-\-freetype-version " " \fI<version>\fR
124126
specify the version of freetype you are building.
127+
DEPRECATED: Only makes sense for JDKs without a bundled freetype
125128
.TP
126129
.BR \-F ", " \-\-skip-freetype
127-
skip building Freetype automatically.
128-
This is typically used in conjunction with \fB<-f>\fR.
130+
set JDK to link against system freetype,
131+
instead of building the bundled version
129132
.TP
130133
.BR \-h ", " \-\-help
131134
print this help.

sbin/build.sh

Lines changed: 123 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ configureDevKitConfigureParameter() {
105105
addConfigureArg "--with-devkit=" "${BUILD_CONFIG[ADOPTIUM_DEVKIT_LOCATION]}"
106106
fi
107107
fi
108-
}
108+
}
109109

110110
# Configure the boot JDK
111111
configureBootJDKConfigureParameter() {
@@ -253,6 +253,98 @@ patchFreetypeWindows() {
253253
fi
254254
}
255255

256+
# Returns the version numbers in version-numbers.conf as a space-seperated list of integers.
257+
# e.g. 17 0 1 5
258+
# or 8 0 0 432
259+
# Build number will not be included, as that is not stored in this file.
260+
versionNumbersFileParser() {
261+
funcName="versionNumbersFileParser"
262+
buildSrc="${BUILD_CONFIG[WORKSPACE_DIR]}/${BUILD_CONFIG[WORKING_DIR]}/${BUILD_CONFIG[OPENJDK_SOURCE_DIR]}"
263+
jdkVersion="${BUILD_CONFIG[OPENJDK_FEATURE_NUMBER]}"
264+
265+
# Find version-numbers.conf (or equivalent) and confirm we can read it.
266+
numbersFile="${buildSrc}/common/autoconf/version-numbers"
267+
[ "$jdkVersion" -eq 11 ] && numbersFile="${buildSrc}/make/autoconf/version-numbers"
268+
[ "$jdkVersion" -ge 17 ] && numbersFile="${buildSrc}/make/conf/version-numbers.conf"
269+
[ ! -r "${numbersFile}" ] && echo "ERROR: build.sh: ${funcName}: JDK version file not found: ${numbersFile}" >&2 && exit 1
270+
271+
fileVersionString=""
272+
error=""
273+
if [ "$jdkVersion" -eq 8 ]; then
274+
# jdk8 uses this format: jdk8u482-b01
275+
fileVersionString="jdk8u$(grep "JDK_UPDATE_VERSION" "${numbersFile}" | head -1 | grep -Eo '[0-9]+')" || error="true"
276+
[[ ! "${fileVersionString}" =~ ^jdk8u[0-9]+$ || $error ]] && echo "ERROR: build.sh: ${funcName}: version file could not be parsed." >&2 && exit 1
277+
else
278+
# File parsing logic for jdk11+.
279+
patchNo="$(grep "DEFAULT_VERSION_PATCH" "${numbersFile}" | head -1 | grep -Eo '[0-9]+')" || error="true"
280+
updateNo="$(grep "DEFAULT_VERSION_UPDATE" "${numbersFile}" | head -1 | grep -Eo '[0-9]+')" || error="true"
281+
interimNo="$(grep "DEFAULT_VERSION_INTERIM" "${numbersFile}" | head -1 | grep -Eo '[0-9]+')" || error="true"
282+
featureNo="$(grep "DEFAULT_VERSION_FEATURE" "${numbersFile}" | head -1 | grep -Eo '[0-9]+')" || error="true"
283+
284+
[[ ! "${patchNo}" =~ ^0$ ]] && fileVersionString=".${patchNo}"
285+
[[ ! "${updateNo}.${fileVersionString}" =~ ^[0\.]+$ ]] && fileVersionString=".${updateNo}${fileVersionString}"
286+
[[ ! "${interimNo}.${fileVersionString}" =~ ^[0\.]+$ ]] && fileVersionString=".${interimNo}${fileVersionString}"
287+
fileVersionString="jdk-${featureNo}${fileVersionString}"
288+
289+
[[ ! "${fileVersionString}" =~ ^jdk\-[0-9]+[0-9\.]*$ || $error ]] && echo "ERROR: build.sh: ${funcName}: version file could not be parsed." >&2 && exit 1
290+
fi
291+
292+
# Returning the formatted jdk version string.
293+
echo "${fileVersionString}"
294+
}
295+
296+
# This function attempts to compare the jdk version from version-numbers.conf with arg 1.
297+
# We will then return whichever version is bigger/later.
298+
# e.g. 17.0.1+32 > 17.0.0+64
299+
# If any errors or unusual circumstances are detected, we simply return arg1 to avoid destabilising the build.
300+
# Note: For error messages, use 'echo message >&2' to ensure the error isn't intercepted by the subshell.
301+
compareToOpenJDKFileVersion() {
302+
funcName="compareToOpenJDKFileVersion"
303+
# First, sanity checking on the arg.
304+
if [ $# -eq 0 ]; then
305+
echo "compareToOpenJDKFileVersion_was_called_with_no_args"
306+
exit 1
307+
elif [ $# -gt 1 ]; then
308+
echo "ERROR: build.sh: ${funcName}: Too many arguments (>1) were passed to this function." >&2
309+
echo "$1"
310+
exit 1
311+
fi
312+
313+
# Check if arg 1 looks like a jdk version string.
314+
# Example: JDK11+: jdk-21.0.10+2
315+
# Example: JDK8 : jdk8u482-b01
316+
if [[ ! "$1" =~ ^jdk\-[0-9]+[0-9\.]*(\+[0-9]+)?$ ]]; then
317+
if [[ ! "$1" =~ ^jdk8u[0-9]+(\-b[0-9][0-9]+)?$ ]]; then
318+
echo "ERROR: build.sh: ${funcName}: The JDK version passed to this function did not match the expected format." >&2
319+
echo "$1"
320+
exit 1
321+
fi
322+
fi
323+
324+
# Retrieve the jdk version from version-numbers.conf (minus the build number).
325+
if ! fileVersionString="$(versionNumbersFileParser)"; then
326+
# This is to catch versionNumbersFileParser failures.
327+
echo "ERROR: build.sh: ${funcName}: versionNumbersFileParser has failed." >&2
328+
echo "$1"
329+
exit 1
330+
fi
331+
332+
if [[ "$1" =~ ^${fileVersionString}.*$ ]]; then
333+
# The file version matches the function argument.
334+
echo "$1"
335+
return
336+
fi
337+
338+
# The file version does not match the function argument.
339+
# Returning the file version.
340+
[ "${BUILD_CONFIG[OPENJDK_FEATURE_NUMBER]}" -eq 8 ] && fileVersionString+="-b00"
341+
[ "${BUILD_CONFIG[OPENJDK_FEATURE_NUMBER]}" -gt 8 ] && fileVersionString+="+0"
342+
343+
echo "WARNING: build.sh: ${funcName}: JDK version in source does not match the supplied version (likely the latest git tag)." >&2
344+
echo "WARNING: The JDK version in source will be used instead." >&2
345+
echo "${fileVersionString}"
346+
}
347+
256348
getOpenJdkVersion() {
257349
local version
258350

@@ -548,22 +640,34 @@ configureAlsaLocation() {
548640
fi
549641
}
550642

643+
setBundledFreeType() {
644+
echo "Freetype set from bundled in jdk"
645+
freetypeDir=${BUILD_CONFIG[FREETYPE_DIRECTORY]:-bundled}
646+
}
647+
648+
setFreeTypeFromExternalSrcs() {
649+
echo "Freetype set from local sources"
650+
addConfigureArg "--with-freetype-src=" "${BUILD_CONFIG[WORKSPACE_DIR]}/libs/freetype"
651+
}
652+
653+
setFreeTypeFromInstalled() {
654+
echo "Freetype set from installed binary"
655+
freetypeDir=${BUILD_CONFIG[FREETYPE_DIRECTORY]:-"${BUILD_CONFIG[WORKSPACE_DIR]}/${BUILD_CONFIG[WORKING_DIR]}/installedfreetype"}
656+
}
657+
551658
configureFreetypeLocation() {
552659
if [[ ! "${CONFIGURE_ARGS}" =~ "--with-freetype" ]]; then
553660
if [[ "${BUILD_CONFIG[FREETYPE]}" == "true" ]]; then
554661
local freetypeDir="${BUILD_CONFIG[FREETYPE_DIRECTORY]}"
555-
if [[ "$OSTYPE" == "cygwin" ]] || [[ "$OSTYPE" == "msys" ]]; then
556-
case "${BUILD_CONFIG[OPENJDK_CORE_VERSION]}" in
557-
jdk8* | jdk9* | jdk10*) addConfigureArg "--with-freetype-src=" "${BUILD_CONFIG[WORKSPACE_DIR]}/libs/freetype" ;;
558-
*) freetypeDir=${BUILD_CONFIG[FREETYPE_DIRECTORY]:-bundled} ;;
559-
esac
662+
if isFreeTypeInSources ; then
663+
setBundledFreeType
560664
else
561-
case "${BUILD_CONFIG[OPENJDK_CORE_VERSION]}" in
562-
jdk8* | jdk9* | jdk10*) freetypeDir=${BUILD_CONFIG[FREETYPE_DIRECTORY]:-"${BUILD_CONFIG[WORKSPACE_DIR]}/${BUILD_CONFIG[WORKING_DIR]}/installedfreetype"} ;;
563-
*) freetypeDir=${BUILD_CONFIG[FREETYPE_DIRECTORY]:-bundled} ;;
564-
esac
665+
if [[ "$OSTYPE" == "cygwin" ]] || [[ "$OSTYPE" == "msys" ]]; then
666+
setFreeTypeFromExternalSrcs
667+
else
668+
setFreeTypeFromInstalled
669+
fi
565670
fi
566-
567671
if [[ -n "$freetypeDir" ]]; then
568672
echo "setting freetype dir to ${freetypeDir}"
569673
addConfigureArg "--with-freetype=" "${freetypeDir}"
@@ -2074,7 +2178,14 @@ getOpenJDKTag() {
20742178
echo "${BUILD_CONFIG[BRANCH]}"
20752179
else
20762180
echo " getOpenJDKTag(): Determining tag from checked out repository.." 1>&2
2077-
getFirstTagFromOpenJDKGitRepo
2181+
tagString=$(getFirstTagFromOpenJDKGitRepo)
2182+
# Now we check if the version in the code is later than the version we have so far.
2183+
# This prevents an issue where the git repo tags do not match the version string in the source.
2184+
# Without this code, we can create builds where half of the version strings do not match.
2185+
# This results in nonsensical -version output, incorrect folder names, and lots of failures
2186+
# relating to those two factors.
2187+
tagString=$(compareToOpenJDKFileVersion "$tagString")
2188+
echo "${tagString}"
20782189
fi
20792190
}
20802191

0 commit comments

Comments
 (0)