Skip to content

Commit

Permalink
switch freetype to clone source from GitHub (#3188)
Browse files Browse the repository at this point in the history
* switch freetype to clone source from GitHub

* remove duplicate cd

* add autogen step for freetype:

* install automake

* remove existing dir if it exists

* remove FREETYPE_LIB_CHECKSUM

* pin freetype version using shasum
  • Loading branch information
gdams authored Jan 3, 2023
1 parent 1396fe5 commit 9204887
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ jobs:

- name: Install Dependencies
run: |
brew install bash binutils freetype gnu-sed nasm
brew install automake bash binutils freetype gnu-sed nasm
- uses: actions/setup-java@1df8dbefe2a8cbc99770194893dd902763bee34b # v3.9.0
id: setup-java
Expand Down
2 changes: 1 addition & 1 deletion build-farm/platform-specific-configurations/windows.sh
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ then
export CONFIGURE_ARGS_FOR_ANY_PLATFORM="${CONFIGURE_ARGS_FOR_ANY_PLATFORM} --disable-ccache"
if [ "${JAVA_TO_BUILD}" == "${JDK8_VERSION}" ]
then
export BUILD_ARGS="${BUILD_ARGS} --freetype-version 2.8.1"
export BUILD_ARGS="${BUILD_ARGS} --freetype-version 39ce3ac499d4cd7371031a062f410953c8ecce29" # 2.8.1
export PATH="/cygdrive/c/openjdk/make-3.82/:$PATH"
elif [ "$JAVA_FEATURE_VERSION" -ge 11 ]
then
Expand Down
2 changes: 1 addition & 1 deletion sbin/common/config_init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ function configDefaults() {
BUILD_CONFIG[COPY_MACOSX_FREE_FONT_LIB_FOR_JRE_FLAG]="false"
BUILD_CONFIG[FREETYPE]=true
BUILD_CONFIG[FREETYPE_DIRECTORY]=""
BUILD_CONFIG[FREETYPE_FONT_VERSION]="2.9.1"
BUILD_CONFIG[FREETYPE_FONT_VERSION]="86bc8a95056c97a810986434a3f268cbe67f2902" # 2.9.1
BUILD_CONFIG[FREETYPE_FONT_BUILD_TYPE_PARAM]=""

case "${BUILD_CONFIG[OS_KERNEL_NAME]}" in
Expand Down
37 changes: 23 additions & 14 deletions sbin/prepareWorkspace.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ source "$SCRIPT_DIR/common/constants.sh"
ALSA_LIB_VERSION=${ALSA_LIB_VERSION:-1.1.6}
ALSA_LIB_CHECKSUM=${ALSA_LIB_CHECKSUM:-5f2cd274b272cae0d0d111e8a9e363f08783329157e8dd68b3de0c096de6d724}
FREEMARKER_LIB_CHECKSUM=${FREEMARKER_LIB_CHECKSUM:-8723ec9ffe006e8d376b6c7dbe7950db34ad1fa163aef4026e6477151a1a0deb}
FREETYPE_LIB_CHECKSUM=${FREETYPE_LIB_CHECKSUM:-ec391504e55498adceb30baceebd147a6e963f636eb617424bcfc47a169898ce}

FREETYPE_FONT_SHARED_OBJECT_FILENAME="libfreetype.so*"
FREEMARKER_LIB_VERSION=${FREEMARKER_LIB_VERSION:-2.3.31}
Expand Down Expand Up @@ -441,7 +440,7 @@ downloadFile() {
fi
}

# Get Freetype
# Clone Freetype from GitHub
checkingAndDownloadingFreeType() {
cd "${BUILD_CONFIG[WORKSPACE_DIR]}/libs/" || exit
echo "Checking for freetype at ${BUILD_CONFIG[WORKSPACE_DIR]}/${BUILD_CONFIG[WORKING_DIR]}"
Expand All @@ -452,25 +451,35 @@ checkingAndDownloadingFreeType() {
if [[ -n "$FOUND_FREETYPE" ]]; then
echo "Skipping FreeType download"
else
downloadFile "freetype.tar.gz" "https://ci.adoptopenjdk.net/userContent/freetype/freetype-${BUILD_CONFIG[FREETYPE_FONT_VERSION]}.tar.gz"
downloadFile "freetype.tar.gz.sig" "https://ci.adoptopenjdk.net/userContent/freetype/freetype-${BUILD_CONFIG[FREETYPE_FONT_VERSION]}.tar.gz.sig"
checkFingerprint "freetype.tar.gz.sig" "freetype.tar.gz" "freetype" "58E0 C111 E39F 5408 C5D3 EC76 C1A6 0EAC E707 FDA5" "${FREETYPE_LIB_CHECKSUM}"

FREETYPE_BUILD_INFO="https://ci.adoptopenjdk.net/userContent/freetype/freetype-${BUILD_CONFIG[FREETYPE_FONT_VERSION]}.tar.gz"

# Delete existing freetype folder if it exists
rm -rf "./freetype" || true
mkdir -p "freetype" || true
tar xpzf freetype.tar.gz --strip-components=1 -C "freetype"
rm freetype.tar.gz

case ${BUILD_CONFIG[FREETYPE_FONT_VERSION]} in
*.*)
# Replace . with - in version number e.g 2.8.1 -> 2-8-1
FREETYPE_BRANCH="VER-${BUILD_CONFIG[FREETYPE_FONT_VERSION]//./-}"
git clone https://github.com/freetype/freetype.git -b "${FREETYPE_BRANCH}" freetype || exit
;;
*)
# Use specific git hash
git clone https://github.com/freetype/freetype.git freetype || exit
cd freetype || exit
git checkout "${BUILD_CONFIG[FREETYPE_FONT_VERSION]}" || exit
cd .. || exit
;;
esac

# Fetch the sha for the commit we just cloned
cd freetype || exit
FREETYPE_SHA=$(git rev-parse HEAD) || exit
FREETYPE_BUILD_INFO="https://github.com/freetype/freetype/commit/${FREETYPE_SHA}"

if [[ "$OSTYPE" == "cygwin" ]] || [[ "$OSTYPE" == "msys" ]]; then
# Record buildinfo version
echo "${FREETYPE_BUILD_INFO}" > "${BUILD_CONFIG[WORKSPACE_DIR]}/${BUILD_CONFIG[TARGET_DIR]}/metadata/dependency_version_freetype.txt"
return
fi

cd freetype || exit

local pngArg=""
if ./configure --help | grep "with-png"; then
pngArg="--with-png=no"
Expand All @@ -483,7 +492,7 @@ checkingAndDownloadingFreeType() {

# We get the files we need at $WORKING_DIR/installedfreetype
# shellcheck disable=SC2046
if ! (eval "${freetypeEnv}" && bash ./configure --prefix="${BUILD_CONFIG[WORKSPACE_DIR]}/${BUILD_CONFIG[WORKING_DIR]}"/installedfreetype "${pngArg}" "${BUILD_CONFIG[FREETYPE_FONT_BUILD_TYPE_PARAM]}" && ${BUILD_CONFIG[MAKE_COMMAND_NAME]} all && ${BUILD_CONFIG[MAKE_COMMAND_NAME]} install); then
if ! (eval "${freetypeEnv}" && bash ./autogen.sh && bash ./configure --prefix="${BUILD_CONFIG[WORKSPACE_DIR]}/${BUILD_CONFIG[WORKING_DIR]}"/installedfreetype "${pngArg}" "${BUILD_CONFIG[FREETYPE_FONT_BUILD_TYPE_PARAM]}" && ${BUILD_CONFIG[MAKE_COMMAND_NAME]} all && ${BUILD_CONFIG[MAKE_COMMAND_NAME]} install); then
# shellcheck disable=SC2154
echo "Failed to configure and build libfreetype, exiting"
exit
Expand Down

0 comments on commit 9204887

Please sign in to comment.