[yocto] [PATCH 3/7][meta-java] compiling openjdk7 without x11

Jens Rehsack rehsack at gmail.com
Thu Oct 1 11:23:12 PDT 2015


This affects the native part only which is required to bootstrap openjdk-8-native
for cross-compiling openjdk-8, but should be adoptable for cross-compiled recipe
as well as for openjdk-6.

Signed-off-by: Jens Rehsack <sno at netbsd.org>
---
 recipes-core/icedtea/icedtea7-native.inc           | 14 ++++-
 .../openjdk-7-03b147/allow-headless-build.patch    | 72 ++++++++++++++++++++++
 ...-disable-sun.applet-for-tools-in-headless.patch | 10 +++
 .../icedtea-disable-x11-in-headless.patch          | 15 +++++
 recipes-core/icedtea/openjdk-7-release-03b147.inc  | 10 +++
 5 files changed, 119 insertions(+), 2 deletions(-)
 create mode 100644 recipes-core/icedtea/openjdk-7-03b147/allow-headless-build.patch
 create mode 100644 recipes-core/icedtea/openjdk-7-03b147/icedtea-disable-sun.applet-for-tools-in-headless.patch
 create mode 100644 recipes-core/icedtea/openjdk-7-03b147/icedtea-disable-x11-in-headless.patch

diff --git a/recipes-core/icedtea/icedtea7-native.inc b/recipes-core/icedtea/icedtea7-native.inc
index b29fd34..69dd0ae 100644
--- a/recipes-core/icedtea/icedtea7-native.inc
+++ b/recipes-core/icedtea/icedtea7-native.inc
@@ -5,13 +5,18 @@ INC_PR = "r1"
 
 DEPENDS = "virtual/javac-native virtual/java-native classpath-native \
            rhino-native ant-native libxslt-native attr-native \
-           libx11-native xproto-native libxt-native libxext-native libxrender-native \
            giflib-native jpeg-native libpng-native \
            glib-2.0-native freetype-native zlib-native \
-           fontconfig-native zip-native alsa-lib-native \
+           fontconfig-native zip-native \
 	   unzip-native \
           "
 
+PACKAGECONFIG ??= ""
+PACKAGECONFIG[x11] = ",--disable-headful,libx11-native xproto-native libxt-native libxext-native libxrender-native"
+
+OEMAKE_BUILD_HEADLESS_ONLY = "${@base_contains('PACKAGECONFIG', 'x11', '', 'BUILD_HEADLESS_ONLY=1', d)}"
+CFLAGS_append = "${@base_contains('PACKAGECONFIG', 'x11', '', ' -DHEADLESS=true', d)}"
+
 inherit native java autotools
 
 JAVA_HOME[unexport] = "1"
@@ -27,6 +32,7 @@ SRC_URI = " \
   ${LANGTOOLS_URI} \
   ${ICEDTEA_PATCHES} \
   ${OPENJDK_PATCHES} \
+  file://allow-headless-build.patch;striplevel=0 \
   "
 
 S = "${WORKDIR}/${ICEDTEA}"
@@ -124,6 +130,8 @@ do_configure_prepend() {
 	done
 }
 
