make/lib/Awt2dLibraries.gmk
branchihse-jdk-library-branch
changeset 56302 1c7ec9412f91
parent 56287 593a452fcbeb
parent 49239 c35ec365e329
child 56310 b74ed86a116a
--- a/make/lib/Awt2dLibraries.gmk	Wed Mar 14 12:45:08 2018 +0100
+++ b/make/lib/Awt2dLibraries.gmk	Wed Mar 14 12:50:43 2018 +0100
@@ -555,6 +555,39 @@
 
 ################################################################################
 
+ifeq ($(FREETYPE_TO_USE), system)
+  LIBFREETYPE_CFLAGS := $(FREETYPE_CFLAGS)
+  LIBFREETYPE_LIBS := $(FREETYPE_LIBS)
+else
+  LIBFREETYPE_SRC := $(TOPDIR)/src/java.desktop/share/native/libfreetype
+  BUILD_LIBFREETYPE_HEADERS := $(addprefix -I, $(LIBFREETYPE_SRC)/include)
+  LIBFREETYPE_CFLAGS := $(BUILD_LIBFREETYPE_HEADERS)
+  ifeq ($(OPENJDK_TARGET_OS), windows)
+    LIBFREETYPE_LIBS := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libfreetype/freetype.lib
+  else
+    LIBFREETYPE_LIBS := -lfreetype
+  endif
+
+  $(eval $(call SetupJdkLibrary, BUILD_LIBFREETYPE, \
+      NAME := freetype, \
+      SRC := $(LIBFREETYPE_SRC)/src, \
+      OPTIMIZATION := HIGHEST, \
+      CFLAGS := $(CFLAGS_JDKLIB) $(BUILD_LIBFREETYPE_HEADERS) \
+          -DFT2_BUILD_LIBRARY, \
+      DISABLED_WARNINGS_solstudio := \
+         E_STATEMENT_NOT_REACHED \
+         E_END_OF_LOOP_CODE_NOT_REACHED, \
+      DISABLED_WARNINGS_microsoft := 4267 2220 4244, \
+      LDFLAGS := $(LDFLAGS_JDKLIB) \
+          $(call SET_SHARED_LIBRARY_ORIGIN), \
+      LIBS_solaris := -lc, \
+  ))
+
+  TARGETS += $(BUILD_LIBFREETYPE)
+endif
+
+###########################################################################
+
 LIBFONTMANAGER_SRC := $(TOPDIR)/src/java.desktop/share/native/libfontmanager \
     $(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libfontmanager
 LIBFONTMANAGER_CFLAGS := \
@@ -595,10 +628,10 @@
 
 #### End harfbuzz configuration
 
-LIBFONTMANAGER_CFLAGS += $(FREETYPE_CFLAGS)
+LIBFONTMANAGER_CFLAGS += $(LIBFREETYPE_CFLAGS)
 # This may be overridden in a custom makefile
 BUILD_LIBFONTMANAGER_MAPFILE ?= $(TOPDIR)/make/mapfiles/libfontmanager/mapfile-vers
-BUILD_LIBFONTMANAGER_FONTLIB += $(FREETYPE_LIBS)
+BUILD_LIBFONTMANAGER_FONTLIB += $(LIBFREETYPE_LIBS)
 
 LIBFONTMANAGER_OPTIMIZATION := HIGH
 
@@ -629,7 +662,6 @@
 
 $(eval $(call SetupJdkLibrary, BUILD_LIBFONTMANAGER, \
     NAME := fontmanager, \
-    OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libfontmanager, \
     SRC := $(LIBFONTMANAGER_SRC), \
     EXCLUDE_FILES := $(LIBFONTMANAGER_EXCLUDE_FILES) \
         AccelGlyphCache.c, \
@@ -667,27 +699,16 @@
         $(WIN_AWT_LIB), \
 ))
 
-$(INSTALL_LIBRARIES_HERE)/$(call SHARED_LIBRARY,fontmanager): $(BUILD_LIBFONTMANAGER_TARGET)
-	$(install-file)
-        ifneq ($(FREETYPE_BUNDLE_LIB_PATH), )
-          ifeq ($(OPENJDK_TARGET_OS), macosx)
-            # If bundling freetype on macosx, we need to rewrite the rpath location
-            # in the libfontmanager library to point to the bundled location
-	    $(INSTALL_NAME_TOOL) -change \
-	        `$(OTOOL) -D $(FREETYPE_BUNDLE_LIB_PATH)/$(call SHARED_LIBRARY,freetype) | $(TAIL) -n1` \
-	        '@rpath/$(call SHARED_LIBRARY,freetype)' \
-	        $@
-          endif
-        endif
-
-BUILD_LIBFONTMANAGER += $(INSTALL_LIBRARIES_HERE)/$(call SHARED_LIBRARY,fontmanager)
-
 $(BUILD_LIBFONTMANAGER): $(BUILD_LIBAWT)
 
 ifneq (, $(findstring $(OPENJDK_TARGET_OS), solaris aix))
   $(BUILD_LIBFONTMANAGER): $(BUILD_LIBAWT_HEADLESS)
 endif
 
+ifeq ($(FREETYPE_TO_USE), bundled)
+  $(BUILD_LIBFONTMANAGER): $(BUILD_LIBFREETYPE)
+endif
+
 TARGETS += $(BUILD_LIBFONTMANAGER)
 
 ################################################################################
@@ -876,7 +897,6 @@
   endif
 
   ifeq ($(OPENJDK_TARGET_OS), macosx)
-    LIBSPLASHSCREEN_LDFLAGS := -L$(INSTALL_LIBRARIES_HERE)
     LIBSPLASHSCREEN_LIBS += \
         $(LIBM) -lpthread -liconv -losxapp \
         -framework ApplicationServices \
@@ -884,7 +904,6 @@
         -framework Cocoa \
         -framework JavaNativeFoundation
   else ifeq ($(OPENJDK_TARGET_OS), windows)
-    LIBSPLASHSCREEN_LDFLAGS := -delayload:user32.dll
     LIBSPLASHSCREEN_LIBS += kernel32.lib user32.lib gdi32.lib delayimp.lib $(WIN_JAVA_LIB) jvm.lib
   else
     LIBSPLASHSCREEN_LIBS += $(X_LIBS) -lX11 -lXext $(LIBM) -lpthread -ldl
@@ -905,8 +924,10 @@
           E_STATEMENT_NOT_REACHED, \
       DISABLED_WARNINGS_microsoft := 4018 4244 4267, \
       MAPFILE := $(TOPDIR)/make/mapfiles/libsplashscreen/mapfile-vers, \
-      LDFLAGS := $(LIBSPLASHSCREEN_LDFLAGS) $(LDFLAGS_JDKLIB) \
+      LDFLAGS := $(LDFLAGS_JDKLIB) \
           $(call SET_SHARED_LIBRARY_ORIGIN), \
+      LDFLAGS_macosx := -L$(INSTALL_LIBRARIES_HERE), \
+      LDFLAGS_windows := -delayload:user32.dll, \
       LIBS := $(JDKLIB_LIBS) $(LIBSPLASHSCREEN_LIBS) $(LIBZ_LIBS) \
           $(GIFLIB_LIBS) $(LIBJPEG_LIBS) $(PNG_LIBS), \
       LIBS_aix := -liconv, \