Subject: pkg/17825: PKG_JVM=sun-jdk forces 1.4 _JAVA_HOME even for sun-jdk13
To: None <gnats-bugs@gnats.netbsd.org>
From: Jaromir Dolecek <jdolecek@NetBSD.org>
List: netbsd-bugs
Date: 08/03/2002 20:35:58
>Number:         17825
>Category:       pkg
>Synopsis:       PKG_JVM=sun-jdk forces 1.4 _JAVA_HOME even for sun-jdk13
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Aug 03 11:37:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Jaromir Dolecek
>Release:        NetBSD 1.6D
>Organization:
	
>Environment:
System: NetBSD s102-n054.tele2.cz 1.6D NetBSD 1.6D (SARUMAN) #231: Thu Jul 25 21:10:37 CEST 2002 dolecek@s102-n054.tele2.cz:/usr/home/dolecek/soft/netbsd/sys/arch/i386/compile/SARUMAN i386
Architecture: i386
Machine: i386
>Description:
	When a package (experienced with misc/openoffice) uses PKG_JVM
	sun-jdk, user has sun-jdk13 installed, but doesn't have sun-jdk14
	installed, the dependencies succeeed, but _JAVA_HOME isn't set
	properly. This is due to unconditional use of jdk14 JAVA_HOME.
>How-To-Repeat:
	pkg_delete sun-jdk14
	pkg_delete sun-jre14
	pkg_add sun-jdk13
	cd /usr/pkgsrc/misc/openoffice && make

	realize (after a while), that correct JDK was not found
	(need rev. 1.19 of the openoffice Makefile, which uses _JAVA_HOME)
>Fix:

	Workaround I'm going to commit for openoffice is that I use
	PKG_JVM=sun-jdk13. This is needed anyway, since some Java code
	doesn't compile with sun-jdk14.

	However, "sun-jdk" should work the supposed way, i.e. setup
	environment for either sun-jdk13 or sun-jdk14 depending on which
	one is installed. It's entirely possible I understood "sun-jdk"
	purpose wrong way, but I think this _is_ the intent.

	One of ways would be to do something like following in bsd.pkg.mk
	for the "sun-jdk" case:

.if ${_J13:!pkg_info sun-jdk13 >/dev/null 2>&1 && echo YES || echo NO!} == "YES"
_JAVA_PREFIX_DEFAULT=		${LOCALBASE}/java/sun-1.3.1
.else
_JAVA_PREFIX_DEFAULT=		${LOCALBASE}/java/sun-1.4.0
.endif

	I'm suggesting this way (i.e. use 1.3 base if sun-jdk13 is
	installed, without regard to whether or not sun-jdk14 is
	installed), since the depends regex favours 1.3 to
	1.4 (it's sun-jdk1[34], rather than sun-jsk1[43]).
>Release-Note:
>Audit-Trail:
>Unformatted: