Blame SOURCES/jdk8042159-allow_using_system_installed_lcms2-jdk.patch

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