+POST_CONFIGURE_CLEAN_X11 = "${@base_contains('PACKAGECONFIG', 'x11', '', 'rm openjdk*/jdk/src/solaris/classes/sun/awt/X11/*.java', d)}"
+
 do_configure_append() {
 	oe_runmake patch-fsg
 
@@ -143,6 +151,7 @@ do_configure_append() {
 			-e"s|g++\$(GCC_SUFFIX)|${CXX}|" \
 			$F
 	done
+	${POST_CONFIGURE_CLEAN_X11}
 	oe_runmake patch-boot
 }
 
@@ -152,6 +161,7 @@ EXTRA_OEMAKE = ' \
                 OE_CXXFLAGS="${CXXFLAGS}" \
                 OE_LDFLAGS="${LDFLAGS}" \
                 ZIPEXE="${STAGING_BINDIR_NATIVE}/zip" \
+		${OEMAKE_BUILD_HEADLESS_ONLY} \
                '
 
 do_compile() {
diff --git a/recipes-core/icedtea/openjdk-7-03b147/allow-headless-build.patch b/recipes-core/icedtea/openjdk-7-03b147/allow-headless-build.patch
new file mode 100644
index 0000000..80a98b1
--- /dev/null
+++ b/recipes-core/icedtea/openjdk-7-03b147/allow-headless-build.patch
@@ -0,0 +1,72 @@
+--- acinclude.m4.orig	2015-08-18 11:58:23.000000000 +0200
++++ acinclude.m4	2015-08-18 11:58:30.000000000 +0200
+@@ -2178,3 +2178,37 @@
+ AM_CONDITIONAL([NO_BYTECODE7], test x"${it_cv_bytecode7}" = "xyes")
+ AC_PROVIDE([$0])dnl
+ ])
++AC_DEFUN_ONCE([JDKOPT_SETUP_JDK_OPTIONS],
++[
++
++  ###############################################################################
++  #
++  # Should we build a JDK/JVM with headful support (ie a graphical ui)?
++  # We always build headless support.
++  #
++  AC_MSG_CHECKING([headful support])
++  AC_ARG_ENABLE([headful], [AS_HELP_STRING([--disable-headful],
++      [disable building headful support (graphical UI support) @<:@enabled@:>@])],
++      [SUPPORT_HEADFUL=${enable_headful}], [SUPPORT_HEADFUL=yes])
++
++  SUPPORT_HEADLESS=yes
++  BUILD_HEADLESS="BUILD_HEADLESS:=true"
++
++  if test "x$SUPPORT_HEADFUL" = xyes; then
++    # We are building both headful and headless.
++    headful_msg="include support for both headful and headless"
++  fi
++
++  if test "x$SUPPORT_HEADFUL" = xno; then
++    # Thus we are building headless only.
++    BUILD_HEADLESS="BUILD_HEADLESS:=true"
++    headful_msg="headless only"
++  fi
++
++  AC_MSG_RESULT([$headful_msg])
++
++  AC_SUBST(SUPPORT_HEADLESS)
++  AC_SUBST(SUPPORT_HEADFUL)
++  AC_SUBST(BUILD_HEADLESS)
++
++])
+--- configure.ac.orig	2015-08-18 11:33:37.000000000 +0200
++++ configure.ac	2015-08-18 11:55:26.000000000 +0200
+@@ -55,9 +55,13 @@
+ IT_DISABLE_LANGTOOLS_TESTS
+ IT_DISABLE_JDK_TESTS
+ 
++JDKOPT_SETUP_JDK_OPTIONS
++
++if test "x$SUPPORT_HEADFUL" = xyes; then
+ # Use xvfb-run if found to run gui tests (check-jdk).
+ AC_CHECK_PROG(XVFB_RUN_CMD, xvfb-run, [xvfb-run -a -e xvfb-errors], [])
+ AC_SUBST(XVFB_RUN_CMD)
++fi
+ 
+ AC_MSG_CHECKING([whether to include PulseAudio support])
+ AC_ARG_ENABLE([pulse-java],
+@@ -174,6 +178,7 @@
+ IT_CHECK_FOR_SYSCALLS
+ AC_CONFIG_FILES([remove-intree-libraries.sh])
+ 
++if test "x$SUPPORT_HEADFUL" = xyes; then
+ dnl Check for Xproto headers and libraries.
+ PKG_CHECK_MODULES(XPROTO, xproto,[XPROTO_FOUND=yes],[XPROTO_FOUND=no])
+ if test "x${XPROTO_FOUND}" = xno
+@@ -213,6 +218,7 @@
+ Try installing libXrender-devel or configure --disable-xrender.])
+   fi
+ fi
++fi
+ 
+ if test "x${ENABLE_SYSTEMTAP}" = xyes; then
+ AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='yes'],
diff --git a/recipes-core/icedtea/openjdk-7-03b147/icedtea-disable-sun.applet-for-tools-in-headless.patch b/recipes-core/icedtea/openjdk-7-03b147/icedtea-disable-sun.applet-for-tools-in-headless.patch
new file mode 100644
index 0000000..336043f
--- /dev/null
+++ b/recipes-core/icedtea/openjdk-7-03b147/icedtea-disable-sun.applet-for-tools-in-headless.patch
@@ -0,0 +1,10 @@
+--- openjdk/jdk/make/common/Release.gmk.orig	2015-08-20 10:08:34.631526528 +0200
++++ openjdk/jdk/make/common/Release.gmk	2015-08-20 10:10:13.823526901 +0200
+@@ -340,7 +340,6 @@
+ 	sun/security/tools/SignatureFile.class \
+ 	sun/security/tools/TimestampedSigner.class \
+ 	sun/rmi/rmic		\
+-	sun/applet		\
+ 	sun/jvmstat		\
+ 	com/sun/javadoc		\
+ 	com/sun/jdi		\
diff --git a/recipes-core/icedtea/openjdk-7-03b147/icedtea-disable-x11-in-headless.patch b/recipes-core/icedtea/openjdk-7-03b147/icedtea-disable-x11-in-headless.patch
new file mode 100644
index 0000000..b7cf7a3
--- /dev/null
+++ b/recipes-core/icedtea/openjdk-7-03b147/icedtea-disable-x11-in-headless.patch
@@ -0,0 +1,15 @@
+--- openjdk/jdk/make/sun/awt/FILES_c_unix.gmk.orig	2015-08-19 11:53:47.209867982 +0200
++++ openjdk/jdk/make/sun/awt/FILES_c_unix.gmk	2015-08-19 11:57:48.677868529 +0200
+@@ -207,12 +207,6 @@
+ 	awt_MToolkit.c \
+ 	fontpath.c \
+ 	VDrawingArea.c \
+-	X11Color.c \
+-	X11Renderer.c \
+-	X11PMBlitLoops.c \
+-	X11SurfaceData.c \
+-	X11FontScaler_md.c \
+-	X11TextRenderer_md.c \
+         OGLBlitLoops.c \
+         OGLBufImgOps.c \
+         OGLContext.c \
diff --git a/recipes-core/icedtea/openjdk-7-release-03b147.inc b/recipes-core/icedtea/openjdk-7-release-03b147.inc
index 01e7a3d..98266f7 100644
--- a/recipes-core/icedtea/openjdk-7-release-03b147.inc
+++ b/recipes-core/icedtea/openjdk-7-release-03b147.inc
@@ -82,8 +82,17 @@ OPENJDK_PATCHES = " \
 	file://icedtea-flags.patch;apply=no \
 	file://icedtea-openjdk-remove-currency-data-generation-expi.patch;apply=no \
 	file://icedtea-change-to-gdb-debug-format.patch;apply=no \
+	file://icedtea-disable-x11-in-headless.patch;apply=no \
+	file://icedtea-disable-sun.applet-for-tools-in-headless.patch;apply=no \
         "
 
+OPENJDK_HEADLESS_PATCHES = " \
+	patches/icedtea-disable-x11-in-headless.patch \
+	patches/icedtea-disable-sun.applet-for-tools-in-headless.patch \
+	"
+
+CLEAN_X11_DISTRIBUTION_PATCH = "${@base_contains('PACKAGECONFIG', 'x11', '', '${OPENJDK_HEADLESS_PATCHES}', d)}"
+
 export DISTRIBUTION_PATCHES = " \
         patches/icedtea-ecj-disable-compilation.patch \
 	patches/icedtea-unbreak-float.patch \
@@ -93,4 +102,5 @@ export DISTRIBUTION_PATCHES = " \
 	patches/icedtea-flags.patch \
 	patches/icedtea-openjdk-remove-currency-data-generation-expi.patch \
 	patches/icedtea-change-to-gdb-debug-format.patch \
+	${CLEAN_X11_DISTRIBUTION_PATCH} \
         "
-- 
1.9.1


-- 
Jens Rehsack - rehsack at gmail.com




More information about the yocto mailing list