Blame SOURCES/system-lcms.patch

045ef6
diff -ruN jdk8/common/autoconf/libraries.m4 jdk8/common/autoconf/libraries.m4
045ef6
--- openjdk/common/autoconf/libraries.m4	2013-11-14 22:04:38.039440136 -0500
045ef6
+++ openjdk/common/autoconf/libraries.m4	2013-11-14 22:05:11.474356424 -0500
045ef6
@@ -676,6 +676,46 @@
045ef6
 
045ef6
   ###############################################################################
045ef6
   #
045ef6
+  # Check for the lcms2 library
045ef6
+  #
045ef6
+
045ef6
+  AC_ARG_WITH(lcms, [AS_HELP_STRING([--with-lcms],
045ef6
+  	[use lcms2 from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])])
045ef6
+
045ef6
+  AC_CHECK_LIB(lcms2, cmsOpenProfileFromFile,
045ef6
+               [ LCMS_FOUND=yes ],
045ef6
+               [ LCMS_FOUND=no ])
045ef6
+
045ef6
+  AC_MSG_CHECKING([for which lcms to use])
045ef6
+
045ef6
+  DEFAULT_LCMS=bundled
045ef6
+
045ef6
+  #
045ef6
+  # If user didn't specify, use DEFAULT_LCMS
045ef6
+  #
045ef6
+  if test "x${with_lcms}" = "x"; then
045ef6
+      with_lcms=${DEFAULT_LCMS}
045ef6
+  fi
045ef6
+
045ef6
+  if test "x${with_lcms}" = "xbundled"; then
045ef6
+      USE_EXTERNAL_LCMS=false
045ef6
+      AC_MSG_RESULT([bundled])
045ef6
+  elif test "x${with_lcms}" = "xsystem"; then
045ef6
+      if test "x${LCMS_FOUND}" = "xyes"; then
045ef6
+          USE_EXTERNAL_LCMS=true
045ef6
+          AC_MSG_RESULT([system])
045ef6
+      else
045ef6
+          AC_MSG_RESULT([system not found])
045ef6
+          AC_MSG_ERROR([--with-lcms=system specified, but no lcms found!])
045ef6
+      fi
045ef6
+  else
045ef6
+      AC_MSG_ERROR([Invalid value for --with-lcms: ${with_lcms}, use 'system' or 'bundled'])
045ef6
+  fi
045ef6
+
045ef6
+  AC_SUBST(USE_EXTERNAL_LCMS)
045ef6
+
045ef6
+  ###############################################################################
045ef6
+  #
045ef6
   # Check for the png library
045ef6
   #
045ef6
 
045ef6
diff -ruN jdk8/jdk/make/lib/Awt2dLibraries.gmk jdk8/jdk/make/lib/Awt2dLibraries.gmk
045ef6
--- openjdk/jdk/make/lib/Awt2dLibraries.gmk	2013-11-14 22:04:38.040440133 -0500
045ef6
+++ openjdk/jdk/make/lib/Awt2dLibraries.gmk	2013-11-14 22:05:11.475356411 -0500
045ef6
@@ -666,18 +666,35 @@
045ef6
 
045ef6
 ##########################################################################################
045ef6
 
045ef6
+LIBLCMS_DIR := $(JDK_TOPDIR)/src/share/native/sun/java2d/cmm/lcms
045ef6
+
045ef6
+ifeq ($(USE_EXTERNAL_LCMS), true)
045ef6
+  # If we're using an external library, we'll just need the wrapper part.
045ef6
+  # By including it explicitely, all other files will be excluded.
045ef6
+  BUILD_LIBLCMS_INCLUDE_FILES := LCMS.c
045ef6
+  BUILD_LIBLCMS_HEADERS :=
045ef6
+else
045ef6
+  BUILD_LIBLCMS_INCLUDE_FILES :=
045ef6
+  # If we're using the bundled library, we'll need to include it in the
045ef6
+  # include path explicitly. Otherwise the system headers will be used.
045ef6
+  BUILD_LIBLCMS_HEADERS := -I$(LIBLCMS_DIR)
045ef6
+endif
045ef6
+
045ef6
 # TODO: Update awt lib path when awt is converted
