diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 35c0dc9b9..d7763c3e3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -165,9 +165,9 @@ jobs: - name: Build macOS run: | export JAVA_HOME=$JAVA_HOME_11_X64 - # Skip freetype build on jdk11+ + # jdk11u+ uses two part exploded & assemble build if [ ${{ matrix.version.name }} != "jdk8u" ]; then - export BUILD_ARGS="--skip-freetype --make-exploded-image --create-sbom" + export BUILD_ARGS="--make-exploded-image --create-sbom" ./build-farm/make-adopt-build-farm.sh export BUILD_ARGS="--assemble-exploded-image --create-sbom" ./build-farm/make-adopt-build-farm.sh diff --git a/build-farm/platform-specific-configurations/aix.sh b/build-farm/platform-specific-configurations/aix.sh index 2babd73a5..fea9acefb 100755 --- a/build-farm/platform-specific-configurations/aix.sh +++ b/build-farm/platform-specific-configurations/aix.sh @@ -59,12 +59,17 @@ 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 -export BUILD_ARGS="${BUILD_ARGS} --skip-freetype" +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 -echo LDR_CNTRL=$LDR_CNTRL +echo LDR_CNTRL="$LDR_CNTRL" BOOT_JDK_VARIABLE="JDK${JDK_BOOT_VERSION}_BOOT_DIR" if [ ! -d "$(eval echo "\$$BOOT_JDK_VARIABLE")" ]; then diff --git a/build-farm/platform-specific-configurations/alpine-linux.sh b/build-farm/platform-specific-configurations/alpine-linux.sh index 5aee36e90..1b3eedbcf 100644 --- a/build-farm/platform-specific-configurations/alpine-linux.sh +++ b/build-farm/platform-specific-configurations/alpine-linux.sh @@ -28,8 +28,13 @@ fi # ccache seems flaky on alpine export CONFIGURE_ARGS_FOR_ANY_PLATFORM="${CONFIGURE_ARGS_FOR_ANY_PLATFORM} --disable-ccache" -# We don't bundle freetype on alpine anymore, and expect the user to have it. -export BUILD_ARGS="${BUILD_ARGS} --skip-freetype" +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 BOOT_JDK_VARIABLE="JDK${JDK_BOOT_VERSION}_BOOT_DIR" if [ ! -d "$(eval echo "\$$BOOT_JDK_VARIABLE")" ]; then diff --git a/build-farm/platform-specific-configurations/linux.sh b/build-farm/platform-specific-configurations/linux.sh index 3fea89ac3..655cd16c0 100755 --- a/build-farm/platform-specific-configurations/linux.sh +++ b/build-farm/platform-specific-configurations/linux.sh @@ -18,8 +18,14 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" # shellcheck source=sbin/common/constants.sh source "$SCRIPT_DIR/../../sbin/common/constants.sh" -# Bundling our own freetype can cause problems, so we skip that on linux. -export BUILD_ARGS="${BUILD_ARGS} --skip-freetype" + +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 NATIVE_API_ARCH=$(uname -m) if [ "${NATIVE_API_ARCH}" = "x86_64" ]; then NATIVE_API_ARCH=x64; fi diff --git a/build-farm/platform-specific-configurations/mac.sh b/build-farm/platform-specific-configurations/mac.sh index e99a06366..7283ceb82 100755 --- a/build-farm/platform-specific-configurations/mac.sh +++ b/build-farm/platform-specific-configurations/mac.sh @@ -68,6 +68,11 @@ 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 ) ]] then diff --git a/build-farm/platform-specific-configurations/windows.sh b/build-farm/platform-specific-configurations/windows.sh index e41514035..25d5756a8 100755 --- a/build-farm/platform-specific-configurations/windows.sh +++ b/build-farm/platform-specific-configurations/windows.sh @@ -231,6 +231,11 @@ then fi fi +if [[ "$JAVA_FEATURE_VERSION" -ge 21 ]]; then + # jdk-21+ uses "bundled" FreeType + export BUILD_ARGS="${BUILD_ARGS} --freetype-dir bundled" +fi + if [ "${ARCHITECTURE}" == "aarch64" ]; then export CONFIGURE_ARGS_FOR_ANY_PLATFORM="${CONFIGURE_ARGS_FOR_ANY_PLATFORM} --disable-ccache --openjdk-target=aarch64-unknown-cygwin" fi diff --git a/test/functional/buildAndPackage/src/net/adoptium/test/BundledFreetypeTest.java b/test/functional/buildAndPackage/src/net/adoptium/test/BundledFreetypeTest.java index baf413120..a6e103201 100644 --- a/test/functional/buildAndPackage/src/net/adoptium/test/BundledFreetypeTest.java +++ b/test/functional/buildAndPackage/src/net/adoptium/test/BundledFreetypeTest.java @@ -74,7 +74,11 @@ public void freetypeOnlyBundledOnCertainPlatforms() throws IOException { .filter(name -> freetypePattern.matcher(name).matches()) .collect(Collectors.toSet()); - if (jdkPlatform.runsOn(OperatingSystem.MACOS)) { + if (jdkVersion.isNewerOrEqual(21)) { + // jdk-21+ uses "bundled" FreeType + assertTrue(freetypeFiles.size() > 0, + "Expected libfreetype.dylib to be bundled but it is not."); + } else if (jdkPlatform.runsOn(OperatingSystem.MACOS)) { assertTrue(freetypeFiles.size() > 0, "Expected libfreetype.dylib to be bundled but it is not."); } else if (jdkPlatform.runsOn(OperatingSystem.WINDOWS)) {