@@ -40,19 +40,44 @@ FREETYPE_FONT_SHARED_OBJECT_FILENAME="libfreetype.so*"
4040# sha256 of https://github.com/adoptium/devkit-binaries/releases/tag/vs2022_redist_14.40.33807_10.0.26100.1742
4141WINDOWS_REDIST_CHECKSUM=" ac6060f5f8a952f59faef20e53d124c2c267264109f3f6fabeb2b7aefb3e3c62"
4242
43+
44+ checkBundledFreetypeJdkConfig () {
45+ if [ " ${BUILD_CONFIG[FREETYPE_DIRECTORY]} " = " bundled" ] ; then
46+ if [ " ${BUILD_CONFIG[FREETYPE]} " = " false" ] ; then
47+ echo " --freetype-dir bundled is in contradiction with -skip-freetype"
48+ exit 1
49+ fi
50+ echo " --freetype-dir is set to bundled that is weird, but accepted. It should be default."
51+ elif [ " ${BUILD_CONFIG[FREETYPE_DIRECTORY]} " = " system" ] ; then
52+ echo " --freetype-dir is set to system that is weird, but accepted. Try to use --skip-freetype"
53+ elif [ -n " ${BUILD_CONFIG[FREETYPE_DIRECTORY]} " ] ; then
54+ echo " --freetype-dir is not accepted for JDK with bundled freetype."
55+ exit 1
56+ fi
57+ }
58+
59+ checkNoBundledFreetypeJdkConfig () {
60+ if [ " ${BUILD_CONFIG[FREETYPE]} " = " false" ] && [ -n " ${BUILD_CONFIG[FREETYPE_DIRECTORY]} " ] ; then
61+ echo " --freetype-dir is declared together with --skip-freetype, that is invalid, and would build against system freetype"
62+ exit 1
63+ fi
64+ }
65+
4366isFreeTypeInSources () {
4467 local libfreetypeid=" libfreetype/src"
4568 local location=" ${BUILD_CONFIG[WORKSPACE_DIR]} /${BUILD_CONFIG[WORKING_DIR]} /${BUILD_CONFIG[OPENJDK_SOURCE_DIR]} "
4669 if [ ! -e " $location " ] ; then
4770 echo " No jdk sources exists to to determine $libfreetypeid presence"
4871 exit 1
4972 fi
50- find " $location " | grep -q " $libfreetypeid "
51- local found=$?
73+ local found=0
74+ find " $location " | grep -q " $libfreetypeid " || found=$?
5275 if [ $found -eq 0 ] ; then
5376 echo " $libfreetypeid found in $location "
77+ checkBundledFreetypeJdkConfig
5478 else
5579 echo " $libfreetypeid not found in $location "
80+ checkNoBundledFreetypeJdkConfig
5681 fi
5782 return $found
5883}
@@ -841,6 +866,8 @@ downloadBootJdkIfNeeded () {
841866
842867# Download all of the dependencies for OpenJDK (Alsa, FreeType, boot-jdk etc.)
843868downloadingRequiredDependencies () {
869+ local freeTypeInSources=0
870+ isFreeTypeInSources || freeTypeInSources=" $? "
844871 if [[ " ${BUILD_CONFIG[CLEAN_LIBS]} " == " true" ]]; then
845872 rm -rf " ${BUILD_CONFIG[WORKSPACE_DIR]} /libs/freetype" || true
846873 rm -rf " ${BUILD_CONFIG[WORKSPACE_DIR]} /${BUILD_CONFIG[WORKING_DIR]} /installedalsa" || true
@@ -867,7 +894,7 @@ downloadingRequiredDependencies() {
867894 fi
868895
869896 if [[ " ${BUILD_CONFIG[FREETYPE]} " == " true" ]]; then
870- if ! isFreeTypeInSources ; then
897+ if [ " 0 ${freeTypeInSources} " -ne 0 ] ; then
871898 if [ -z " ${BUILD_CONFIG[FREETYPE_DIRECTORY]} " ]; then
872899 echo " Checking and download FreeType Font dependency"
873900 checkingAndDownloadingFreeType
0 commit comments