045ef6
 $(eval $(call SetupNativeCompilation,BUILD_LIBLCMS, \
045ef6
     LIBRARY := lcms, \
045ef6
     OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
045ef6
-    SRC := $(JDK_TOPDIR)/src/share/native/sun/java2d/cmm/lcms, \
045ef6
+    SRC := $(LIBLCMS_DIR), \
045ef6
+    INCLUDE_FILES := $(BUILD_LIBLCMS_INCLUDE_FILES), \
045ef6
     LANG := C, \
045ef6
     OPTIMIZATION := HIGHEST, \
045ef6
     CFLAGS := $(filter-out -xc99=%none, $(CFLAGS_JDKLIB)) \
045ef6
         -DCMS_DONT_USE_FAST_FLOOR \
045ef6
         $(SHARED_LIBRARY_FLAGS) \
045ef6
         -I$(JDK_TOPDIR)/src/share/native/sun/java2d \
045ef6
-        -I$(JDK_TOPDIR)/src/share/native/sun/awt/debug, \
045ef6
+        -I$(JDK_TOPDIR)/src/share/native/sun/awt/debug \
045ef6
+        $(BUILD_LIBLCMS_HEADERS) \
045ef6
+        $(LCMS_CFLAGS), \
045ef6
     CFLAGS_solaris := -xc99=no_lib, \
045ef6
     CFLAGS_windows := -DCMS_IS_WINDOWS_, \
045ef6
     MAPFILE := $(JDK_TOPDIR)/make/mapfiles/liblcms/mapfile-vers, \
045ef6
@@ -685,10 +702,10 @@
045ef6
         $(call SET_SHARED_LIBRARY_ORIGIN), \
045ef6
     LDFLAGS_solaris := /usr/lib$(OPENJDK_TARGET_CPU_ISADIR)/libm.so.2, \
045ef6
     LDFLAGS_windows := $(WIN_AWT_LIB) $(WIN_JAVA_LIB), \
045ef6
-    LDFLAGS_SUFFIX_solaris := -lawt -ljava -ljvm -lc, \
045ef6
-    LDFLAGS_SUFFIX_macosx := $(LIBM) -lawt -ljava -ljvm, \
045ef6
-    LDFLAGS_SUFFIX_linux := -lm -lawt -ljava -ljvm, \
045ef6
-    LDFLAGS_SUFFIX_aix := -lm -lawt -ljava -ljvm,\
045ef6
+    LDFLAGS_SUFFIX_solaris := -lawt -ljava -ljvm -lc $(LCMS_LIBS), \
045ef6
+    LDFLAGS_SUFFIX_macosx := $(LIBM) -lawt -ljava -ljvm $(LCMS_LIBS), \
045ef6
+    LDFLAGS_SUFFIX_linux := -lm -lawt -ljava -ljvm $(LCMS_LIBS), \
045ef6
+    LDFLAGS_SUFFIX_aix := -lm -lawt -ljava -ljvm $(LCMS_LIBS),\
045ef6
     VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
045ef6
     RC_FLAGS := $(RC_FLAGS) \
045ef6
         -D "JDK_FNAME=lcms.dll" \
045ef6
diff -r 3d1c3b0b73a3 src/share/native/sun/java2d/cmm/lcms/LCMS.c
045ef6
--- openjdk/jdk/src/share/native/sun/java2d/cmm/lcms/LCMS.c	Tue Sep 08 22:31:26 2015 +0300
045ef6
+++ openjdk/jdk/src/share/native/sun/java2d/cmm/lcms/LCMS.c	Thu Oct 15 05:29:28 2015 +0100
045ef6
@@ -30,7 +30,7 @@
045ef6
 #include "jni_util.h"
045ef6
 #include "Trace.h"
045ef6
 #include "Disposer.h"
045ef6
-#include "lcms2.h"
045ef6
+#include <lcms2.h>
045ef6
 #include "jlong.h"
045ef6
 
045ef6