@@ -198,10 +198,28 @@ getDragonwellVersionOPT() {
198198patchFreetypeWindows () {
199199 # Allow freetype 2.8.1 to be built for JDK8u with Visual Studio 2017 (see https://github.com/openjdk/jdk8u-dev/pull/3#issuecomment-1087677766).
200200 # Don't apply the patch for OpenJ9 (OpenJ9 doesn't need the patch and, technically, it should only be applied for version 2.8.1).
201- if [ " ${BUILD_CONFIG[OPENJDK_CORE_VERSION]} " = " ${JDK8_CORE_VERSION} " ] && [ " ${ARCHITECTURE} " = " x64" ] && [ " ${BUILD_CONFIG[BUILD_VARIANT]} " != " ${BUILD_VARIANT_OPENJ9} " ]; then
202- rm " ${BUILD_CONFIG[WORKSPACE_DIR]} /libs/freetype/builds/windows/vc2010/freetype.vcxproj"
203- # Copy the replacement freetype.vcxproj file from the .github directory
204- cp " ${BUILD_CONFIG[WORKSPACE_DIR]} /${BUILD_CONFIG[WORKING_DIR]} /${BUILD_CONFIG[OPENJDK_SOURCE_DIR]} /.github/workflows/freetype.vcxproj" " ${BUILD_CONFIG[WORKSPACE_DIR]} /libs/freetype/builds/windows/vc2010/freetype.vcxproj"
201+ if [ " ${BUILD_CONFIG[OPENJDK_CORE_VERSION]} " = " ${JDK8_CORE_VERSION} " ] && [ " ${BUILD_CONFIG[BUILD_VARIANT]} " != " ${BUILD_VARIANT_OPENJ9} " ]; then
202+ echo " Checking cloned freetype source version for version 2.8.1, that needs updated builds/windows/vc2010/freetype.vcxproj ..."
203+ # Determine cloned freetype version
204+ local freetype_version=" "
205+ # Obtain FreeType version from freetype.h
206+ local freetypeInclude=" ${BUILD_CONFIG[WORKSPACE_DIR]} /libs/freetype/include/freetype/freetype.h"
207+ if [[ -f " ${freetypeInclude} " ]]; then
208+ local ver_major=" $( grep " FREETYPE_MAJOR" " ${freetypeInclude} " | grep " #define" | tr -s " " | cut -d" " -f3) "
209+ local ver_minor=" $( grep " FREETYPE_MINOR" " ${freetypeInclude} " | grep " #define" | tr -s " " | cut -d" " -f3) "
210+ local ver_patch=" $( grep " FREETYPE_PATCH" " ${freetypeInclude} " | grep " #define" | tr -s " " | cut -d" " -f3) "
211+ local freetype_version=" ${ver_major} .${ver_minor} .${ver_patch} "
212+ if [[ " ${freetype_version} " == " 2.8.1" ]]; then
213+ echo " Freetype 2.8.1 found, updating builds/windows/vc2010/freetype.vcxproj ..."
214+ rm " ${BUILD_CONFIG[WORKSPACE_DIR]} /libs/freetype/builds/windows/vc2010/freetype.vcxproj"
215+ # Copy the replacement freetype.vcxproj file from the .github directory
216+ cp " ${BUILD_CONFIG[WORKSPACE_DIR]} /${BUILD_CONFIG[WORKING_DIR]} /${BUILD_CONFIG[OPENJDK_SOURCE_DIR]} /.github/workflows/freetype.vcxproj" " ${BUILD_CONFIG[WORKSPACE_DIR]} /libs/freetype/builds/windows/vc2010/freetype.vcxproj"
217+ else
218+ echo " Freetype source is version ${freetype_version} , no updated required."
219+ fi
220+ else
221+ echo " No include/freetype/freetype.h found, Freetype source not version 2.8.1, no updated required."
222+ fi
205223 fi
206224}
207225
0 commit comments