From e4ff60101141dcd72ee47354b2a435eaf97700da Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Wed, 23 Oct 2013 13:06:37 +0200 Subject: [PATCH] 8001922: Improve freetype handling Reviewed-by: erikj --- jdk/makefiles/CopyFiles.gmk | 48 +++++++++++++--------------- jdk/makefiles/lib/Awt2dLibraries.gmk | 4 +-- 2 files changed, 25 insertions(+), 27 deletions(-) diff --git a/jdk/makefiles/CopyFiles.gmk b/jdk/makefiles/CopyFiles.gmk index 8cfaffc8c1a..02bafafbbe8 100644 --- a/jdk/makefiles/CopyFiles.gmk +++ b/jdk/makefiles/CopyFiles.gmk @@ -215,39 +215,37 @@ COPY_FILES += $(ICCPROFILE_TARGET_FILES) ########################################################################################## -# make sure freetype dll will be available at runtime as well as link time -# -# NB: Default freetype build system uses -h linker option and -# result .so contains hardcoded library name that is later -# used for adding dependencies to other objects -# (e.g. libfontmanager.so). -# -# It is not obvious how to extract that hardcoded name (libfreetype.so.6) -# without overcomplicating logic here. -# To workaround this we hardcode .6 suffix for now. -# -# Note that .so.6 library will not be found by System.loadLibrary() -# but fortunately we need to load FreeType library explicitly -# on windows only -# -#TODO: rework this to avoid hardcoding library name in the makefile -# -ifdef OPENJDK +ifneq ($(FREETYPE_BUNDLE_LIB_PATH), ) + # We need to bundle the freetype library, so it will be available at runtime as well as link time. + # + # NB: Default freetype build system uses -h linker option and + # result .so contains hardcoded library name that is later + # used for adding dependencies to other objects + # (e.g. libfontmanager.so). + # + # It is not obvious how to extract that hardcoded name (libfreetype.so.6) + # without overcomplicating logic here. + # To workaround this we hardcode .6 suffix for now. + # + # Note that .so.6 library will not be found by System.loadLibrary() + # but fortunately we need to load FreeType library explicitly + # on windows only + # + #TODO: rework this to avoid hardcoding library name in the makefile + # ifeq ($(OPENJDK_TARGET_OS), windows) - FREETYPE_LIB = $(JDK_OUTPUTDIR)/bin/$(call SHARED_LIBRARY,freetype) + FREETYPE_TARGET_LIB = $(JDK_OUTPUTDIR)/bin/$(call SHARED_LIBRARY,freetype) else - ifeq ($(USING_SYSTEM_FT_LIB), false) - FREETYPE_LIB = $(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/$(call SHARED_LIBRARY,freetype).6 - endif + FREETYPE_TARGET_LIB = $(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/$(call SHARED_LIBRARY,freetype).6 endif - $(FREETYPE_LIB): $(FREETYPE2_LIB_PATH)/$(call SHARED_LIBRARY,freetype) - $(CP) $(FREETYPE2_LIB_PATH)/$(call SHARED_LIBRARY,freetype) $@ + $(FREETYPE_TARGET_LIB): $(FREETYPE_BUNDLE_LIB_PATH)/$(call SHARED_LIBRARY,freetype) + $(CP) $(FREETYPE_BUNDLE_LIB_PATH)/$(call SHARED_LIBRARY,freetype) $@ ifeq ($(OPENJDK_BUILD_OS), windows) $(CHMOD) +rx $@ endif - COPY_FILES += $(FREETYPE_LIB) + COPY_FILES += $(FREETYPE_TARGET_LIB) endif ########################################################################################## diff --git a/jdk/makefiles/lib/Awt2dLibraries.gmk b/jdk/makefiles/lib/Awt2dLibraries.gmk index a7a91ef6965..0de717c2d7c 100644 --- a/jdk/makefiles/lib/Awt2dLibraries.gmk +++ b/jdk/makefiles/lib/Awt2dLibraries.gmk @@ -780,9 +780,9 @@ ifndef OPENJDK BUILD_LIBFONTMANAGER_MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libfontmanager/mapfile-vers LIBFONTMANAGER_EXCLUDE_FILES += freetypeScaler.c else - FONT_HEADERS := $(FREETYPE2_CFLAGS) + FONT_HEADERS := $(FREETYPE_CFLAGS) BUILD_LIBFONTMANAGER_MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libfontmanager/mapfile-vers.openjdk - BUILD_LIBFONTMANAGER_FONTLIB := $(FREETYPE2_LIBS) + BUILD_LIBFONTMANAGER_FONTLIB := $(FREETYPE_LIBS) endif LIBFONTMANAGER_OPTIMIZATION := HIGH