Blame SOURCES/jdk8042159-allow_using_system_installed_lcms2-jdk.patch

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