8250894: Provide a configure option to build and run against the platform libharfbuzz

Reviewed-by: erikj
This commit is contained in:
Phil Race 2020-08-04 12:20:37 -07:00
parent 42f4170b2a
commit 84e397b4de
5 changed files with 122 additions and 58 deletions

View File

@ -101,6 +101,8 @@ apt_help() {
PKGHANDLER_COMMAND="sudo apt-get install libfontconfig1-dev" ;; PKGHANDLER_COMMAND="sudo apt-get install libfontconfig1-dev" ;;
freetype) freetype)
PKGHANDLER_COMMAND="sudo apt-get install libfreetype6-dev" ;; PKGHANDLER_COMMAND="sudo apt-get install libfreetype6-dev" ;;
harfbuzz)
PKGHANDLER_COMMAND="sudo apt-get install libharfbuzz-dev" ;;
ffi) ffi)
PKGHANDLER_COMMAND="sudo apt-get install libffi-dev" ;; PKGHANDLER_COMMAND="sudo apt-get install libffi-dev" ;;
x11) x11)
@ -124,6 +126,8 @@ zypper_help() {
PKGHANDLER_COMMAND="sudo zypper install fontconfig-devel" ;; PKGHANDLER_COMMAND="sudo zypper install fontconfig-devel" ;;
freetype) freetype)
PKGHANDLER_COMMAND="sudo zypper install freetype-devel" ;; PKGHANDLER_COMMAND="sudo zypper install freetype-devel" ;;
harfbuzz)
PKGHANDLER_COMMAND="sudo zypper install harfbuzz-devel" ;;
x11) x11)
PKGHANDLER_COMMAND="sudo zypper install libX11-devel libXext-devel libXrender-devel libXrandr-devel libXtst-devel libXt-devel libXi-devel" ;; PKGHANDLER_COMMAND="sudo zypper install libX11-devel libXext-devel libXrender-devel libXrandr-devel libXtst-devel libXt-devel libXi-devel" ;;
ccache) ccache)
@ -143,6 +147,8 @@ yum_help() {
PKGHANDLER_COMMAND="sudo yum install fontconfig-devel" ;; PKGHANDLER_COMMAND="sudo yum install fontconfig-devel" ;;
freetype) freetype)
PKGHANDLER_COMMAND="sudo yum install freetype-devel" ;; PKGHANDLER_COMMAND="sudo yum install freetype-devel" ;;
harfbuzz)
PKGHANDLER_COMMAND="sudo yum install harfbuzz-devel" ;;
x11) x11)
PKGHANDLER_COMMAND="sudo yum install libXtst-devel libXt-devel libXrender-devel libXrandr-devel libXi-devel" ;; PKGHANDLER_COMMAND="sudo yum install libXtst-devel libXt-devel libXrender-devel libXrandr-devel libXi-devel" ;;
ccache) ccache)

View File

@ -40,6 +40,7 @@ AC_DEFUN_ONCE([LIB_SETUP_BUNDLED_LIBS],
LIB_SETUP_LIBPNG LIB_SETUP_LIBPNG
LIB_SETUP_ZLIB LIB_SETUP_ZLIB
LIB_SETUP_LCMS LIB_SETUP_LCMS
LIB_SETUP_HARFBUZZ
]) ])
################################################################################ ################################################################################
@ -263,3 +264,43 @@ AC_DEFUN_ONCE([LIB_SETUP_LCMS],
AC_SUBST(LCMS_CFLAGS) AC_SUBST(LCMS_CFLAGS)
AC_SUBST(LCMS_LIBS) AC_SUBST(LCMS_LIBS)
]) ])
################################################################################
# Setup harfbuzz
################################################################################
AC_DEFUN_ONCE([LIB_SETUP_HARFBUZZ],
[
AC_ARG_WITH(harfbuzz, [AS_HELP_STRING([--with-harfbuzz],
[use harfbuzz from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])])
AC_MSG_CHECKING([for which harfbuzz to use])
DEFAULT_HARFBUZZ=bundled
# If user didn't specify, use DEFAULT_HARFBUZZ
if test "x${with_harfbuzz}" = "x"; then
with_harfbuzz=${DEFAULT_HARFBUZZ}
fi
if test "x${with_harfbuzz}" = "xbundled"; then
USE_EXTERNAL_HARFBUZZ=false
HARFBUZZ_CFLAGS=""
HARFBUZZ_LIBS=""
AC_MSG_RESULT([bundled])
elif test "x${with_harfbuzz}" = "xsystem"; then
AC_MSG_RESULT([system])
PKG_CHECK_MODULES([HARFBUZZ], [harfbuzz], [HARFBUZZ_FOUND=yes], [HARFBUZZ_FOUND=no])
if test "x${HARFBUZZ_FOUND}" = "xyes"; then
# PKG_CHECK_MODULES will set HARFBUZZ_CFLAGS and HARFBUZZ_LIBS
USE_EXTERNAL_HARFBUZZ=true
else
HELP_MSG_MISSING_DEPENDENCY([harfbuzz])
AC_MSG_ERROR([--with-harfbuzz=system specified, but no harfbuzz found! $HELP_MSG])
fi
else
AC_MSG_ERROR([Invalid value for --with-harfbuzz: ${with_harfbuzz}, use 'system' or 'bundled'])
fi
AC_SUBST(USE_EXTERNAL_HARFBUZZ)
AC_SUBST(HARFBUZZ_CFLAGS)
AC_SUBST(HARFBUZZ_LIBS)
])

