Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 22 additions & 10 deletions sbin/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -548,22 +548,34 @@ configureAlsaLocation() {
fi
}

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

setFreeTypeFromSrcs() {
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
setDefaultFreeType
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
setFreeTypeFromSrcs
else
setFreeTypeFromInstalled
fi
fi

if [[ -n "$freetypeDir" ]]; then
echo "setting freetype dir to ${freetypeDir}"
addConfigureArg "--with-freetype=" "${freetypeDir}"
Expand Down
71 changes: 57 additions & 14 deletions sbin/prepareWorkspace.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,48 @@ FREETYPE_FONT_SHARED_OBJECT_FILENAME="libfreetype.so*"
# sha256 of https://github.com/adoptium/devkit-binaries/releases/tag/vs2022_redist_14.40.33807_10.0.26100.1742
WINDOWS_REDIST_CHECKSUM="ac6060f5f8a952f59faef20e53d124c2c267264109f3f6fabeb2b7aefb3e3c62"


checkBundledFreetypeJdkConfig() {
if [ "${BUILD_CONFIG[FREETYPE_DIRECTORY]}" = "bundled" ] ; then
if [ "${BUILD_CONFIG[FREETYPE]}" = "false" ] ; then
echo "--freetype-dir bundled is in contradiction with -skip-freetype"
exit 1
fi
echo "--freetype-dir is set to bundled that is weird, but accepted. It should be default."
elif [ "${BUILD_CONFIG[FREETYPE_DIRECTORY]}" = "system" ] ; then
echo "--freetype-dir is set to system that is weird, but accepted. Try to use --skip-freetype"
elif [ -n "${BUILD_CONFIG[FREETYPE_DIRECTORY]}" ] ; then
echo "--freetype-dir is not accepted for JDK with bundled freetype."
exit 1
fi
}

checkNoBundledFreetypeJdkConfig() {
if [ "${BUILD_CONFIG[FREETYPE]}" = "false" ] && [ -n "${BUILD_CONFIG[FREETYPE_DIRECTORY]}" ] ; then
echo "--freetype-dir is declared together with --skip-freetype, that is invalid, and would build against system freetype"
exit 1
fi
}

isFreeTypeInSources() {
local libfreetypeid="libfreetype/src"
local location="${BUILD_CONFIG[WORKSPACE_DIR]}/${BUILD_CONFIG[WORKING_DIR]}/${BUILD_CONFIG[OPENJDK_SOURCE_DIR]}"
if [ ! -e "$location" ] ; then
echo "No jdk sources exists to to determine $libfreetypeid presence"
exit 1
fi
local found=0
find "$location" | grep -q "$libfreetypeid" || found=$?
if [ $found -eq 0 ] ; then
echo "$libfreetypeid found in $location"
checkBundledFreetypeJdkConfig
else
echo "$libfreetypeid not found in $location"
checkNoBundledFreetypeJdkConfig
fi
return $found
}

copyFromDir() {
echo "Copying OpenJDK source from ${BUILD_CONFIG[OPENJDK_LOCAL_SOURCE_ARCHIVE_ABSPATH]} to $(pwd)/${BUILD_CONFIG[OPENJDK_SOURCE_DIR]} to be built"
# We really do not want to use .git for dirs, as we expect user have them set up, ignoring them
Expand Down Expand Up @@ -824,6 +866,8 @@ downloadBootJdkIfNeeded () {

# Download all of the dependencies for OpenJDK (Alsa, FreeType, boot-jdk etc.)
downloadingRequiredDependencies() {
local freeTypeInSources=0
isFreeTypeInSources || freeTypeInSources="$?"
if [[ "${BUILD_CONFIG[CLEAN_LIBS]}" == "true" ]]; then
rm -rf "${BUILD_CONFIG[WORKSPACE_DIR]}/libs/freetype" || true
rm -rf "${BUILD_CONFIG[WORKSPACE_DIR]}/${BUILD_CONFIG[WORKING_DIR]}/installedalsa" || true
Expand All @@ -850,19 +894,18 @@ downloadingRequiredDependencies() {
fi

if [[ "${BUILD_CONFIG[FREETYPE]}" == "true" ]]; then
case "${BUILD_CONFIG[OPENJDK_CORE_VERSION]}" in
jdk8* | jdk9* | jdk10*)
if [ -z "${BUILD_CONFIG[FREETYPE_DIRECTORY]}" ]; then
echo "Checking and download FreeType Font dependency"
checkingAndDownloadingFreeType
else
echo ""
echo "---> Skipping the process of checking and downloading the FreeType Font dependency, a pre-built version provided at ${BUILD_CONFIG[FREETYPE_DIRECTORY]} <---"
echo ""
fi
;;
*) echo "Using bundled Freetype" ;;
esac
if [ "0${freeTypeInSources}" -ne 0 ] ; then
if [ -z "${BUILD_CONFIG[FREETYPE_DIRECTORY]}" ]; then
echo "Checking and download FreeType Font dependency"
checkingAndDownloadingFreeType
else
echo ""
echo "---> Skipping the process of checking and downloading the FreeType Font dependency, a pre-built version provided at ${BUILD_CONFIG[FREETYPE_DIRECTORY]} <---"
echo ""
fi
else
echo "Using bundled Freetype"
fi
else
echo "Skipping Freetype"
fi
Expand Down Expand Up @@ -947,10 +990,10 @@ createSourceTagFile(){
function configureWorkspace() {
if [[ "${BUILD_CONFIG[ASSEMBLE_EXPLODED_IMAGE]}" != "true" ]]; then
createWorkspace
checkoutAndCloneOpenJDKGitRepo
downloadingRequiredDependencies
downloadDevkit
relocateToTmpIfNeeded
checkoutAndCloneOpenJDKGitRepo
applyPatches
if [ "${BUILD_CONFIG[CUSTOM_CACERTS]}" = "true" ] ; then
prepareMozillaCacerts
Expand Down
Loading