summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndré Draszik <andre.draszik@jci.com>2018-03-05 09:31:00 +0000
committerMaxin B. John <maxin.john@intel.com>2018-03-06 10:57:12 +0200
commit7e48b81929fec1b8b79686b9dc50ba47eccd5620 (patch)
tree15fdc2e8ed54b7d8cd29150826e04f6c09178008
parentad72b21676a99417605c5b7e6d068ad81142f7b2 (diff)
downloadmeta-java-7e48b81929fec1b8b79686b9dc50ba47eccd5620.tar.gz
openjdk-8: add patches to support building against system libpng & libjpeg
This didn't actually before. Patches taken from Debian / OpenJDK-9. Signed-off-by: André Draszik <andre.draszik@jci.com> Signed-off-by: Maxin B. John <maxin.john@intel.com>
-rw-r--r--recipes-core/openjdk/openjdk-8-cross.inc5
-rw-r--r--recipes-core/openjdk/openjdk-8-native.inc6
-rw-r--r--recipes-core/openjdk/openjdk-8-release-162b12.inc2
-rw-r--r--recipes-core/openjdk/patches-openjdk-8/0003-jdk-Allow-using-a-system-installed-libjpeg.patch262
-rw-r--r--recipes-core/openjdk/patches-openjdk-8/0004-jdk-Allow-using-a-system-installed-libpng.patch148
5 files changed, 420 insertions, 3 deletions
diff --git a/recipes-core/openjdk/openjdk-8-cross.inc b/recipes-core/openjdk/openjdk-8-cross.inc
index 3973fcf..40db2eb 100644
--- a/recipes-core/openjdk/openjdk-8-cross.inc
+++ b/recipes-core/openjdk/openjdk-8-cross.inc
@@ -3,7 +3,7 @@ JRE_HOME = "${libdir_jvm}/openjre-8"
3 3
4DEPENDS = "\ 4DEPENDS = "\
5 openjdk-8-native zip-native ant-native libxslt \ 5 openjdk-8-native zip-native ant-native libxslt \
6 jpeg libpng krb5 libffi fontconfig freetype \ 6 krb5 libffi fontconfig freetype \
7" 7"
8 8
9PRIVATE_LIBS = "\ 9PRIVATE_LIBS = "\
@@ -19,6 +19,7 @@ PACKAGECONFIG ??= " \
19 repack \ 19 repack \
20 ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'x11 cups', '', d)} \ 20 ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'x11 cups', '', d)} \
21 ${@bb.utils.contains('DISTRO_FEATURES', 'alsa', 'alsa', '', d)} \ 21 ${@bb.utils.contains('DISTRO_FEATURES', 'alsa', 'alsa', '', d)} \
22 jpeg png \
22" 23"
23PACKAGECONFIG[x11] = "--with-x,,libx11 xproto libxt libxext libxrender libxtst" 24PACKAGECONFIG[x11] = "--with-x,,libx11 xproto libxt libxext libxrender libxtst"
24PACKAGECONFIG[cups] = "--with-cups,,cups" 25PACKAGECONFIG[cups] = "--with-cups,,cups"
@@ -28,6 +29,8 @@ PACKAGECONFIG[jce] = "--enable-unlimited-crypto,,"
28 29
29PACKAGECONFIG[zip] = "--with-zlib=system,--with-zlib=bundled,zlib," 30PACKAGECONFIG[zip] = "--with-zlib=system,--with-zlib=bundled,zlib,"
30PACKAGECONFIG[gif] = "--with-giflib=system,--with-giflib=bundled,giflib," 31PACKAGECONFIG[gif] = "--with-giflib=system,--with-giflib=bundled,giflib,"
32PACKAGECONFIG[jpeg] = "--with-libjpeg=system,--with-libjpeg=bundled,jpeg,"
33PACKAGECONFIG[png] = "--with-libpng=system,--with-libpng=bundled,libpng,"
31 34
32export WANT_LLVM_RELEASE = "3.5.2" 35export WANT_LLVM_RELEASE = "3.5.2"
33PACKAGECONFIG[zero] = "--with-jvm-variants=zero,,," 36PACKAGECONFIG[zero] = "--with-jvm-variants=zero,,,"
diff --git a/recipes-core/openjdk/openjdk-8-native.inc b/recipes-core/openjdk/openjdk-8-native.inc
index 20e1743..10b31bc 100644
--- a/recipes-core/openjdk/openjdk-8-native.inc
+++ b/recipes-core/openjdk/openjdk-8-native.inc
@@ -2,7 +2,7 @@ JDK_DIR = "openjdk-8-native"
2DEPENDS = "\ 2DEPENDS = "\
3 icedtea7-native ant-native \ 3 icedtea7-native ant-native \
4 libxslt-native attr-native \ 4 libxslt-native attr-native \
5 giflib-native jpeg-native libpng-native \ 5 giflib-native \
6 glib-2.0-native freetype-native fontconfig-native \ 6 glib-2.0-native freetype-native fontconfig-native \
7 zlib-native zip-native \ 7 zlib-native zip-native \
8 unzip-native make-native \ 8 unzip-native make-native \
@@ -11,11 +11,13 @@ DEPENDS = "\
11 11
12SRC_URI_append += "file://handle_extra_output.patch" 12SRC_URI_append += "file://handle_extra_output.patch"
13 13
14PACKAGECONFIG ??= "" 14PACKAGECONFIG ??= "jpeg png"
15PACKAGECONFIG[x11] = "--with-x,,libx11-native xproto-native libxt-native libxext-native libxrender-native" 15PACKAGECONFIG[x11] = "--with-x,,libx11-native xproto-native libxt-native libxext-native libxrender-native"
16PACKAGECONFIG[cups] = "--with-cups,,cups" 16PACKAGECONFIG[cups] = "--with-cups,,cups"
17PACKAGECONFIG[alsa] = "--with-alsa,,alsa-lib-native" 17PACKAGECONFIG[alsa] = "--with-alsa,,alsa-lib-native"
18PACKAGECONFIG[jce] = "--enable-unlimited-crypto,," 18PACKAGECONFIG[jce] = "--enable-unlimited-crypto,,"
19PACKAGECONFIG[jpeg] = "--with-libjpeg=system,--with-libjpeg=bundled,jpeg-native"
20PACKAGECONFIG[png] = "--with-libpng=system,--with-libpng=bundled,libpng-native"
19 21
20EXTRA_OECONF_append = "\ 22EXTRA_OECONF_append = "\
21 --with-jobs=${@java_get_parallel_make(d)} \ 23 --with-jobs=${@java_get_parallel_make(d)} \
diff --git a/recipes-core/openjdk/openjdk-8-release-162b12.inc b/recipes-core/openjdk/openjdk-8-release-162b12.inc
index a36bc6a..d672148 100644
--- a/recipes-core/openjdk/openjdk-8-release-162b12.inc
+++ b/recipes-core/openjdk/openjdk-8-release-162b12.inc
@@ -8,6 +8,8 @@ PATCHES_URI = "\
8 file://openjdk8-prevent-debuginfo-in-favour-of-openembedded-package-split.patch;striplevel=0 \ 8 file://openjdk8-prevent-debuginfo-in-favour-of-openembedded-package-split.patch;striplevel=0 \
9 file://0001-jdk-comparison-between-pointer-and-integer.patch \ 9 file://0001-jdk-comparison-between-pointer-and-integer.patch \
10 file://0002-hotspot-fix-compilation-with-security-flags-enabled.patch \ 10 file://0002-hotspot-fix-compilation-with-security-flags-enabled.patch \
11 file://0003-jdk-Allow-using-a-system-installed-libjpeg.patch \
12 file://0004-jdk-Allow-using-a-system-installed-libpng.patch \
11" 13"
12# some patches extracted from http://cr.openjdk.java.net/~rkennke/shark-build-hotspot/webrev.01/hotspot.patch 14# some patches extracted from http://cr.openjdk.java.net/~rkennke/shark-build-hotspot/webrev.01/hotspot.patch
13# reported via http://mail.openjdk.java.net/pipermail/build-dev/2015-January/013972.html 15# reported via http://mail.openjdk.java.net/pipermail/build-dev/2015-January/013972.html
diff --git a/recipes-core/openjdk/patches-openjdk-8/0003-jdk-Allow-using-a-system-installed-libjpeg.patch b/recipes-core/openjdk/patches-openjdk-8/0003-jdk-Allow-using-a-system-installed-libjpeg.patch
new file mode 100644
index 0000000..a40e11f
--- /dev/null
+++ b/recipes-core/openjdk/patches-openjdk-8/0003-jdk-Allow-using-a-system-installed-libjpeg.patch
@@ -0,0 +1,262 @@
1From a6746c1ee43a63e79b5405e40c463d00160bc02e Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Andr=C3=A9=20Draszik?= <andre.draszik@jci.com>
3Date: Tue, 27 Feb 2018 13:36:53 +0000
4Subject: [PATCH 3/8] jdk: Allow using a system-installed libjpeg
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9Patch stolen (and some typos corrected) from debian patch,
10which itself was a backport from:
11 http://hg.openjdk.java.net/jdk9/client/rev/bfd9a3e1aeb5
12 http://hg.openjdk.java.net/jdk9/client/jdk/rev/320743f0b4fc
13
14Issues fixed on top of debian patch:
15 * imageIOJPEG.c -> imageioJPEG.c
16 * $(LIBJPEG_LIBS) must be added to LDFLAGS_SUFFIX, not
17 LDFLAGS as it otherwise doesn't make it into the linker
18 command line and then fails when using -Wl,-z,now in
19 LDFLAGS (as done when 'security' is enabled)
20
21Upstream-Status: Backport
22Signed-off-by: André Draszik <andre.draszik@jci.com>
23---
24 common/autoconf/libraries.m4 | 35 +++++++++--
25 jdk/make/lib/Awt2dLibraries.gmk | 69 +++++++++++++++-------
26 .../sun/imageio/plugins/jpeg/JPEGImageReader.java | 2 +-
27 .../sun/imageio/plugins/jpeg/JPEGImageWriter.java | 2 +-
28 .../classes/sun/awt/image/JPEGImageDecoder.java | 2 +-
29 .../share/native/sun/awt/image/jpeg/imageioJPEG.c | 2 +-
30 6 files changed, 81 insertions(+), 31 deletions(-)
31
32diff --git a/common/autoconf/libraries.m4 b/common/autoconf/libraries.m4
33index 91b8ed7f..3f5f69b1 100644
34--- a/common/autoconf/libraries.m4
35+++ b/common/autoconf/libraries.m4
36@@ -595,11 +595,36 @@ AC_DEFUN_ONCE([LIB_SETUP_MISC_LIBS],
37 # Check for the jpeg library
38 #
39
40- USE_EXTERNAL_LIBJPEG=true
41- AC_CHECK_LIB(jpeg, main, [],
42- [ USE_EXTERNAL_LIBJPEG=false
43- AC_MSG_NOTICE([Will use jpeg decoder bundled with the OpenJDK source])
44- ])
45+ AC_ARG_WITH(libjpeg, [AS_HELP_STRING([--with-libjpeg],
46+ [use libjpeg from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])])
47+
48+ AC_MSG_CHECKING([for which libjpeg to use])
49+
50+ # default is bundled
51+ DEFAULT_LIBJPEG=bundled
52+
53+ #
54+ # if user didn't specify, use DEFAULT_LIBJPEG
55+ #
56+ if test "x${with_libjpeg}" = "x"; then
57+ with_libjpeg=${DEFAULT_LIBJPEG}
58+ fi
59+
60+ AC_MSG_RESULT(${with_libjpeg})
61+
62+ if test "x${with_libjpeg}" = "xbundled"; then
63+ USE_EXTERNAL_LIBJPEG=false
64+ elif test "x${with_libjpeg}" = "xsystem"; then
65+ AC_CHECK_HEADER(jpeglib.h, [],
66+ [ AC_MSG_ERROR([--with-libjpeg=system specified, but jpeglib.h not found!])])
67+ AC_CHECK_LIB(jpeg, jpeg_CreateDecompress, [],
68+ [ AC_MSG_ERROR([--with-libjpeg=system specified, but no libjpeg found])])
69+
70+ USE_EXTERNAL_LIBJPEG=true
71+ else
72+ AC_MSG_ERROR([Invalid use of --with-libjpeg: ${with_libjpeg}, use 'system' or 'bundled'])
73+ fi
74+
75 AC_SUBST(USE_EXTERNAL_LIBJPEG)
76
77 ###############################################################################
78diff --git a/jdk/make/lib/Awt2dLibraries.gmk b/jdk/make/lib/Awt2dLibraries.gmk
79index aa7efc4a..8872a8e8 100644
80--- a/jdk/make/lib/Awt2dLibraries.gmk
81+++ b/jdk/make/lib/Awt2dLibraries.gmk
82@@ -707,21 +707,24 @@ $(BUILD_LIBLCMS): $(BUILD_LIBAWT)
83
84 ##########################################################################################
85
86+BUILD_LIBJAVAJPEG_DIR := $(JDK_TOPDIR)/src/share/native/sun/awt/image/jpeg
87+
88 ifdef OPENJDK
89- BUILD_LIBJPEG_MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjpeg/mapfile-vers
90+ BUILD_LIBJAVAJPEG_MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjpeg/mapfile-vers
91 else
92- BUILD_LIBJPEG_MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjpeg/mapfile-vers-closed
93- BUILD_LIBJPEG_CLOSED_SRC := $(JDK_TOPDIR)/src/closed/share/native/sun/awt/image/jpeg
94- BUILD_LIBJPEG_CLOSED_INCLUDES := -I$(BUILD_LIBJPEG_CLOSED_SRC)
95+ BUILD_LIBJAVAJPEG_MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjpeg/mapfile-vers-closed
96+ BUILD_LIBJAVAJPEG_CLOSED_SRC := $(JDK_TOPDIR)/src/closed/share/native/sun/awt/image/jpeg
97+ BUILD_LIBJAVAJPEG_CLOSED_INCLUDES := -I$(BUILD_LIBJAVAJPEG_CLOSED_SRC)
98 endif
99
100-BUILD_LIBJPEG_REORDER :=
101+BUILD_LIBJAVAJPEG_REORDER :=
102 ifeq ($(OPENJDK_TARGET_OS), solaris)
103 ifneq ($(OPENJDK_TARGET_CPU), x86_64)
104- BUILD_LIBJPEG_REORDER := $(JDK_TOPDIR)/make/mapfiles/libjpeg/reorder-$(OPENJDK_TARGET_CPU)
105+ BUILD_LIBJAVAJPEG_REORDER := $(JDK_TOPDIR)/make/mapfiles/libjpeg/reorder-$(OPENJDK_TARGET_CPU)
106 endif
107 endif
108
109+
110 # Suppress gcc warnings like "variable might be clobbered by 'longjmp'
111 # or 'vfork'": this warning indicates that some variable is placed to
112 # a register by optimized compiler and it's value might be lost on longjmp().
113@@ -733,37 +736,50 @@ endif
114 # $(shell $(EXPR) $(CC_MAJORVER) \> 4 \| \
115 # \( $(CC_MAJORVER) = 4 \& $(CC_MINORVER) \>= 3 \) )
116 # ifeq ($(CC_43_OR_NEWER), 1)
117-# BUILD_LIBJPEG_CFLAGS_linux += -Wno-clobbered
118+# BUILD_LIBJAVAJPEG_CFLAGS_linux += -Wno-clobbered
119 # endif
120 #endif
121
122-$(eval $(call SetupNativeCompilation,BUILD_LIBJPEG, \
123- LIBRARY := jpeg, \
124+ifeq ($(USE_EXTERNAL_LIBJPEG), true)
125+ LIBJPEG_LIBS := -ljpeg
126+ BUILD_LIBJAVAJPEG_INCLUDE_FILES := \
127+ imageioJPEG.c \
128+ jpegdecoder.c
129+ BUILD_LIBJAVAJPEG_HEADERS :=
130+else
131+ LIBJPEG_LIBS :=
132+ BUILD_LIBJAVAJPEG_INCLUDE_FILES :=
133+ BUILD_LIBJAVAJPEG_HEADERS := -I$(BUILD_LIBJAVAJPEG_DIR)
134+endif
135+
136+$(eval $(call SetupNativeCompilation,BUILD_LIBJAVAJPEG, \
137+ LIBRARY := javajpeg, \
138 OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
139- SRC := $(BUILD_LIBJPEG_CLOSED_SRC) \
140- $(JDK_TOPDIR)/src/share/native/sun/awt/image/jpeg, \
141+ SRC := $(BUILD_LIBJAVAJPEG_CLOSED_SRC) \
142+ $(BUILD_LIBJAVAJPEG_DIR), \
143+ INCLUDE_FILES := $(BUILD_LIBJAVAJPEG_INCLUDE_FILES), \
144 LANG := C, \
145 OPTIMIZATION := HIGHEST, \
146 CFLAGS := $(CFLAGS_JDKLIB) \
147- $(BUILD_LIBJPEG_CLOSED_INCLUDES) \
148- -I$(JDK_TOPDIR)/src/share/native/sun/awt/image/jpeg, \
149- MAPFILE := $(BUILD_LIBJPEG_MAPFILE), \
150+ $(BUILD_LIBJAVAJPEG_CLOSED_INCLUDES) \
151+ $(BUILD_LIBJAVAJPEG_HEADERS), \
152+ MAPFILE := $(BUILD_LIBJAVAJPEG_MAPFILE), \
153 LDFLAGS := $(LDFLAGS_JDKLIB) \
154 $(call SET_SHARED_LIBRARY_ORIGIN), \
155 LDFLAGS_windows := $(WIN_JAVA_LIB) jvm.lib, \
156- LDFLAGS_SUFFIX := $(LDFLAGS_JDKLIB_SUFFIX), \
157+ LDFLAGS_SUFFIX := $(LDFLAGS_JDKLIB_SUFFIX) $(LIBJPEG_LIBS), \
158 VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
159 RC_FLAGS := $(RC_FLAGS) \
160- -D "JDK_FNAME=jpeg.dll" \
161- -D "JDK_INTERNAL_NAME=jpeg" \
162+ -D "JDK_FNAME=javajpeg.dll" \
163+ -D "JDK_INTERNAL_NAME=javajpeg" \
164 -D "JDK_FTYPE=0x2L", \
165- REORDER := $(BUILD_LIBJPEG_REORDER), \
166+ REORDER := $(BUILD_LIBJAVAJPEG_REORDER), \
167 OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjpeg, \
168 DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
169
170-$(BUILD_LIBJPEG): $(BUILD_LIBJAVA)
171+$(BUILD_LIBJAVAJPEG): $(BUILD_LIBJAVA)
172
173-BUILD_LIBRARIES += $(BUILD_LIBJPEG)
174+BUILD_LIBRARIES += $(BUILD_LIBJAVAJPEG)
175
176 ##########################################################################################
177
178@@ -1213,6 +1229,13 @@ ifndef BUILD_HEADLESS_ONLY
179 GIFLIB_CFLAGS := -I$(JDK_TOPDIR)/src/share/native/sun/awt/giflib
180 endif
181
182+ ifeq ($(USE_EXTERNAL_LIBJPEG), true)
183+ LIBJPEG_LDFLAGS := -ljpeg
184+ else
185+ LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/share/native/sun/awt/image/jpeg
186+ LIBJPEG_CFLAGS := -I$(JDK_TOPDIR)/src/share/native/sun/awt/image/jpeg
187+ endif
188+
189 ifneq ($(OPENJDK_TARGET_OS), macosx)
190 LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/awt/splashscreen
191 else
192@@ -1273,11 +1296,13 @@ ifndef BUILD_HEADLESS_ONLY
193 EXCLUDE_FILES := imageioJPEG.c jpegdecoder.c pngtest.c, \
194 LANG := C, \
195 OPTIMIZATION := LOW, \
196- CFLAGS := $(LIBSPLASHSCREEN_CFLAGS) $(CFLAGS_JDKLIB) $(GIFLIB_CFLAGS), \
197+ CFLAGS := $(LIBSPLASHSCREEN_CFLAGS) $(CFLAGS_JDKLIB) \
198+ $(GIFLIB_CFLAGS) $(LIBJPEG_CFLAGS), \
199 MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libsplashscreen/mapfile-vers, \
200 LDFLAGS := $(LDFLAGS_JDKLIB) \
201 $(call SET_SHARED_LIBRARY_ORIGIN), \
202- LDFLAGS_SUFFIX := $(LIBSPLASHSCREEN_LDFLAGS_SUFFIX) $(LIBZ) $(GIFLIB_LDFLAGS), \
203+ LDFLAGS_SUFFIX := $(LIBSPLASHSCREEN_LDFLAGS_SUFFIX) $(LIBZ) \
204+ $(GIFLIB_LDFLAGS) $(LIBJPEG_LDFLAGS), \
205 LDFLAGS_SUFFIX_solaris := -lc, \
206 VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
207 RC_FLAGS := $(RC_FLAGS) \
208diff --git a/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java b/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java
209index 5c93d89e..5efc00a7 100644
210--- a/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java
211+++ b/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java
212@@ -89,7 +89,7 @@ public class JPEGImageReader extends ImageReader {
213 java.security.AccessController.doPrivileged(
214 new java.security.PrivilegedAction<Void>() {
215 public Void run() {
216- System.loadLibrary("jpeg");
217+ System.loadLibrary("javajpeg");
218 return null;
219 }
220 });
221diff --git a/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageWriter.java b/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageWriter.java
222index 6a33bd5a..dca189ed 100644
223--- a/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageWriter.java
224+++ b/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageWriter.java
225@@ -177,7 +177,7 @@ public class JPEGImageWriter extends ImageWriter {
226 java.security.AccessController.doPrivileged(
227 new java.security.PrivilegedAction<Void>() {
228 public Void run() {
229- System.loadLibrary("jpeg");
230+ System.loadLibrary("javajpeg");
231 return null;
232 }
233 });
234diff --git a/jdk/src/share/classes/sun/awt/image/JPEGImageDecoder.java b/jdk/src/share/classes/sun/awt/image/JPEGImageDecoder.java
235index 872ffc01..5965a186 100644
236--- a/jdk/src/share/classes/sun/awt/image/JPEGImageDecoder.java
237+++ b/jdk/src/share/classes/sun/awt/image/JPEGImageDecoder.java
238@@ -56,7 +56,7 @@ public class JPEGImageDecoder extends ImageDecoder {
239 java.security.AccessController.doPrivileged(
240 new java.security.PrivilegedAction<Void>() {
241 public Void run() {
242- System.loadLibrary("jpeg");
243+ System.loadLibrary("javajpeg");
244 return null;
245 }
246 });
247diff --git a/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c b/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c
248index 7e1d8c99..8cac61da 100644
249--- a/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c
250+++ b/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c
251@@ -51,7 +51,7 @@
252
253 /* headers from the JPEG library */
254 #include <jpeglib.h>
255-#include "jerror.h"
256+#include <jerror.h>
257
258 #undef MAX
259 #define MAX(a,b) ((a) > (b) ? (a) : (b))
260--
2612.16.2
262
diff --git a/recipes-core/openjdk/patches-openjdk-8/0004-jdk-Allow-using-a-system-installed-libpng.patch b/recipes-core/openjdk/patches-openjdk-8/0004-jdk-Allow-using-a-system-installed-libpng.patch
new file mode 100644
index 0000000..af00bef
--- /dev/null
+++ b/recipes-core/openjdk/patches-openjdk-8/0004-jdk-Allow-using-a-system-installed-libpng.patch
@@ -0,0 +1,148 @@
1From 549100e3e687d2c844eeebe22a7dcbf7ed50406e Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Andr=C3=A9=20Draszik?= <andre.draszik@jci.com>
3Date: Tue, 27 Feb 2018 13:43:04 +0000
4Subject: [PATCH 4/8] jdk: Allow using a system-installed libpng
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9Patch stolen (and some typos corrected) from debian patch,
10which itself was a backport from:
11 http://hg.openjdk.java.net/jdk9/jdk9/rev/bfc1c131e540
12 http://hg.openjdk.java.net/jdk9/jdk9/jdk/rev/5e503831b142
13
14Issues fixed on top of debian patch:
15 * the default when --with-libpng= is not given works
16 * using the bundled libpng works
17
18Upstream-Status: Backport
19Signed-off-by: André Draszik <andre.draszik@jci.com>
20---
21 common/autoconf/libraries.m4 | 41 ++++++++++++++++++++++
22 common/autoconf/spec.gmk.in | 1 +
23 jdk/make/lib/Awt2dLibraries.gmk | 12 +++++--
24 .../native/sun/awt/splashscreen/splashscreen_png.c | 3 +-
25 4 files changed, 52 insertions(+), 5 deletions(-)
26
27diff --git a/common/autoconf/libraries.m4 b/common/autoconf/libraries.m4
28index 3f5f69b1..e419a050 100644
29--- a/common/autoconf/libraries.m4
30+++ b/common/autoconf/libraries.m4
31@@ -664,6 +664,47 @@ AC_DEFUN_ONCE([LIB_SETUP_MISC_LIBS],
32 fi
33 AC_SUBST(USE_EXTERNAL_LIBGIF)
34
35+ ###############################################################################
36+ #
37+ # Check for the png library
38+ #
39+
40+ AC_ARG_WITH(libpng, [AS_HELP_STRING([--with-libpng],
41+ [use libpng from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])])
42+
43+ AC_CHECK_LIB(png, png_sig_cmp,
44+ [ LIBPNG_FOUND=yes ],
45+ [ LIBPNG_FOUND=no ])
46+
47+ AC_MSG_CHECKING([for which libpng to use])
48+
49+ # default is bundled
50+ DEFAULT_LIBPNG=bundled
51+
52+ #
53+ # if user didn't specify, use DEFAULT_LIBPNG
54+ #
55+ if test "x${with_libpng}" = "x"; then
56+ with_libpng=${DEFAULT_LIBPNG}
57+ fi
58+
59+
60+ if test "x${with_libpng}" = "xbundled"; then
61+ USE_EXTERNAL_LIBPNG=false
62+ AC_MSG_RESULT([bundled])
63+ elif test "x${with_libpng}" = "xsystem"; then
64+ if test "x${LIBPNG_FOUND}" = "xyes"; then
65+ USE_EXTERNAL_LIBPNG=true
66+ AC_MSG_RESULT([system])
67+ else
68+ AC_MSG_RESULT([system not found])
69+ AC_MSG_ERROR([--with-libpng=system specified, but no libpng found!])
70+ fi
71+ else
72+ AC_MSG_ERROR([Invalid value of --with-libpng: ${with_libpng}, use 'system' or 'bundled'])
73+ fi
74+ AC_SUBST(USE_EXTERNAL_LIBPNG)
75+
76 ###############################################################################
77 #
78 # Check for the zlib library
79diff --git a/common/autoconf/spec.gmk.in b/common/autoconf/spec.gmk.in
80index 1c418f29..2c802c0a 100644
81--- a/common/autoconf/spec.gmk.in
82+++ b/common/autoconf/spec.gmk.in
83@@ -567,6 +567,7 @@ endif
84 ENABLE_JFR=@ENABLE_JFR@
85 ENABLE_INTREE_EC=@ENABLE_INTREE_EC@
86 USE_EXTERNAL_LIBJPEG:=@USE_EXTERNAL_LIBJPEG@
87+USE_EXTERNAL_LIBPNG:=@USE_EXTERNAL_LIBPNG@
88 USE_EXTERNAL_LIBGIF:=@USE_EXTERNAL_LIBGIF@
89 USE_EXTERNAL_LIBZ:=@USE_EXTERNAL_LIBZ@
90 LIBZIP_CAN_USE_MMAP:=@LIBZIP_CAN_USE_MMAP@
91diff --git a/jdk/make/lib/Awt2dLibraries.gmk b/jdk/make/lib/Awt2dLibraries.gmk
92index 8872a8e8..c577951a 100644
93--- a/jdk/make/lib/Awt2dLibraries.gmk
94+++ b/jdk/make/lib/Awt2dLibraries.gmk
95@@ -1219,7 +1219,6 @@ endif
96 ifndef BUILD_HEADLESS_ONLY
97 LIBSPLASHSCREEN_DIRS := \
98 $(JDK_TOPDIR)/src/share/native/sun/awt/image/jpeg \
99- $(JDK_TOPDIR)/src/share/native/sun/awt/libpng \
100 $(JDK_TOPDIR)/src/share/native/sun/awt/splashscreen
101
102 ifeq ($(USE_EXTERNAL_LIBGIF), true)
103@@ -1236,6 +1235,13 @@ ifndef BUILD_HEADLESS_ONLY
104 LIBJPEG_CFLAGS := -I$(JDK_TOPDIR)/src/share/native/sun/awt/image/jpeg
105 endif
106
107+ ifeq ($(USE_EXTERNAL_LIBPNG), true)
108+ LIBPNG_LDFLAGS := -lpng
109+ else
110+ LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/share/native/sun/awt/libpng
111+ LIBPNG_CFLAGS := -I$(JDK_TOPDIR)/src/share/native/sun/awt/libpng
112+ endif
113+
114 ifneq ($(OPENJDK_TARGET_OS), macosx)
115 LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/awt/splashscreen
116 else
117@@ -1297,12 +1303,12 @@ ifndef BUILD_HEADLESS_ONLY
118 LANG := C, \
119 OPTIMIZATION := LOW, \
120 CFLAGS := $(LIBSPLASHSCREEN_CFLAGS) $(CFLAGS_JDKLIB) \
121- $(GIFLIB_CFLAGS) $(LIBJPEG_CFLAGS), \
122+ $(GIFLIB_CFLAGS) $(LIBJPEG_CFLAGS) $(LIBPNG_CFLAGS), \
123 MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libsplashscreen/mapfile-vers, \
124 LDFLAGS := $(LDFLAGS_JDKLIB) \
125 $(call SET_SHARED_LIBRARY_ORIGIN), \
126 LDFLAGS_SUFFIX := $(LIBSPLASHSCREEN_LDFLAGS_SUFFIX) $(LIBZ) \
127- $(GIFLIB_LDFLAGS) $(LIBJPEG_LDFLAGS), \
128+ $(GIFLIB_LDFLAGS) $(LIBJPEG_LDFLAGS) $(LIBPNG_LDFLAGS), \
129 LDFLAGS_SUFFIX_solaris := -lc, \
130 VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
131 RC_FLAGS := $(RC_FLAGS) \
132diff --git a/jdk/src/share/native/sun/awt/splashscreen/splashscreen_png.c b/jdk/src/share/native/sun/awt/splashscreen/splashscreen_png.c
133index 3599433e..5bf002ea 100644
134--- a/jdk/src/share/native/sun/awt/splashscreen/splashscreen_png.c
135+++ b/jdk/src/share/native/sun/awt/splashscreen/splashscreen_png.c
136@@ -25,8 +25,7 @@
137
138 #include "splashscreen_impl.h"
139
140-#include "../libpng/png.h"
141-
142+#include <png.h>
143 #include <setjmp.h>
144
145 #define SIG_BYTES 8
146--
1472.16.2
148