Blame SOURCES/jdk8042159-allow_using_system_installed_lcms2-jdk.patch

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