Blame SOURCES/jdk8042159-allow_using_system_installed_lcms2-jdk.patch

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