diff --git a/lang/sun-jdk7/builtin.mk b/lang/sun-jdk7/builtin.mk index 1f62bd13a731..a85eb7a970aa 100644 --- a/lang/sun-jdk7/builtin.mk +++ b/lang/sun-jdk7/builtin.mk @@ -1,4 +1,4 @@ -# $NetBSD: builtin.mk,v 1.2 2013/10/16 16:48:55 richard Exp $ +# $NetBSD: builtin.mk,v 1.3 2014/09/03 12:47:37 tron Exp $ BUILTIN_PKG:= sun-jdk7 @@ -7,6 +7,24 @@ BUILTIN_FIND_FILES.JDK7= \ /System/Library/Frameworks/JavaVM.framework/Versions/1.7/Commands/javac\ /usr/jdk/instances/jdk1.7.0/bin/javac +### +### On Darwin, there are no 1.7 symlinks that would enable us to find a +### 1.7 JDK. Instead, the best method is to use the java_home system +### program to find the default 1.7 JDK if it exists. +### +.if ${OPSYS} == "Darwin" +_JAVA_HOME_ANSWER!= \ + if [ -x /usr/libexec/java_home ]; then \ + result=`/usr/libexec/java_home -v 1.7 2> /dev/null`; \ + if [ $$? -eq 0 ]; then \ + echo "$$result"; \ + else \ + echo; \ + fi; \ + fi +BUILTIN_FIND_FILES.JDK7+= ${_JAVA_HOME_ANSWER}/bin/javac +.endif + .include "../../mk/buildlink3/bsd.builtin.mk" ### diff --git a/lang/sun-jre7/builtin.mk b/lang/sun-jre7/builtin.mk index 394914bedadc..82fd44d7460f 100644 --- a/lang/sun-jre7/builtin.mk +++ b/lang/sun-jre7/builtin.mk @@ -1,4 +1,4 @@ -# $NetBSD: builtin.mk,v 1.2 2013/10/16 16:47:29 richard Exp $ +# $NetBSD: builtin.mk,v 1.3 2014/09/03 12:47:37 tron Exp $ BUILTIN_PKG:= sun-jre7 @@ -9,6 +9,24 @@ BUILTIN_FIND_FILES.JAVAVM7= \ .include "../../mk/buildlink3/bsd.builtin.mk" +### +### On Darwin, if a suitable JRE has not already been found, try to find +### it in the standard JRE location. Normally, we would just add the +### standard JRE location path to BUILTIN_FIND_FILES.JAVAVM7 above, but +### unfortunately, the path contains a space, and the BUILTIN_FIND_FILES +### "subroutine" can't handle paths containing whitespace (because it +### iterates over the paths in a for-loop). So, we perform the check by +### hand. +### +.if ${OPSYS} == "Darwin" && \ + !empty(JAVAVM7:M__nonexistent__) +_JRE_HOME= \ + /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home +. if exists(${_JRE_HOME}) +JAVAVM7= ${_JRE_HOME} +. endif +.endif + ### ### Determine if there is a built-in implementation of the package and ### set IS_BUILTIN. appropriately ("yes" or "no"). @@ -30,7 +48,7 @@ MAKEVARS+= IS_BUILTIN.sun-jre7 !empty(IS_BUILTIN.sun-jre7:M[yY][eE][sS]) && \ empty(JAVAVM7:M__nonexistent__) -BUILTIN_VERSION.sun-jre7!= ${JAVAVM7}/bin/java -version 2>&1 | \ +BUILTIN_VERSION.sun-jre7!= ${JAVAVM7:Q}/bin/java -version 2>&1 | \ ${AWK} -F \" '{print $$2; exit}' | \ ${AWK} '{sub(/^1\./,"");sub(/_/,".");print $$1}' diff --git a/mk/java-vm.mk b/mk/java-vm.mk index 9613a4ef3e38..bdeac3b80783 100644 --- a/mk/java-vm.mk +++ b/mk/java-vm.mk @@ -1,4 +1,4 @@ -# $NetBSD: java-vm.mk,v 1.94 2013/12/27 00:11:38 tron Exp $ +# $NetBSD: java-vm.mk,v 1.95 2014/09/03 12:47:37 tron Exp $ # # This Makefile fragment handles Java dependencies and make variables, # and is meant to be included by packages that require Java either at @@ -149,8 +149,7 @@ _ONLY_FOR_PLATFORMS.openjdk7-bin= \ NetBSD-[5-9]*-x86_64 _ONLY_FOR_PLATFORMS.sun-jdk7= \ Darwin-9.*-i386 Darwin-9.*-x86_64 \ - Darwin-10.*-i386 Darwin-10.*-x86_64 \ - Darwin-11.*-i386 Darwin-11.*-x86_64 \ + Darwin-[1-9][0-9].*-i386 Darwin-[1-9][0-9].*-x86_64 \ DragonFly-*-i386 \ FreeBSD-6.*-i386 \ Linux-*-i[3-6]86 \