Blame SOURCES/jdk8042159-allow_using_system_installed_lcms2-jdk.patch

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