openjdk7 - use installed png and jpeg libraries
Mikhail T.
mi+thun at aldan.algebra.com
Sat Dec 22 03:24:04 UTC 2012
Hello!
The attached diff teaches java/openjdk7 to rely on the
graphics/{png,jpeg} ports instead of compiling libpng and libjpeg from
sources bundled by Oracle.
This is especially important for jpeg, because currently build uses the
already installed headers while compiling the bundled sources -- in case
of any discrepancies there may be nasty problems.
It is also just cleaner and affords the use of better optimized image
libraries (such as assembly-optimized png and jpeg-turbo).
Unfortunately, the port currently does not include check/regression-test
target, so I my limited testing consisted of simply restarting vuze --
this worked, but I am not certain, it exercises the modified code.
Please, take a look. Thank you! Yours,
-mi
-------------- next part --------------
Index: files/patch-jpeg-png
===================================================================
--- files/patch-jpeg-png (revision 0)
+++ files/patch-jpeg-png (revision 0)
@@ -0,0 +1,141 @@
+--- jdk/make/sun/jpeg/Makefile 2012-08-10 13:21:52.000000000 -0400
++++ jdk/make/sun/jpeg/Makefile 2012-12-20 12:52:38.000000000 -0500
+@@ -28,4 +28,5 @@
+ LIBRARY = jpeg
+ PRODUCT = sun
++LDLIBS = -ljpeg
+
+ # Use highest optimization level
+@@ -37,5 +38,4 @@
+ # Files
+ #
+-include FILES_c.gmk
+
+ AUTO_FILES_JAVA_DIRS = sun/awt/image com/sun/imageio/plugins/jpeg
+@@ -87,9 +87,3 @@
+ include $(BUILDDIR)/common/Library.gmk
+
+-#
+-# Add to ambient vpath to get files in a subdirectory
+-#
+-vpath %.c $(SHARE_SRC)/native/$(PKGDIR)/image/jpeg
+-
+ CLASSES.export += java.io.InputStream
+-
+--- jdk/src/share/native/sun/awt/splashscreen/splashscreen_jpeg.c 2012-08-10 13:30:30.000000000 -0400
++++ jdk/src/share/native/sun/awt/splashscreen/splashscreen_jpeg.c 2012-12-20 19:14:01.000000000 -0500
+@@ -26,7 +26,7 @@
+ #include "splashscreen_impl.h"
+
+-#include "jinclude.h"
+-#include "jpeglib.h"
+-#include "jerror.h"
++#include <jconfig.h>
++#include <jpeglib.h>
++#include <jerror.h>
+
+ #include <setjmp.h>
+@@ -108,9 +108,9 @@
+ cinfo->src = (struct jpeg_source_mgr *)
+ (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo,
+- JPOOL_PERMANENT, SIZEOF(stream_source_mgr));
++ JPOOL_PERMANENT, sizeof(stream_source_mgr));
+ src = (stream_src_ptr) cinfo->src;
+ src->buffer = (JOCTET *)
+ (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo,
+- JPOOL_PERMANENT, INPUT_BUF_SIZE * SIZEOF(JOCTET));
++ JPOOL_PERMANENT, INPUT_BUF_SIZE * sizeof(JOCTET));
+ }
+
+--- jdk/make/sun/splashscreen/FILES_c.gmk 2012-08-10 13:21:55.000000000 -0400
++++ jdk/make/sun/splashscreen/FILES_c.gmk 2012-12-20 21:21:20.000000000 -0500
+@@ -32,80 +32,3 @@
+ splashscreen_png.c \
+ splashscreen_sys.c \
+- png.c \
+- pngerror.c \
+- pngget.c \
+- pngmem.c \
+- pngpread.c \
+- pngread.c \
+- pngrio.c \
+- pngrtran.c \
+- pngrutil.c \
+- pngset.c \
+- pngtrans.c \
+- pngwio.c \
+- pngwrite.c \
+- pngwtran.c \
+- pngwutil.c \
+- dgif_lib.c \
+- gif_err.c \
+- gifalloc.c \
+- jcomapi.c \
+- jdapimin.c \
+- jdapistd.c \
+- jdcoefct.c \
+- jdcolor.c \
+- jddctmgr.c \
+- jdhuff.c \
+- jdinput.c \
+- jdmainct.c \
+- jdmarker.c \
+- jdmaster.c \
+- jdmerge.c \
+- jdphuff.c \
+- jdpostct.c \
+- jdsample.c \
+- jerror.c \
+- jidctflt.c \
+- jidctfst.c \
+- jidctint.c \
+- jidctred.c \
+- jmemmgr.c \
+- jmemnobs.c \
+- jquant1.c \
+- jquant2.c \
+- jutils.c \
+- jcapimin.c \
+- jcapistd.c \
+- jccoefct.c \
+- jccolor.c \
+- jcdctmgr.c \
+- jchuff.c \
+- jcinit.c \
+- jcmainct.c \
+- jcmarker.c \
+- jcmaster.c \
+- jcparam.c \
+- jcphuff.c \
+- jcprepct.c \
+- jcsample.c \
+- jctrans.c \
+- jdtrans.c \
+- jfdctflt.c \
+- jfdctfst.c \
+- jfdctint.c
+
+-ifneq ($(SYSTEM_ZLIB),true)
+- FILES_c += \
+- compress.c \
+- deflate.c \
+- gzio.c \
+- infback.c \
+- inffast.c \
+- inflate.c \
+- inftrees.c \
+- trees.c \
+- uncompr.c \
+- zadler32.c \
+- zcrc32.c \
+- zutil.c
+-endif
+--- jdk/src/share/native/sun/awt/splashscreen/splashscreen_png.c 2012-08-10 13:30:30.000000000 -0400
++++ jdk/src/share/native/sun/awt/splashscreen/splashscreen_png.c 2012-12-21 17:09:28.000000000 -0500
+@@ -26,5 +26,5 @@
+ #include "splashscreen_impl.h"
+
+-#include "../libpng/png.h"
++#include <png.h>
+
+ #include <setjmp.h>
Index: files/patch-set
===================================================================
--- files/patch-set (revision 309313)
+++ files/patch-set (working copy)
@@ -3067,6 +3067,10 @@
else # PLATFORM
CFLAGS += -DWITH_WIN32
OTHER_LDLIBS += kernel32.lib user32.lib gdi32.lib delayimp.lib /DELAYLOAD:user32.dll
+@@ -133,2 +134,3 @@
+ # and use alternative implementations in C.
+ CPPFLAGS += -DPNG_NO_MMX_CODE
++OTHER_LDLIBS += -ljpeg -lpng
--- jdk/make/sun/xawt/Makefile 2012-08-10 10:21:55.000000000 -0700
+++ jdk/make/sun/xawt/Makefile 2012-08-19 12:39:47.000000000 -0700
@@ -52,6 +52,9 @@
Index: Makefile
===================================================================
--- Makefile (revision 309313)
+++ Makefile (working copy)
@@ -7,7 +7,7 @@
PORTNAME= openjdk
PORTVERSION= ${JDK_MAJOR_VERSION}.${PORT_MINOR_VERSION}.${PORT_BUILD_NUMBER}
-PORTREVISION= 1
+PORTREVISION= 2
CATEGORIES= java devel
MASTER_SITES= http://download.java.net/openjdk/jdk${JDK_MAJOR_VERSION}u${JDK_MINOR_VERSION}/promoted/b${JDK_BUILD_NUMBER}/ \
http://download.java.net/jaxp/1.4.5/:jaxp \
@@ -56,6 +56,8 @@
LATEST_LINK= openjdk7
LIB_DEPENDS+= freetype:${PORTSDIR}/print/freetype2 \
+ jpeg:${PORTSDIR}/graphics/jpeg \
+ png:${PORTSDIR}/graphics/png \
asound:${PORTSDIR}/audio/alsa-lib
BUILD_DEPENDS+= zip:${PORTSDIR}/archivers/zip \
unzip:${PORTSDIR}/archivers/unzip \
@@ -137,6 +139,8 @@
post-patch:
@${REINPLACE_CMD} "s|%%LOCALBASE%%|${LOCALBASE}|" \
${WRKSRC}/hotspot/src/os/bsd/vm/os_bsd.cpp
+ ${RM} -r ${WRKSRC}/jdk/src/share/native/sun/awt/image/jpeg \
+ ${WRKSRC}/jdk/src/share/native/sun/awt/libpng
.if ${PORT_OPTIONS:MPOLICY}
@${REINPLACE_CMD} 's|build-policy install-limited|build-policy install-unlimited|' \
${WRKSRC}/jdk/make/javax/crypto/Makefile
More information about the freebsd-java
mailing list