changeset 17446:a436b549c701

8139653: Freetype bundled on macosx, but not correctly linked Reviewed-by: tbell, prr
author erikj
date Thu, 30 Nov 2017 17:31:20 -0800
parents 905c01632fa3
children d5039fb1ca9b
files make/copy/Copy-java.desktop.gmk make/lib/Awt2dLibraries.gmk
diffstat 2 files changed, 20 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/make/copy/Copy-java.desktop.gmk	Wed Nov 29 14:50:13 2017 -0800
+++ b/make/copy/Copy-java.desktop.gmk	Thu Nov 30 17:31:20 2017 -0800
@@ -44,7 +44,8 @@
 ################################################################################
 
 ifneq ($(FREETYPE_BUNDLE_LIB_PATH), )
-  # We need to bundle the freetype library, so it will be available at runtime as well as link time.
+  # 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
@@ -61,10 +62,10 @@
   #
   #TODO: rework this to avoid hardcoding library name in the makefile
   #
-  ifeq ($(OPENJDK_TARGET_OS), windows)
+  ifneq ($(filter $(OPENJDK_TARGET_OS), linux solaris), )
+    FREETYPE_TARGET_LIB := $(LIB_DST_DIR)/$(call SHARED_LIBRARY,freetype).6
+  else
     FREETYPE_TARGET_LIB := $(LIB_DST_DIR)/$(call SHARED_LIBRARY,freetype)
-  else
-    FREETYPE_TARGET_LIB := $(LIB_DST_DIR)/$(call SHARED_LIBRARY,freetype).6
   endif
 
   # We can't use $(install-file) in this rule because it preserves symbolic links and
--- a/make/lib/Awt2dLibraries.gmk	Wed Nov 29 14:50:13 2017 -0800
+++ b/make/lib/Awt2dLibraries.gmk	Thu Nov 30 17:31:20 2017 -0800
@@ -658,7 +658,7 @@
 
 $(eval $(call SetupNativeCompilation,BUILD_LIBFONTMANAGER, \
     LIBRARY := fontmanager, \
-    OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
+    OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libfontmanager, \
     SRC := $(LIBFONTMANAGER_SRC), \
     EXCLUDE_FILES := $(LIBFONTMANAGER_EXCLUDE_FILES) \
         AccelGlyphCache.c, \
@@ -708,7 +708,20 @@
   $(BUILD_LIBFONTMANAGER): $(BUILD_LIBAWT_HEADLESS)
 endif
 
-TARGETS += $(BUILD_LIBFONTMANAGER)
+$(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
+
+TARGETS += $(INSTALL_LIBRARIES_HERE)/$(call SHARED_LIBRARY,fontmanager)
 
 ################################################################################