Blame SOURCES/jdk8042159-allow_using_system_installed_lcms2-jdk.patch

53c576
diff --git openjdk.orig/jdk/make/lib/Awt2dLibraries.gmk openjdk/jdk/make/lib/Awt2dLibraries.gmk
53c576
--- openjdk.orig/jdk/make/lib/Awt2dLibraries.gmk
53c576
+++ openjdk/jdk/make/lib/Awt2dLibraries.gmk
53c576
@@ -665,18 +665,35 @@
53c576
  endif
53c576
 endif
53c576
 
53c576
+LIBLCMS_DIR := $(JDK_TOPDIR)/src/share/native/sun/java2d/cmm/lcms
53c576
+
53c576
+ifeq ($(USE_EXTERNAL_LCMS), true)
53c576
+  # If we're using an external library, we'll just need the wrapper part.
53c576
+  # By including it explicitely, all other files will be excluded.
53c576
+  BUILD_LIBLCMS_INCLUDE_FILES := LCMS.c
53c576
+  BUILD_LIBLCMS_HEADERS :=
53c576
+else
53c576
+  BUILD_LIBLCMS_INCLUDE_FILES :=
53c576
+  # If we're using the bundled library, we'll need to include it in the
53c576
+  # include path explicitly. Otherwise the system headers will be used.
53c576
+  BUILD_LIBLCMS_HEADERS := -I$(LIBLCMS_DIR)
53c576
+endif
53c576
+
53c576
 # TODO: Update awt lib path when awt is converted
53c576
 $(eval $(call SetupNativeCompilation,BUILD_LIBLCMS, \
53c576
     LIBRARY := lcms, \
53c576
     OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
53c576
-    SRC := $(JDK_TOPDIR)/src/share/native/sun/java2d/cmm/lcms, \
53c576
+    SRC := $(LIBLCMS_DIR), \
53c576
+    INCLUDE_FILES := $(BUILD_LIBLCMS_INCLUDE_FILES), \
53c576
     LANG := C, \
53c576
     OPTIMIZATION := HIGHEST, \
53c576
     CFLAGS := $(filter-out -xc99=%none, $(CFLAGS_JDKLIB)) \
53c576
         -DCMS_DONT_USE_FAST_FLOOR \
53c576
         $(SHARED_LIBRARY_FLAGS) \
53c576
         -I$(JDK_TOPDIR)/src/share/native/sun/java2d \
53c576
-        -I$(JDK_TOPDIR)/src/share/native/sun/awt/debug, \
53c576
+        -I$(JDK_TOPDIR)/src/share/native/sun/awt/debug \
53c576
+        $(BUILD_LIBLCMS_HEADERS) \
53c576
+        $(LCMS_CFLAGS), \
53c576
     CFLAGS_solaris := -xc99=no_lib, \
53c576
     CFLAGS_windows := -DCMS_IS_WINDOWS_, \
53c576
     MAPFILE := $(JDK_TOPDIR)/make/mapfiles/liblcms/mapfile-vers, \
53c576
@@ -684,10 +701,10 @@
53c576
         $(call SET_SHARED_LIBRARY_ORIGIN), \
53c576
     LDFLAGS_solaris := /usr/lib$(OPENJDK_TARGET_CPU_ISADIR)/libm.so.2, \
53c576
     LDFLAGS_windows := $(WIN_AWT_LIB) $(WIN_JAVA_LIB), \
53c576
-    LDFLAGS_SUFFIX_solaris := -lawt -ljava -ljvm -lc, \
53c576
-    LDFLAGS_SUFFIX_macosx := $(LIBM) -lawt -ljava -ljvm, \
53c576
-    LDFLAGS_SUFFIX_linux := -lm -lawt -ljava -ljvm, \
53c576
-    LDFLAGS_SUFFIX_aix := -lm -lawt -ljava -ljvm,\
53c576
+    LDFLAGS_SUFFIX_solaris := -lawt -ljava -ljvm -lc $(LCMS_LIBS), \
53c576
+    LDFLAGS_SUFFIX_macosx := $(LIBM) -lawt -ljava -ljvm $(LCMS_LIBS), \
53c576
+    LDFLAGS_SUFFIX_linux := -lm -lawt -ljava -ljvm $(LCMS_LIBS), \
53c576
+    LDFLAGS_SUFFIX_aix := -lm -lawt -ljava -ljvm $(LCMS_LIBS),\
53c576
     VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
53c576
     RC_FLAGS := $(RC_FLAGS) \
53c576
         -D "JDK_FNAME=lcms.dll" \
53c576
diff --git openjdk.orig/jdk/src/share/native/sun/java2d/cmm/lcms/LCMS.c openjdk/jdk/src/share/native/sun/java2d/cmm/lcms/LCMS.c
53c576
--- openjdk.orig/jdk/src/share/native/sun/java2d/cmm/lcms/LCMS.c
53c576
+++ openjdk/jdk/src/share/native/sun/java2d/cmm/lcms/LCMS.c
53c576
@@ -30,7 +30,7 @@
53c576
 #include "jni_util.h"
53c576
 #include "Trace.h"
53c576
 #include "Disposer.h"
53c576
-#include "lcms2.h"
53c576
+#include <lcms2.h>
53c576
 #include "jlong.h"
53c576
 
53c576