Fri Dec 16 16:27:23 2016 UTC ()
Enable OpenJDK 7 and 8 on Linux. Add builtin support.
Tested on openSUSE 11-42.


(asau)
diff -r0 -r1.1 pkgsrc/lang/openjdk7/builtin.mk
diff -r0 -r1.1 pkgsrc/lang/openjdk8/builtin.mk
diff -r1.107 -r1.108 pkgsrc/mk/java-vm.mk

File Added: pkgsrc/lang/openjdk7/Attic/builtin.mk
BUILTIN_PKG:=	openjdk7

BUILTIN_FIND_FILES_VAR:=	OJDK7
BUILTIN_FIND_FILES.OJDK7=	\
	/usr/lib64/jvm/java-1.7.0-openjdk-1.7.0/bin/javac

.include "../../mk/buildlink3/bsd.builtin.mk"

###
### Determine if there is a built-in implementation of the package and
### set IS_BUILTIN.<pkg> appropriately ("yes" or "no").
###
.if !defined(IS_BUILTIN.openjdk7)
.  if empty(OJDK7:M__nonexistent__)
IS_BUILTIN.openjdk7=	yes
.  else
IS_BUILTIN.openjdk7=	no
.  endif
.endif
MAKEVARS+=	IS_BUILTIN.openjdk7

###
### If there is a built-in implementation, then set BUILTIN_PKG.<pkg> to
### a package name to represent the built-in package.
###
.if !defined(BUILTIN_PKG.openjdk7) && \
    !empty(IS_BUILTIN.openjdk7:M[yY][eE][sS])
BUILTIN_VERSION.openjdk7!=	${OJDK7} -version 2>&1 | ${SED} -Ee 's:^[^0-9]*([0-9._]+)$:\1:' -e 's/_/./g' -e 's/([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)/\1.\2.\4/'
BUILTIN_PKG.openjdk7=	openjdk7-$(BUILTIN_VERSION.openjdk7)
.endif
MAKEVARS+=	BUILTIN_PKG.openjdk7

###
### Determine whether we should use the built-in implementation if it
### exists, and set USE_BUILTIN.<pkg> appropriate ("yes" or "no").
###
.if !defined(USE_BUILTIN.openjdk7)
.  if ${PREFER.openjdk7} == "pkgsrc"
USE_BUILTIN.openjdk7=	no
.  else
USE_BUILTIN.openjdk7=	${IS_BUILTIN.openjdk7}
.    if defined(BUILTIN_PKG.openjdk7) && \
	!empty(IS_BUILTIN.openjdk7:M[yY][eE][sS])
USE_BUILTIN.openjdk7=	yes
.      for _dep_ in ${BUILDLINK_API_DEPENDS.openjdk7}
.        if !empty(USE_BUILTIN.openjdk7:M[yY][eE][sS])
USE_BUILTIN.openjdk7!=							\
	if ${PKG_ADMIN} pmatch ${_dep_:Q} ${BUILTIN_PKG.openjdk7:Q}; then	\
		${ECHO} "yes";						\
	else								\
		${ECHO} "no";						\
	fi
.        endif
.      endfor
.    endif
.  endif
.endif
MAKEVARS+=	USE_BUILTIN.openjdk7

###
### The section below only applies if we are not including this file
### solely to determine whether a built-in implementation exists.
###
CHECK_BUILTIN.openjdk7?=	no
.if !empty(CHECK_BUILTIN.openjdk7:M[nN][oO])
#
# Here we place code that depends on whether USE_BUILTIN.openjdk7 is
# set to "yes" or "no".
#
.  if !empty(USE_BUILTIN.openjdk7:M[yY][eE][sS])
PKG_JAVA_HOME=	${OJDK7:H:H}
.  endif
.endif  # CHECK_BUILTIN.openjdk7

File Added: pkgsrc/lang/openjdk8/builtin.mk
BUILTIN_PKG:=	openjdk8

BUILTIN_FIND_FILES_VAR:=	OJDK8
BUILTIN_FIND_FILES.OJDK8=	\
	/usr/lib64/jvm/java-1.8.0-openjdk-1.8.0/bin/javac

.include "../../mk/buildlink3/bsd.builtin.mk"

