Blame system-lcms.patch

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