Subject: Non-pkgsrc JDK support for Solaris
To: None <>
From: Gavan Fantom <>
List: tech-pkg
Date: 09/22/2003 19:09:01
Hi folks,

I've been wondering what to do with Java packages on Solaris. There's
obviously no need to depend on a pkgsrc JVM when we have a nicely working
JVM in /usr/java.

Here's a rather rough set of diffs to to allow a non-pkgsrc JVM
to be used. It could probably be improved on, so here it is for

In particular, I wasn't sure whether to leave sun-jdk14 to mean
pkgsrc-sun-jdk14, or to special-case sun-jdk14 to mean non-pkgsrc java if
present. Also, whether "native" is extensible enough to cover non-pkgsrc
java on other systems.

So, comments?

RCS file: /cvsroot/pkgsrc/mk/,v
retrieving revision 1.16
diff -u -r1.16
---	2003/09/02 06:59:47	1.16
+++	2003/09/22 17:58:13
@@ -45,7 +45,7 @@
 .if defined(USE_JAVA2) && !empty(USE_JAVA2:M[yY][eE][sS])
 _PKG_JVMS?=		sun-jdk13 sun-jdk14 blackdown-jdk13 wonka jdk12 jdk13
-_PKG_JVMS?=		jdk sun-jdk13 sun-jdk14 blackdown-jdk13 kaffe wonka jdk12 jdk13
+_PKG_JVMS?=		jdk sun-jdk13 sun-jdk14 blackdown-jdk13 kaffe wonka jdk12 jdk13 native

 # To be deprecated: if PKG_JVM is explicitly set, then use it as the
@@ -70,6 +70,8 @@
 _PKG_JVM_DEFAULT?=	blackdown-jdk13
 .  elif !empty(MACHINE_PLATFORM:MDarwin-*-*)
 _PKG_JVM_DEFAULT?=	sun-jdk
+.  elif !empty(MACHINE_PLATFORM:MSunOS-*-*)
+_PKG_JVM_DEFAULT?=	native
 .  else
 .  endif
@@ -97,6 +99,8 @@
 	*-*-arm32 *-*-i386 *-*-m68k *-*-mips* *-*-sparc *-*-powerpc
 	*-*-arm32 *-*-i386
+	SunOS-*-*

 # Set the accepted JVMs for this platform.
 .for _jvm_ in ${_PKG_JVMS}
@@ -119,14 +123,20 @@
 # Mark the acceptable JVMs and check which JVM packages are installed.
 .for _jvm_ in ${_PKG_JVMS_ACCEPTED}
 _PKG_JVM_OK.${_jvm_}=	yes
+.  if defined(_JAVA_PKGBASE.${_jvm_})
 _PKG_JVM_INSTALLED.${_jvm_}!= \
 	if ${PKG_INFO} -qe ${_JAVA_PKGBASE.${_jvm_}}; then		\
 		${ECHO} yes;						\
 	else								\
 		${ECHO} no;						\
+.  endif

+.if !empty(_PKG_JVMS_ACCEPTED:Mnative) && exists(/usr/java)
 # Convert "sun-jdk" into "sun-jdk13" or "sun-jdk14" depending on the
 # platform.  Recent versions of NetBSD and Linux can use either the 1.3
 # or 1.4 version of the Sun JDK, so default to the newer installed one.
@@ -205,6 +215,7 @@
 _JRE.blackdown-jdk13=	blackdown-jre13
 _JRE.kaffe=		kaffe
 _JRE.wonka=		wonka
+_JRE.native=		native


@@ -248,9 +259,13 @@
+.elif ${_PKG_JVM} == "native"
+_JAVA_HOME_DEFAULT=	/usr/java/jre
+.if empty(_PKG_JVM:Mnative)


@@ -267,12 +282,12 @@
 # the JDK.
 .if empty(USE_JAVA:M[rR][uU][nN])
-.  if defined(USE_BUILDLINK2) && empty(USE_BUILDLINK2:M[nN][oO])
-.    if defined(_JDK_PKGSRCDIR)
+.  if defined(_JDK_PKGSRCDIR)
+.    if defined(USE_BUILDLINK2) && empty(USE_BUILDLINK2:M[nN][oO])
 .      include "${_JDK_PKGSRCDIR}/"
-.    endif
-.  else
+.    else
+.    endif
 .  endif

Gillette - the best a man can forget