View File

@ -824,6 +824,10 @@ USE_EXTERNAL_LCMS:=@USE_EXTERNAL_LCMS@
LCMS_CFLAGS:=@LCMS_CFLAGS@ LCMS_CFLAGS:=@LCMS_CFLAGS@
LCMS_LIBS:=@LCMS_LIBS@ LCMS_LIBS:=@LCMS_LIBS@
USE_EXTERNAL_HARFBUZZ:=@USE_EXTERNAL_HARFBUZZ@
HARFBUZZ_CFLAGS:=@HARFBUZZ_CFLAGS@
HARFBUZZ_LIBS:=@HARFBUZZ_LIBS@
USE_EXTERNAL_LIBPNG:=@USE_EXTERNAL_LIBPNG@ USE_EXTERNAL_LIBPNG:=@USE_EXTERNAL_LIBPNG@
PNG_LIBS:=@PNG_LIBS@ PNG_LIBS:=@PNG_LIBS@
PNG_CFLAGS:=@PNG_CFLAGS@ PNG_CFLAGS:=@PNG_CFLAGS@

View File

@ -71,6 +71,10 @@ ifeq ($(FREETYPE_TO_USE), system)
LEGAL_EXCLUDES += freetype.md LEGAL_EXCLUDES += freetype.md
endif endif
ifeq ($(USE_EXTERNAL_HARFBUZZ), true)
LEGAL_EXCLUDES += harfbuzz.md
endif
$(eval $(call SetupCopyLegalFiles, COPY_LEGAL, \ $(eval $(call SetupCopyLegalFiles, COPY_LEGAL, \
EXCLUDES := $(LEGAL_EXCLUDES), \ EXCLUDES := $(LEGAL_EXCLUDES), \
)) ))

View File

@ -432,6 +432,9 @@ endif
########################################################################### ###########################################################################
ifeq ($(USE_EXTERNAL_HARFBUZZ), true)
LIBHARFBUZZ_LIBS := $(HARFBUZZ_LIBS)
else
HARFBUZZ_CFLAGS := -DHAVE_OT -DHAVE_FALLBACK -DHAVE_UCDN -DHAVE_ROUND HARFBUZZ_CFLAGS := -DHAVE_OT -DHAVE_FALLBACK -DHAVE_UCDN -DHAVE_ROUND
# This is better than adding EXPORT_ALL_SYMBOLS # This is better than adding EXPORT_ALL_SYMBOLS
@ -508,6 +511,8 @@ endif
TARGETS += $(BUILD_LIBHARFBUZZ) TARGETS += $(BUILD_LIBHARFBUZZ)
endif
########################################################################### ###########################################################################
LIBFONTMANAGER_EXTRA_HEADER_DIRS := \ LIBFONTMANAGER_EXTRA_HEADER_DIRS := \
@ -576,7 +581,11 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBFONTMANAGER, \
$(WIN_AWT_LIB), \ $(WIN_AWT_LIB), \
)) ))
$(BUILD_LIBFONTMANAGER): $(BUILD_LIBAWT) $(BUILD_LIBHARFBUZZ) $(BUILD_LIBFONTMANAGER): $(BUILD_LIBAWT)
ifeq ($(USE_EXTERNAL_HARFBUZZ), false)
$(BUILD_LIBFONTMANAGER): $(BUILD_LIBHARFBUZZ)
endif
ifeq ($(call isTargetOs, macosx), true) ifeq ($(call isTargetOs, macosx), true)
$(BUILD_LIBFONTMANAGER): $(call FindLib, $(MODULE), awt_lwawt) $(BUILD_LIBFONTMANAGER): $(call FindLib, $(MODULE), awt_lwawt)