###
### Determine if there is a built-in implementation of the package and
### set IS_BUILTIN.<pkg> appropriately ("yes" or "no").
###
.if !defined(IS_BUILTIN.openjdk8)
.  if empty(OJDK8:M__nonexistent__)
IS_BUILTIN.openjdk8=	yes
.  else
IS_BUILTIN.openjdk8=	no
.  endif
.endif
MAKEVARS+=	IS_BUILTIN.openjdk8

###
### If there is a built-in implementation, then set BUILTIN_PKG.<pkg> to
### a package name to represent the built-in package.
###
.if !defined(BUILTIN_PKG.openjdk8) && \
    !empty(IS_BUILTIN.openjdk8:M[yY][eE][sS])
BUILTIN_VERSION.openjdk8!=	${OJDK8} -version 2>&1 | ${SED} -Ee 's:^[^0-9]*([0-9._]+)$:\1:' -e 's/_/./g' -e 's/([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)/\1.\2.\4/'
BUILTIN_PKG.openjdk8=	openjdk8-$(BUILTIN_VERSION.openjdk8)
.endif
MAKEVARS+=	BUILTIN_PKG.openjdk8

###
### Determine whether we should use the built-in implementation if it
### exists, and set USE_BUILTIN.<pkg> appropriate ("yes" or "no").
###
.if !defined(USE_BUILTIN.openjdk8)
.  if ${PREFER.openjdk8} == "pkgsrc"
USE_BUILTIN.openjdk8=	no
.  else
USE_BUILTIN.openjdk8=	${IS_BUILTIN.openjdk8}
.    if defined(BUILTIN_PKG.openjdk8) && \
	!empty(IS_BUILTIN.openjdk8:M[yY][eE][sS])
USE_BUILTIN.openjdk8=	yes
.      for _dep_ in ${BUILDLINK_API_DEPENDS.openjdk8}
.        if !empty(USE_BUILTIN.openjdk8:M[yY][eE][sS])
USE_BUILTIN.openjdk8!=							\
	if ${PKG_ADMIN} pmatch ${_dep_:Q} ${BUILTIN_PKG.openjdk8:Q}; then	\
		${ECHO} "yes";						\
	else								\
		${ECHO} "no";						\
	fi
.        endif
.      endfor
.    endif
.  endif
.endif
MAKEVARS+=	USE_BUILTIN.openjdk8

###
### The section below only applies if we are not including this file
### solely to determine whether a built-in implementation exists.
###
CHECK_BUILTIN.openjdk8?=	no
.if !empty(CHECK_BUILTIN.openjdk8:M[nN][oO])
#
# Here we place code that depends on whether USE_BUILTIN.openjdk8 is
# set to "yes" or "no".
#
.  if !empty(USE_BUILTIN.openjdk8:M[yY][eE][sS])
PKG_JAVA_HOME=	${OJDK8:H:H}
.  endif
.endif  # CHECK_BUILTIN.openjdk8

cvs diff -r1.107 -r1.108 pkgsrc/mk/java-vm.mk (expand / switch to unified diff)

