Skip to content
Permalink
Browse files
8249821: Separate libharfbuzz from libfontmanager
Reviewed-by: yan
Backport-of: b1ff2bd
  • Loading branch information
Olga Mikhaltsova authored and Yuri Nesterenko committed Dec 9, 2021
1 parent f4c051e commit ee326256c568ad1e839362cbd20e68900d18feaf
Showing 199 changed files with 68 additions and 23 deletions.
@@ -537,11 +537,16 @@ endif

###########################################################################

#### Begin harfbuzz configuration

HARFBUZZ_CFLAGS := -DHAVE_OT -DHAVE_FALLBACK -DHAVE_UCDN -DHAVE_ROUND

ifeq ($(call isTargetOs, windows), false)
# This is better than adding EXPORT_ALL_SYMBOLS
ifneq ($(filter $(TOOLCHAIN_TYPE), gcc clang), )
HARFBUZZ_CFLAGS += -DHB_EXTERN=__attribute__\(\(visibility\(\"default\"\)\)\)
else ifeq ($(TOOLCHAIN_TYPE), microsoft)
HARFBUZZ_CFLAGS += -DHB_EXTERN=__declspec\(dllexport\)
endif

ifeq ($(call isTargetOs, windows), false)
HARFBUZZ_CFLAGS += -DGETPAGESIZE -DHAVE_MPROTECT -DHAVE_PTHREAD \
-DHAVE_SYSCONF -DHAVE_SYS_MMAN_H -DHAVE_UNISTD_H \
-DHB_NO_PRAGMA_GCC_DIAGNOSTIC
@@ -556,27 +561,74 @@ ifeq ($(call isTargetOs, macosx), true)
HARFBUZZ_CFLAGS += -DHAVE_CORETEXT
endif
ifeq ($(call isTargetOs, macosx), false)
LIBFONTMANAGER_EXCLUDE_FILES += harfbuzz/hb-coretext.cc
LIBHARFBUZZ_EXCLUDE_FILES += harfbuzz/hb-coretext.cc
endif
# hb-ft.cc is not presently needed, and requires freetype 2.4.2 or later.
LIBFONTMANAGER_EXCLUDE_FILES += harfbuzz/hb-ft.cc
LIBHARFBUZZ_EXCLUDE_FILES += harfbuzz/hb-ft.cc

LIBFONTMANAGER_CFLAGS += $(HARFBUZZ_CFLAGS)
LIBHARFBUZZ_CFLAGS += $(HARFBUZZ_CFLAGS)

# For use by libfontmanager:
ifeq ($(call isTargetOs, windows), true)
LIBHARFBUZZ_LIBS := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libharfbuzz/harfbuzz.lib
else
LIBHARFBUZZ_LIBS := -lharfbuzz
endif

LIBHARFBUZZ_EXTRA_HEADER_DIRS := \
libharfbuzz/hb-ucdn \
#

#### End harfbuzz configuration
LIBHARFBUZZ_OPTIMIZATION := HIGH

LIBHARFBUZZ_CFLAGS += $(X_CFLAGS) -DLE_STANDALONE -DHEADLESS

$(eval $(call SetupJdkLibrary, BUILD_LIBHARFBUZZ, \
NAME := harfbuzz, \
EXCLUDE_FILES := $(LIBHARFBUZZ_EXCLUDE_FILES), \
TOOLCHAIN := TOOLCHAIN_LINK_CXX, \
CFLAGS := $(CFLAGS_JDKLIB) $(LIBHARFBUZZ_CFLAGS), \
CXXFLAGS := $(CXXFLAGS_JDKLIB) $(LIBHARFBUZZ_CFLAGS), \
OPTIMIZATION := $(LIBHARFBUZZ_OPTIMIZATION), \
CFLAGS_windows = -DCC_NOEX, \
EXTRA_HEADER_DIRS := $(LIBHARFBUZZ_EXTRA_HEADER_DIRS), \
WARNINGS_AS_ERRORS_xlc := false, \
DISABLED_WARNINGS_gcc := type-limits missing-field-initializers strict-aliasing, \
DISABLED_WARNINGS_CXX_gcc := reorder delete-non-virtual-dtor strict-overflow \
maybe-uninitialized class-memaccess, \
DISABLED_WARNINGS_clang := unused-value incompatible-pointer-types \
tautological-constant-out-of-range-compare int-to-pointer-cast \
undef missing-field-initializers, \
DISABLED_WARNINGS_microsoft := 4267 4244 4090 4146 4334 4819 4101 4068 4805 4138, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
LDFLAGS_unix := -L$(INSTALL_LIBRARIES_HERE), \
LDFLAGS_aix := -Wl$(COMMA)-berok, \
LIBS := $(BUILD_LIBHARFBUZZ), \
LIBS_unix := $(LIBM) $(LIBCXX), \
LIBS_macosx := -framework CoreText -framework CoreFoundation -framework CoreGraphics, \
LIBS_windows := user32.lib, \
))

ifeq ($(FREETYPE_TO_USE), bundled)
$(BUILD_LIBHARFBUZZ): $(BUILD_LIBFREETYPE)
endif

TARGETS += $(BUILD_LIBHARFBUZZ)

###########################################################################

LIBFONTMANAGER_EXTRA_HEADER_DIRS := \
libfontmanager/harfbuzz \
libfontmanager/harfbuzz/hb-ucdn \
libharfbuzz \
common/awt \
common/font \
libawt/java2d \
libawt/java2d/pipe \
libawt/java2d/loops \
#

LIBFONTMANAGER_CFLAGS += $(LIBFREETYPE_CFLAGS)
BUILD_LIBFONTMANAGER_FONTLIB += $(LIBFREETYPE_LIBS)
LIBFONTMANAGER_CFLAGS += $(LIBFREETYPE_CFLAGS) $(HARFBUZZ_FLAGS)
BUILD_LIBFONTMANAGER_FONTLIB += $(LIBHARFBUZZ_LIBS) $(LIBFREETYPE_LIBS)

LIBFONTMANAGER_OPTIMIZATION := HIGH

@@ -617,36 +669,29 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBFONTMANAGER, \
CFLAGS_windows = -DCC_NOEX, \
EXTRA_HEADER_DIRS := $(LIBFONTMANAGER_EXTRA_HEADER_DIRS), \
WARNINGS_AS_ERRORS_xlc := false, \
DISABLED_WARNINGS_gcc := sign-compare int-to-pointer-cast \
type-limits missing-field-initializers implicit-fallthrough \
strict-aliasing undef unused-function, \
DISABLED_WARNINGS_CXX_gcc := reorder delete-non-virtual-dtor strict-overflow \
maybe-uninitialized class-memaccess, \
DISABLED_WARNINGS_clang := unused-value incompatible-pointer-types \
tautological-constant-out-of-range-compare int-to-pointer-cast \
sign-compare undef missing-field-initializers, \
DISABLED_WARNINGS_gcc := sign-compare unused-function, \
DISABLED_WARNINGS_clang := sign-compare, \
DISABLED_WARNINGS_microsoft := 4018 4146 4244 4996, \
DISABLED_WARNINGS_C_solstudio = \
E_INTEGER_OVERFLOW_DETECTED \
E_ARG_INCOMPATIBLE_WITH_ARG_L \
E_ENUM_VAL_OVERFLOWS_INT_MAX, \
DISABLED_WARNINGS_CXX_solstudio := \
truncwarn wvarhidenmem wvarhidemem wbadlkginit identexpected \
hidevf w_novirtualdescr arrowrtn2 refmemnoconstr_aggr unknownpragma, \
DISABLED_WARNINGS_microsoft := 4267 4244 4018 4090 4996 4146 4334 4819 4101 4068 4805 4138, \
LDFLAGS := $(subst -Xlinker -z -Xlinker defs,, \
$(subst -Wl$(COMMA)-z$(COMMA)defs,,$(LDFLAGS_JDKLIB))) $(LDFLAGS_CXX_JDK) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
LDFLAGS_unix := -L$(INSTALL_LIBRARIES_HERE), \
LDFLAGS_aix := -Wl$(COMMA)-berok, \
LIBS := $(BUILD_LIBFONTMANAGER_FONTLIB), \
LIBS_unix := -lawt -ljava -ljvm $(LIBM) $(LIBCXX), \
LIBS_macosx := -lawt_lwawt -framework CoreText -framework CoreFoundation \
-framework CoreGraphics, \
LIBS_macosx := -lawt_lwawt, \
LIBS_windows := $(WIN_JAVA_LIB) advapi32.lib user32.lib gdi32.lib \
$(WIN_AWT_LIB), \
))

$(BUILD_LIBFONTMANAGER): $(BUILD_LIBAWT)
$(BUILD_LIBFONTMANAGER): $(BUILD_LIBAWT) $(BUILD_LIBHARFBUZZ)

ifeq ($(call isTargetOs, macosx), true)
$(BUILD_LIBFONTMANAGER): $(call FindLib, $(MODULE), awt_lwawt)