]> git.pld-linux.org Git - packages/openjdk9.git/blob - system-libjpeg.patch
adapterized
[packages/openjdk9.git] / system-libjpeg.patch
1 diff -durN -x '*.orig' jdk8u-jdk8u66-b02.orig/common/autoconf/generated-configure.sh jdk8u-jdk8u66-b02/common/autoconf/generated-configure.sh
2 --- jdk8u-jdk8u66-b02.orig/common/autoconf/generated-configure.sh       2015-07-17 09:35:23.000000000 +0200
3 +++ jdk8u-jdk8u66-b02/common/autoconf/generated-configure.sh    2015-09-18 13:13:58.000000000 +0200
4 @@ -1065,6 +1065,7 @@
5  with_alsa
6  with_alsa_include
7  with_alsa_lib
8 +with_libjpeg
9  with_giflib
10  with_zlib
11  with_stdc__lib
12 @@ -1838,6 +1839,8 @@
13                            headers under PATH/include)
14    --with-alsa-include     specify directory for the alsa include files
15    --with-alsa-lib         specify directory for the alsa library
16 +  --with-libjpeg          use libjpeg from build system or OpenJDK source
17 +                          (system, bundled) [bundled]
18    --with-giflib           use giflib from build system or OpenJDK source
19                            (system, bundled) [bundled]
20    --with-zlib             use zlib from build system or OpenJDK source
21 @@ -8092,6 +8095,11 @@
22      HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL}minimal1 "
23    fi
24  
25 +  if test "x$JVM_VARIANT_CLIENT" = xtrue; then
26 +    if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
27 +      as_fn_error $? "You cannot build a client JVM for a 64-bit machine." "$LINENO" 5
28 +    fi
29 +  fi
30    if test "x$JVM_VARIANT_KERNEL" = xtrue; then
31      HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL}kernel "
32    fi
33 @@ -34837,10 +34845,43 @@
34    # Check for the jpeg library
35    #
36  
37 -  USE_EXTERNAL_LIBJPEG=true
38 -  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -ljpeg" >&5
39 -$as_echo_n "checking for main in -ljpeg... " >&6; }
40 -if ${ac_cv_lib_jpeg_main+:} false; then :
41 +
42 +# Check whether --with-libjpeg was given.
43 +if test "${with_libjpeg+set}" = set; then :
44 +  withval=$with_libjpeg;
45 +fi
46 +
47 +
48 +  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for which libjpeg to use" >&5
49 +$as_echo_n "checking for which libjpeg to use... " >&6; }
50 +
51 +  # default is bundled
52 +  DEFAULT_LIBJPEG=bundled
53 +
54 +  #
55 +  # if user didn't specify, use DEFAULT_LIBJPEG
56 +  #
57 +  if test "x${with_libjpeg}" = "x"; then
58 +    with_libjpeg=${DEFAULT_LIBJPEG}
59 +  fi
60 +
61 +  { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_libjpeg}" >&5
62 +$as_echo "${with_libjpeg}" >&6; }
63 +
64 +  if test "x${with_libjpeg}" = "xbundled"; then
65 +    USE_EXTERNAL_LIBJPEG=false
66 +  elif test "x${with_libjpeg}" = "xsystem"; then
67 +    ac_fn_cxx_check_header_mongrel "$LINENO" "jpeglib.h" "ac_cv_header_jpeglib_h" "$ac_includes_default"
68 +if test "x$ac_cv_header_jpeglib_h" = xyes; then :
69 +
70 +else
71 +   as_fn_error $? "--with-libjpeg=system specified, but jpeglib.h not found!" "$LINENO" 5
72 +fi
73 +
74 +
75 +    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for jpeg_CreateDecompress in -ljpeg" >&5
76 +$as_echo_n "checking for jpeg_CreateDecompress in -ljpeg... " >&6; }
77 +if ${ac_cv_lib_jpeg_jpeg_CreateDecompress+:} false; then :
78    $as_echo_n "(cached) " >&6
79  else
80    ac_check_lib_save_LIBS=$LIBS
81 @@ -34848,27 +34889,33 @@
82  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
83  /* end confdefs.h.  */
84  
85 -
86 +/* Override any GCC internal prototype to avoid an error.
87 +   Use char because int might match the return type of a GCC
88 +   builtin and then its argument prototype would still apply.  */
89 +#ifdef __cplusplus
90 +extern "C"
91 +#endif
92 +char jpeg_CreateDecompress ();
93  int
94  main ()
95  {
96 -return main ();
97 +return jpeg_CreateDecompress ();
98    ;
99    return 0;
100  }
101  _ACEOF
102  if ac_fn_cxx_try_link "$LINENO"; then :
103 -  ac_cv_lib_jpeg_main=yes
104 +  ac_cv_lib_jpeg_jpeg_CreateDecompress=yes
105  else
106 -  ac_cv_lib_jpeg_main=no
107 +  ac_cv_lib_jpeg_jpeg_CreateDecompress=no
108  fi
109  rm -f core conftest.err conftest.$ac_objext \
110      conftest$ac_exeext conftest.$ac_ext
111  LIBS=$ac_check_lib_save_LIBS
112  fi
113 -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_jpeg_main" >&5
114 -$as_echo "$ac_cv_lib_jpeg_main" >&6; }
115 -if test "x$ac_cv_lib_jpeg_main" = xyes; then :
116 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_jpeg_jpeg_CreateDecompress" >&5
117 +$as_echo "$ac_cv_lib_jpeg_jpeg_CreateDecompress" >&6; }
118 +if test "x$ac_cv_lib_jpeg_jpeg_CreateDecompress" = xyes; then :
119    cat >>confdefs.h <<_ACEOF
120  #define HAVE_LIBJPEG 1
121  _ACEOF
122 @@ -34876,13 +34923,16 @@
123    LIBS="-ljpeg $LIBS"
124  
125  else
126 -   USE_EXTERNAL_LIBJPEG=false
127 -      { $as_echo "$as_me:${as_lineno-$LINENO}: Will use jpeg decoder bundled with the OpenJDK source" >&5
128 -$as_echo "$as_me: Will use jpeg decoder bundled with the OpenJDK source" >&6;}
129 -
130 +   as_fn_error $? "--with-libjpeg=system specified, but no libjpeg found" "$LINENO" 5
131  fi
132  
133  
134 +    USE_EXTERNAL_LIBJPEG=true
135 +  else
136 +    as_fn_error $? "Invalid use of --with-libjpeg: ${with_libjpeg}, use 'system' or 'bundled'" "$LINENO" 5
137 +  fi
138 +
139 +
140  
141    ###############################################################################
142    #
143 diff -durN -x '*.orig' jdk8u-jdk8u66-b02.orig/common/autoconf/libraries.m4 jdk8u-jdk8u66-b02/common/autoconf/libraries.m4
144 --- jdk8u-jdk8u66-b02.orig/common/autoconf/libraries.m4 2015-07-17 09:35:23.000000000 +0200
145 +++ jdk8u-jdk8u66-b02/common/autoconf/libraries.m4      2015-09-18 13:13:58.000000000 +0200
146 @@ -595,11 +595,36 @@
147    # Check for the jpeg library
148    #
149  
150 -  USE_EXTERNAL_LIBJPEG=true
151 -  AC_CHECK_LIB(jpeg, main, [],
152 -      [ USE_EXTERNAL_LIBJPEG=false
153 -      AC_MSG_NOTICE([Will use jpeg decoder bundled with the OpenJDK source])
154 -  ])
155 +  AC_ARG_WITH(libjpeg, [AS_HELP_STRING([--with-libjpeg],
156 +      [use libjpeg from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])])
157 +
158 +  AC_MSG_CHECKING([for which libjpeg to use])
159 +
160 +  # default is bundled
161 +  DEFAULT_LIBJPEG=bundled
162 +
163 +  #
164 +  # if user didn't specify, use DEFAULT_LIBJPEG
165 +  #
166 +  if test "x${with_libjpeg}" = "x"; then
167 +    with_libjpeg=${DEFAULT_LIBJPEG}
168 +  fi
169 +
170 +  AC_MSG_RESULT(${with_libjpeg})
171 +
172 +  if test "x${with_libjpeg}" = "xbundled"; then
173 +    USE_EXTERNAL_LIBJPEG=false
174 +  elif test "x${with_libjpeg}" = "xsystem"; then
175 +    AC_CHECK_HEADER(jpeglib.h, [],
176 +        [ AC_MSG_ERROR([--with-libjpeg=system specified, but jpeglib.h not found!])])
177 +    AC_CHECK_LIB(jpeg, jpeg_CreateDecompress, [],
178 +        [ AC_MSG_ERROR([--with-libjpeg=system specified, but no libjpeg found])])
179 +
180 +    USE_EXTERNAL_LIBJPEG=true
181 +  else
182 +    AC_MSG_ERROR([Invalid use of --with-libjpeg: ${with_libjpeg}, use 'system' or 'bundled'])
183 +  fi
184 +
185    AC_SUBST(USE_EXTERNAL_LIBJPEG)
186  
187    ###############################################################################
188 diff -durN -x '*.orig' jdk8u-jdk8u66-b02.orig/jdk/make/lib/Awt2dLibraries.gmk jdk8u-jdk8u66-b02/jdk/make/lib/Awt2dLibraries.gmk
189 --- jdk8u-jdk8u66-b02.orig/jdk/make/lib/Awt2dLibraries.gmk      2015-07-23 16:17:35.000000000 +0200
190 +++ jdk8u-jdk8u66-b02/jdk/make/lib/Awt2dLibraries.gmk   2015-09-18 13:13:58.000000000 +0200
191 @@ -702,21 +702,24 @@
192  
193  ##########################################################################################
194  
195 +BUILD_LIBJAVAJPEG_DIR := $(JDK_TOPDIR)/src/share/native/sun/awt/image/jpeg
196 +
197  ifdef OPENJDK
198 -  BUILD_LIBJPEG_MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjpeg/mapfile-vers
199 +  BUILD_LIBJAVAJPEG_MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjpeg/mapfile-vers
200  else
201 -  BUILD_LIBJPEG_MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjpeg/mapfile-vers-closed
202 -  BUILD_LIBJPEG_CLOSED_SRC := $(JDK_TOPDIR)/src/closed/share/native/sun/awt/image/jpeg
203 -  BUILD_LIBJPEG_CLOSED_INCLUDES := -I$(BUILD_LIBJPEG_CLOSED_SRC)
204 +  BUILD_LIBJAVAJPEG_MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjpeg/mapfile-vers-closed
205 +  BUILD_LIBJAVAJPEG_CLOSED_SRC := $(JDK_TOPDIR)/src/closed/share/native/sun/awt/image/jpeg
206 +  BUILD_LIBJAVAJPEG_CLOSED_INCLUDES := -I$(BUILD_LIBJAVAJPEG_CLOSED_SRC)
207  endif
208  
209 -BUILD_LIBJPEG_REORDER :=
210 +BUILD_LIBJAVAJPEG_REORDER :=
211  ifeq ($(OPENJDK_TARGET_OS), solaris)
212    ifneq ($(OPENJDK_TARGET_CPU), x86_64)
213 -    BUILD_LIBJPEG_REORDER := $(JDK_TOPDIR)/make/mapfiles/libjpeg/reorder-$(OPENJDK_TARGET_CPU)
214 +    BUILD_LIBJAVAJPEG_REORDER := $(JDK_TOPDIR)/make/mapfiles/libjpeg/reorder-$(OPENJDK_TARGET_CPU)
215    endif
216  endif
217  
218 +
219  # Suppress gcc warnings like "variable might be clobbered by 'longjmp'
220  # or 'vfork'": this warning indicates that some variable is placed to
221  # a register by optimized compiler and it's value might be lost on longjmp().
222 @@ -728,37 +731,50 @@
223  #      $(shell $(EXPR) $(CC_MAJORVER) \> 4 \| \
224  #          \( $(CC_MAJORVER) = 4 \& $(CC_MINORVER) \>= 3 \) )
225  #  ifeq ($(CC_43_OR_NEWER), 1)
226 -#    BUILD_LIBJPEG_CFLAGS_linux += -Wno-clobbered
227 +#    BUILD_LIBJAVAJPEG_CFLAGS_linux += -Wno-clobbered
228  #  endif
229  #endif
230  
231 -$(eval $(call SetupNativeCompilation,BUILD_LIBJPEG, \
232 -    LIBRARY := jpeg, \
233 +ifeq ($(USE_EXTERNAL_LIBJPEG), true)
234 +  LIBJPEG_LIBS := -ljpeg
235 +  BUILD_LIBJAVAJPEG_INCLUDE_FILES := \
236 +      imageIOJPEG.c \
237 +      jpegdecoder.c
238 +  BUILD_LIBJAVAJPEG_HEADERS :=
239 +else
240 +  LIBJPEG_LIBS :=
241 +  BUILD_LIBJAVAJPEG_INCLUDE_FILES :=
242 +  BUILD_LIBJAVAJPEG_HEADERS := -I$(BUILD_LIBJAVAJPEG_DIR)
243 +endif
244 +
245 +$(eval $(call SetupNativeCompilation,BUILD_LIBJAVAJPEG, \
246 +    LIBRARY := javajpeg, \
247      OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
248 -    SRC := $(BUILD_LIBJPEG_CLOSED_SRC) \
249 -        $(JDK_TOPDIR)/src/share/native/sun/awt/image/jpeg, \
250 +    SRC := $(BUILD_LIBJAVAJPEG_CLOSED_SRC) \
251 +        $(BUILD_LIBJAVAJPEG_DIR), \
252 +    INCLUDE_FILES := $(BUILD_LIBJAVAJPEG_INCLUDE_FILES), \
253      LANG := C, \
254      OPTIMIZATION := HIGHEST, \
255      CFLAGS := $(CFLAGS_JDKLIB) \
256 -        $(BUILD_LIBJPEG_CLOSED_INCLUDES) \
257 -        -I$(JDK_TOPDIR)/src/share/native/sun/awt/image/jpeg, \
258 -    MAPFILE := $(BUILD_LIBJPEG_MAPFILE), \
259 +        $(BUILD_LIBJAVAJPEG_CLOSED_INCLUDES) \
260 +        $(BUILD_LIBJAVAJPEG_HEADERS), \
261 +    MAPFILE := $(BUILD_LIBJAVAJPEG_MAPFILE), \
262      LDFLAGS := $(LDFLAGS_JDKLIB) \
263          $(call SET_SHARED_LIBRARY_ORIGIN), \
264      LDFLAGS_windows := $(WIN_JAVA_LIB) jvm.lib, \
265 -    LDFLAGS_SUFFIX := $(LDFLAGS_JDKLIB_SUFFIX), \
266 +    LDFLAGS_SUFFIX := $(LIBJPEG_LIBS) $(LDFLAGS_JDKLIB_SUFFIX), \
267      VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
268      RC_FLAGS := $(RC_FLAGS) \
269 -        -D "JDK_FNAME=jpeg.dll" \
270 -        -D "JDK_INTERNAL_NAME=jpeg" \
271 +        -D "JDK_FNAME=javajpeg.dll" \
272 +        -D "JDK_INTERNAL_NAME=javajpeg" \
273          -D "JDK_FTYPE=0x2L", \
274 -    REORDER := $(BUILD_LIBJPEG_REORDER), \
275 +    REORDER := $(BUILD_LIBJAVAJPEG_REORDER), \
276      OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjpeg, \
277      DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
278  
279 -$(BUILD_LIBJPEG): $(BUILD_LIBJAVA)
280 +$(BUILD_LIBJAVAJPEG): $(BUILD_LIBJAVA)
281  
282 -BUILD_LIBRARIES += $(BUILD_LIBJPEG)
283 +BUILD_LIBRARIES += $(BUILD_LIBJAVAJPEG)
284  
285  ##########################################################################################
286  
287 @@ -1198,6 +1214,13 @@
288      GIFLIB_CFLAGS := -I$(JDK_TOPDIR)/src/share/native/sun/awt/giflib
289    endif
290  
291 +  ifeq ($(USE_EXTERNAL_LIBJPEG), true)
292 +    LIBJPEG_LDFLAGS := -ljpeg
293 +  else
294 +    LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/share/native/sun/awt/image/jpeg
295 +    LIBJPEG_CFLAGS := -I$(JDK_TOPDIR)/src/share/native/sun/awt/image/jpeg
296 +  endif
297 +
298    ifneq ($(OPENJDK_TARGET_OS), macosx)
299      LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/awt/splashscreen
300    else
301 @@ -1258,11 +1281,13 @@
302        EXCLUDE_FILES := imageioJPEG.c jpegdecoder.c pngtest.c, \
303        LANG := C, \
304        OPTIMIZATION := LOW, \
305 -      CFLAGS := $(LIBSPLASHSCREEN_CFLAGS) $(CFLAGS_JDKLIB) $(GIFLIB_CFLAGS), \
306 +      CFLAGS := $(LIBSPLASHSCREEN_CFLAGS) $(CFLAGS_JDKLIB) \
307 +                $(GIFLIB_CFLAGS) $(LIBJPEG_CFLAGS), \
308        MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libsplashscreen/mapfile-vers, \
309        LDFLAGS := $(LDFLAGS_JDKLIB) \
310            $(call SET_SHARED_LIBRARY_ORIGIN), \
311 -      LDFLAGS_SUFFIX := $(LIBSPLASHSCREEN_LDFLAGS_SUFFIX) $(LIBZ) $(GIFLIB_LDFLAGS), \
312 +      LDFLAGS_SUFFIX := $(LIBSPLASHSCREEN_LDFLAGS_SUFFIX) $(LIBZ) \
313 +                        $(GIFLIB_LDFLAGS) $(LIBJPEG_LDFLAGS), \
314        LDFLAGS_SUFFIX_solaris := -lc, \
315        VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
316        RC_FLAGS := $(RC_FLAGS) \
317 diff -durN -x '*.orig' jdk8u-jdk8u66-b02.orig/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java jdk8u-jdk8u66-b02/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java
318 --- jdk8u-jdk8u66-b02.orig/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java      2015-07-23 16:17:35.000000000 +0200
319 +++ jdk8u-jdk8u66-b02/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java   2015-09-18 13:13:58.000000000 +0200
320 @@ -89,7 +89,7 @@
321          java.security.AccessController.doPrivileged(
322              new java.security.PrivilegedAction<Void>() {
323                  public Void run() {
324 -                    System.loadLibrary("jpeg");
325 +                    System.loadLibrary("javajpeg");
326                      return null;
327                  }
328              });
329 diff -durN -x '*.orig' jdk8u-jdk8u66-b02.orig/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageWriter.java jdk8u-jdk8u66-b02/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageWriter.java
330 --- jdk8u-jdk8u66-b02.orig/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageWriter.java      2015-07-23 16:17:35.000000000 +0200
331 +++ jdk8u-jdk8u66-b02/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageWriter.java   2015-09-18 13:13:58.000000000 +0200
332 @@ -177,7 +177,7 @@
333          java.security.AccessController.doPrivileged(
334              new java.security.PrivilegedAction<Void>() {
335                  public Void run() {
336 -                    System.loadLibrary("jpeg");
337 +                    System.loadLibrary("javajpeg");
338                      return null;
339                  }
340              });
341 diff -durN -x '*.orig' jdk8u-jdk8u66-b02.orig/jdk/src/share/classes/sun/awt/image/JPEGImageDecoder.java jdk8u-jdk8u66-b02/jdk/src/share/classes/sun/awt/image/JPEGImageDecoder.java
342 --- jdk8u-jdk8u66-b02.orig/jdk/src/share/classes/sun/awt/image/JPEGImageDecoder.java    2015-07-23 16:17:35.000000000 +0200
343 +++ jdk8u-jdk8u66-b02/jdk/src/share/classes/sun/awt/image/JPEGImageDecoder.java 2015-09-18 13:13:58.000000000 +0200
344 @@ -56,7 +56,7 @@
345          java.security.AccessController.doPrivileged(
346              new java.security.PrivilegedAction<Void>() {
347                  public Void run() {
348 -                    System.loadLibrary("jpeg");
349 +                    System.loadLibrary("javajpeg");
350                      return null;
351                  }
352              });
353 diff -durN -x '*.orig' jdk8u-jdk8u66-b02.orig/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c jdk8u-jdk8u66-b02/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c
354 --- jdk8u-jdk8u66-b02.orig/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c        2015-07-23 16:17:35.000000000 +0200
355 +++ jdk8u-jdk8u66-b02/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c     2015-09-18 13:13:58.000000000 +0200
356 @@ -51,7 +51,7 @@
357  
358  /* headers from the JPEG library */
359  #include <jpeglib.h>
360 -#include "jerror.h"
361 +#include <jerror.h>
362  
363  #undef MAX
364  #define MAX(a,b)        ((a) > (b) ? (a) : (b))
This page took 0.319496 seconds and 3 git commands to generate.