summaryrefslogtreecommitdiff
path: root/lang
diff options
context:
space:
mode:
Diffstat (limited to 'lang')
-rw-r--r--lang/openjdk8/Makefile10
-rw-r--r--lang/openjdk8/hacks.mk33
2 files changed, 34 insertions, 9 deletions
diff --git a/lang/openjdk8/Makefile b/lang/openjdk8/Makefile
index 05e644883b4..84a36e8b7a7 100644
--- a/lang/openjdk8/Makefile
+++ b/lang/openjdk8/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.11 2015/03/02 14:27:38 tnn Exp $
+# $NetBSD: Makefile,v 1.12 2015/03/05 16:35:49 tnn Exp $
DISTNAME= openjdk-1.8.31-20150207
PKGNAME= openjdk8-1.8.31
@@ -153,7 +153,11 @@ ${WRKDIR}/stage1-done:
# stage 1.5 reconfigures, since the bootstrap JDK major version might have changed now
${WRKDIR}/stage1_5-done: ${WRKDIR}/stage1-done
- ${RECURSIVE_MAKE} ${MAKEFLAGS} do-configure
+.if defined(BATCH)
+ @${RECURSIVE_MAKE} ${MAKEFLAGS} apply-va-hack
+.endif
+ @${STEP_MSG} "Reconfiguring with newly built JDK"
+ @${RECURSIVE_MAKE} ${MAKEFLAGS} do-configure
touch ${.TARGET}
# stage 2 rebuilds the JDK using native tools
@@ -171,7 +175,7 @@ ${WRKDIR}/cacerts.out:
for cert in ${WRKDIR}/cacerts/*.pem; do \
${INFO_MSG} "Importing $$cert" && \
${SETENV} LD_LIBRARY_PATH=${LD_LIBRARY_PATH} LC_ALL=C \
- ${BUILDDIR}/images/j2sdk-image/bin/keytool \
+ ${ALT_BOOTDIR}/bin/keytool \
-noprompt \
-importcert \
-keystore ${.TARGET} \
diff --git a/lang/openjdk8/hacks.mk b/lang/openjdk8/hacks.mk
index 6bb16bcec2c..f188facf5df 100644
--- a/lang/openjdk8/hacks.mk
+++ b/lang/openjdk8/hacks.mk
@@ -1,4 +1,4 @@
-# $NetBSD: hacks.mk,v 1.4 2015/03/05 13:08:18 tnn Exp $
+# $NetBSD: hacks.mk,v 1.5 2015/03/05 16:35:49 tnn Exp $
.if !defined(OPENJDK8_HACKS_MK)
OPENJDK8_HACKS_MK= # empty
@@ -12,12 +12,33 @@ post-wrapper:
${RM} -f ${BUILDLINK_DIR}/include/jmorecfg.h
${RM} -f ${BUILDLINK_DIR}/include/jpeglib.h
-# Unlimit virtual memory. Needs at least 3G of VA space to build on 64-bit
-# hosts due to -XX:CompressedClassSpaceSize being 1G by default.
-.if !empty(MACHINE_PLATFORM:MNetBSD-*-x86_64)
-UNLIMIT_RESOURCES+= vmemorysize
-ULIMIT_CMD_vmemorysize?= ulimit -v `ulimit -H -v`
+# Don't reserve more memory than we need.
+# Fixes build in artificially VA constrained environment.
+#
+VA_HACK_ARGS= -XX:ReservedCodeCacheSize=128M
+VA_HACK_ARGS+= -XX:MaxMetaspaceSize=768M
+.if ${MACHINE_ARCH} == "x86_64"
+VA_HACK_ARGS+= -XX:CompressedClassSpaceSize=128M
.endif
+.PHONY: apply-va-hack
+apply-va-hack:
+ @${STEP_MSG} "Bulk build: reducing VA usage for tools in ${ALT_BOOTDIR}"
+. for t in bin/java
+ @test -f ${ALT_BOOTDIR}/${t}.real || \
+ mv ${ALT_BOOTDIR}/${t} ${ALT_BOOTDIR}/${t}.real
+ @echo '#!/bin/sh' > ${ALT_BOOTDIR}/${t} && \
+ echo 'exec ${ALT_BOOTDIR}/${t}.real ${VA_HACK_ARGS:M*} "$$@"' >> \
+ ${ALT_BOOTDIR}/${t} && \
+ chmod +x ${ALT_BOOTDIR}/${t}
+. endfor
+. for t in bin/jar bin/jarsigner bin/javac bin/javah bin/javap bin/keytool bin/native2ascii bin/rmic
+ @test -f ${ALT_BOOTDIR}/${t}.real || \
+ mv ${ALT_BOOTDIR}/${t} ${ALT_BOOTDIR}/${t}.real
+ @echo '#!/bin/sh' > ${ALT_BOOTDIR}/${t} && \
+ echo 'exec ${ALT_BOOTDIR}/${t}.real ${VA_HACK_ARGS:C/^/-J/} "$$@"' >> \
+ ${ALT_BOOTDIR}/${t} && \
+ chmod +x ${ALT_BOOTDIR}/${t}
+. endfor
# Workaround incorrect constant folding of subnormals in javac when the FPU
# does not handle subnormal arithmetic, like on ARM in Flush-to-zero mode.