Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 Oct 2015 16:14:29 -0400
From:      "Curtis Hamilton" <hamiltcl@verizon.net>
To:        "'Justin Hibbits'" <jrh29@alumni.cwru.edu>
Cc:        "'FreeBSD PowerPC ML'" <freebsd-ppc@freebsd.org>
Subject:   RE: OpenJDK for PowerPC64
Message-ID:  <003701d1102a$ee366c70$caa34550$@verizon.net>
In-Reply-To: <CAHSQbTAurUob%2B5ypH%2BG5_2V8dh-iGWpxobGe-EzPHBXF-ptDfg@mail.gmail.com>
References:  <002a01d11001$a4b126e0$ee1374a0$@verizon.net> <CAHSQbTAurUob%2B5ypH%2BG5_2V8dh-iGWpxobGe-EzPHBXF-ptDfg@mail.gmail.com>

index | next in thread | previous in thread | raw e-mail

[-- Attachment #1 --]
I don't have a wiki page.  My initial success was in building the mercurial
OpenJDK7 BSD-Port, using the attached build script and instructions obtained
from the OpenJDK Wiki Darwin9Build
(https://wiki.openjdk.java.net/display/BSDPort/Darwin9Build) section.
Subsequently, I used information from the arm patch to modify the ports
Makefile and build the ports distribution.  Other than what's in the make
file patch, no other patches were needed, as I used the mercurial build as
the bootstrap.

The key for non-x86 builds is the bootstrap.  I used the GCC java tools and
created a bootstrap (/usr/local/bootstrap-openjdk) using sym links to the
GCC java executables in /usr/local/bin.   I can provide more details if
needed, however, building GCC java was not as straight forward as it is not
a configurable option for non-x86 GCC builds.  I had to modify the port
Makefile.

Regards,

Curtis


-----Original Message-----
From: chmeeedalf@gmail.com [mailto:chmeeedalf@gmail.com] On Behalf Of Justin
Hibbits
Sent: Monday, October 26, 2015 3:26 PM
To: Curtis Hamilton <hamiltcl@verizon.net>
Cc: FreeBSD PowerPC ML <freebsd-ppc@freebsd.org>
Subject: Re: OpenJDK for PowerPC64

On Mon, Oct 26, 2015 at 10:19 AM, Curtis Hamilton <hamiltcl@verizon.net>
wrote:
> Here is my contribution to all those interested in keeping the PowerPC 
> relevant.  I've been successful in building OpenJDK7 using Zero VM for 
> PPC64.  The binaries for openjdk7 for powerpc64 can be found at the 
> below
> URL:
>
> https://drive.google.com/folderview?id=0Bz7VO-WP3rlpM3BabUd6ejlya3c&us
> p=shar
> ing
>
> Give them a try and provide any feedback to the list.
>
> Enjoy!
>
> BTW: OpenJDK8 may soon be on the way!

That's fantastic!  I'll try this soon on my G5.  Do you have any wiki page
with build steps, or even better a port change to add this to ports?

- Justin

[-- Attachment #2 --]
--- ./Makefile
+++ ./Makefile
@@ -78,11 +78,12 @@
 
 DOS2UNIX_FILES=	jdk/src/share/classes/com/sun/org/apache/xml/internal/security/resource/xmlsecurity_en.properties
 
-OPENJDK_OSARCH=	bsd-${ARCH:S/i386/i586/}
+OPENJDK_OSARCH=	bsd-${ARCH:S/i386/x86/:S/amd64/x86_64/:S/armv6/arm/:S/powerpc64/powerpc/}
 
 NOPRECIOUSMAKEVARS=	yes
 
-ONLY_FOR_ARCHS=	i386 amd64
+ONLY_FOR_ARCHS=	i386 amd64 armv6 powerpc64
 
 _MAKE_JOBS=	#
 MAKE_ENV+=	LANG="C" \
@@ -116,6 +117,23 @@
 
 MAKE_ENV+=	HOTSPOT_BUILD_JOBS=${MAKE_JOBS_NUMBER}

 .include <bsd.port.options.mk>

+.if ${ARCH} == "armv6"
+CONFIGURE_ARGS+=	--with-jvm-variants=zero
+
+# we're building a zero build
+JDK_BUILDDIR=	${WRKSRC}/build/${OPENJDK_OSARCH}-normal-zero-${JDK_BUILD_TYPE}
+
+# bootstrap-openjdk is based on openjdk7 and can compile openjdk8
+BOOTSTRAP_JDKS=		${LOCALBASE}/bootstrap-openjdk
+BOOTSTRAPJDKDIR=	${LOCALBASE}/bootstrap-openjdk
+
+# libffi is needed for zerobuild
+BUILD_DEPENDS+= ${BOOTSTRAPJDKDIR}/bin/javac:${PORTSDIR}/java/bootstrap-openjdk
+LIB_DEPENDS+=	libffi.so:${PORTSDIR}/devel/libffi
+.endif
+
+.if ${ARCH} == "powerpc64"
+CONFIGURE_ARGS+=	--with-jvm-variants=zero
+
+# libffi is needed for zerobuild
+BUILD_DEPENDS+= ${BOOTSTRAPJDKDIR}/bin/javac:${PORTSDIR}/java/bootstrap-openjdk
+LIB_DEPENDS+=	libffi.so:${PORTSDIR}/devel/libffi
+
+MAKE_ENV+=	ZERO_BUILD=true \
+			ZERO_ENDIANNESS=big \
+			ZERO_LIBARCH=ppc \
+			ZERO_ARCHDEF=PPC \
+			ZERO_ARCHFLAG="-mpowerpc64" \
+			PARALLEL_COMPILE_JOBS=8 
+
+.endif
+
 BOOTSTRAP_JDKS=	${LOCALBASE}/openjdk7 \
 		${LOCALBASE}/openjdk6 \
 		${LOCALBASE}/bootstrap-openjdk
@@ -143,7 +161,7 @@
 
 # GCC is broken with PCH: https://lists.freebsd.org/pipermail/svn-src-all/2015-March/101722.html
 .if ${COMPILER_TYPE} == gcc
-MAKE_ENV+=	USE_PRECOMPILED_HEADER=0
+MAKE_ENV+=	USE_PRECOMPILED_HEADER=1
 .endif
 
 .if empty(ICONV_LIB)
@@ -160,6 +178,34 @@
 		${WRKSRC}/jdk/make/sun/splashscreen/Makefile \
 		${WRKSRC}/jdk/make/java/npt/Makefile \
 		${WRKSRC}/jdk/make/java/instrument/Makefile
+.endif
+
+.if ${ARCH} == "armv6" || "powerpc64"
+	# From NetBSD http://cvsweb.netbsd.org/bsdweb.cgi/pkgsrc/lang/openjdk7/hacks.mk
+	# Workaround incorrect constant folding of subnormals in javac when the FPU
+	# does not handle subnormal arithmetic, like on powerpc in Flush-to-zero mode.
+	# These workarounds avoid underflow conditions during the bootstrap so the
+	# JDK can correctly build itself. Compiling or running programs other than
+	# openjdk itself on such hardware may still cause unexpected behaviour.
+	#
+	@${REINPLACE_CMD} -e 's|2.2250738585072014e-308d*|Double.longBitsToDouble(0x10000000000000L)|ig' \
+		-e 's|0x1.0p-1022d*|Double.longBitsToDouble(0x10000000000000L)|ig' \
+		-e 's|4.9e-324d*|Double.longBitsToDouble(0x1L)|ig' \
+		-e 's|0x0.0000000000001p-1022d*|Double.longBitsToDouble(0x1L)|ig' \
+		${WRKSRC}/jdk/src/share/classes/sun/misc/DoubleConsts.java \
+		${WRKSRC}/jdk/src/share/classes/java/lang/Double.java
+	@${REINPLACE_CMD} -e 's|1.17549435e-38f*|Float.intBitsToFloat(0x800000)|ig' \
+		-e 's|0x1.0p-126f*|Float.intBitsToFloat(0x800000)|ig' \
+		-e 's|1.4e-45f*|Float.intBitsToFloat(0x1)|ig' \
+		-e 's|0x0.000002P-126f*|Float.intBitsToFloat(0x1)|ig' \
+		${WRKSRC}/jdk/src/share/classes/sun/misc/FloatConsts.java \
+		${WRKSRC}/jdk/src/share/classes/java/lang/Float.java
+	@${REINPLACE_CMD} -e 's|n.floatValue() == 0.0f && !isZero(proper)|& \&\& Float.floatToIntBits(n) != 0x1|' \
+		-e 's|n.doubleValue() == 0.0d && !isZero(proper)|& \&\& Double.doubleToLongBits(n) != 0x1L|' \
+		${WRKSRC}/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java
+	@${REINPLACE_CMD} -e 's|x == 0.0f && 1.0f / x > 0.0f|Float.floatToIntBits(x) == 0x0|g' \
+		-e 's|x == 0.0d && 1.0d / x > 0.0d|Double.doubleToLongBits(x) == 0x0L|g' \
+		${WRKSRC}/langtools/src/share/classes/com/sun/tools/javac/jvm/Items.java
 .endif
 
 .if ${PORT_OPTIONS:MTZUPDATE}

[-- Attachment #3 --]
#!/bin/sh
cd /usr/ports/tmp/bsd-port
time env -i \
 PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin \
 LANG=C \
 gmake \
 CC=gcc48 \
 CXX=g++48 \
 ALLOW_DOWNLOADS=true \
 ALT_JAVA_HOME=/usr/local/bootstrap-openjdk \
 ALT_BOOTDIR=/usr/local/bootstrap-openjdk \
 ALT_JDK_IMPORT_PATH=/usr/local/bootstrap-openjdk \
 ALT_FREETYPE_HEADERS_PATH=/usr/local/include \
 ALT_FREETYPE_LIB_PATH=/usr/local/lib \
 ALT_CACERTS_FILE=/usr/local/bootstrap-openjdk/jre/lib/security/cacerts \
 LIBFFI_CFLAGS="-I/usr/local/lib/libffi-3.2.1/include" \
 DEFAULT_LIBPATH="/lib:/usr/lib:/usr/local/lib" \
 NO_DOCS=true \
 ZERO_BUILD=true \
 ZERO_ENDIANNESS=big \
 ZERO_LIBARCH=ppc \
 ZERO_ARCHDEF=PPC \
 ZERO_ARCHFLAG="-mpowerpc64" \
 PARALLEL_COMPILE_JOBS=8 \
 HOTSPOT_BUILD_JOBS=8 
help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?003701d1102a$ee366c70$caa34550$>