--- pkgsrc/mk/java-vm.mk 2016/07/13 14:16:17 1.107
+++ pkgsrc/mk/java-vm.mk 2016/12/16 16:27:23 1.108
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $NetBSD: java-vm.mk,v 1.107 2016/07/13 14:16:17 jperkin Exp $ 1# $NetBSD: java-vm.mk,v 1.108 2016/12/16 16:27:23 asau Exp $
2# 2#
3# This Makefile fragment handles Java dependencies and make variables, 3# This Makefile fragment handles Java dependencies and make variables,
4# and is meant to be included by packages that require Java either at 4# and is meant to be included by packages that require Java either at
5# build-time or at run-time. 5# build-time or at run-time.
6# 6#
7# User-settable variables: 7# User-settable variables:
8# 8#
9# PKG_JVM_DEFAULT 9# PKG_JVM_DEFAULT
10# The JVM that should be used if nothing particular is specified. 10# The JVM that should be used if nothing particular is specified.
11# 11#
12# Possible values: kaffe openjdk7 openjdk8 12# Possible values: kaffe openjdk7 openjdk8
13# sun-jdk6 sun-jdk7 oracle-jdk8 13# sun-jdk6 sun-jdk7 oracle-jdk8
14# Default value: (platform-dependent) 14# Default value: (platform-dependent)
@@ -129,34 +129,38 @@ _ONLY_FOR_PLATFORMS.sun-jdk6= \ @@ -129,34 +129,38 @@ _ONLY_FOR_PLATFORMS.sun-jdk6= \
129 Darwin-11.*-i386 Darwin-11.*-x86_64 \ 129 Darwin-11.*-i386 Darwin-11.*-x86_64 \
130 DragonFly-*-i386 \ 130 DragonFly-*-i386 \
131 FreeBSD-6.*-i386 \ 131 FreeBSD-6.*-i386 \
132 Linux-*-i[3-6]86 \ 132 Linux-*-i[3-6]86 \
133 Linux-*-x86_64 \ 133 Linux-*-x86_64 \
134 NetBSD-*-i386 NetBSD-*-x86_64 \ 134 NetBSD-*-i386 NetBSD-*-x86_64 \
135 SunOS-5.10-i386 \ 135 SunOS-5.10-i386 \
136 SunOS-5.10-sparc \ 136 SunOS-5.10-sparc \
137 SunOS-5.10-x86_64 \ 137 SunOS-5.10-x86_64 \
138 SunOS-5.11-i386 \ 138 SunOS-5.11-i386 \
139 SunOS-5.11-x86_64 139 SunOS-5.11-x86_64
140_ONLY_FOR_PLATFORMS.openjdk7= \ 140_ONLY_FOR_PLATFORMS.openjdk7= \
141 DragonFly-*-* \ 141 DragonFly-*-* \
 142 Linux-*-i[3-6]86 \
 143 Linux-*-x86_64 \
142 NetBSD-[5-9]*-i386 \ 144 NetBSD-[5-9]*-i386 \
143 NetBSD-[5-9]*-x86_64 \ 145 NetBSD-[5-9]*-x86_64 \
144 NetBSD-[7-9]*-sparc64 \ 146 NetBSD-[7-9]*-sparc64 \
145 NetBSD-[7-9]*-earmv[67]hf \ 147 NetBSD-[7-9]*-earmv[67]hf \
146 SunOS-*-i386 \ 148 SunOS-*-i386 \
147 SunOS-*-x86_64 149 SunOS-*-x86_64
148_ONLY_FOR_PLATFORMS.openjdk8= \ 150_ONLY_FOR_PLATFORMS.openjdk8= \
149 DragonFly-*-* \ 151 DragonFly-*-* \
 152 Linux-*-i[3-6]86 \
 153 Linux-*-x86_64 \
150 NetBSD-[5-9]*-i386 \ 154 NetBSD-[5-9]*-i386 \
151 NetBSD-[5-9]*-x86_64 \ 155 NetBSD-[5-9]*-x86_64 \
152 NetBSD-[7-9]*-sparc64 \ 156 NetBSD-[7-9]*-sparc64 \
153 NetBSD-[7-9]*-earmv[67]hf \ 157 NetBSD-[7-9]*-earmv[67]hf \
154 SunOS-*-i386 \ 158 SunOS-*-i386 \
155 SunOS-*-x86_64 159 SunOS-*-x86_64
156_ONLY_FOR_PLATFORMS.sun-jdk7= \ 160_ONLY_FOR_PLATFORMS.sun-jdk7= \
157 Darwin-9.*-i386 Darwin-9.*-x86_64 \ 161 Darwin-9.*-i386 Darwin-9.*-x86_64 \
158 Darwin-[1-9][0-9].*-i386 Darwin-[1-9][0-9].*-x86_64 \ 162 Darwin-[1-9][0-9].*-i386 Darwin-[1-9][0-9].*-x86_64 \
159 DragonFly-*-i386 \ 163 DragonFly-*-i386 \
160 FreeBSD-6.*-i386 \ 164 FreeBSD-6.*-i386 \
161 Linux-*-i[3-6]86 \ 165 Linux-*-i[3-6]86 \
162 Linux-*-x86_64 \ 166 Linux-*-x86_64 \