java/65335: [PATCH] java/jdk14: use bsd.java.mk for JDK bootstrap setting

Herve Quiroz herve.quiroz at esil.univ-mrs.fr
Thu Apr 8 12:40:11 PDT 2004


>Number:         65335
>Category:       java
>Synopsis:       [PATCH] java/jdk14: use bsd.java.mk for JDK bootstrap setting
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-java
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu Apr 08 12:40:10 PDT 2004
>Closed-Date:
>Last-Modified:
>Originator:     Herve Quiroz
>Release:        FreeBSD 5.2.1-RELEASE i386
>Organization:
>Environment:
System: FreeBSD arabica.esil.univ-mrs.fr 5.2.1-RELEASE FreeBSD 5.2.1-RELEASE #0: Fri Feb 27 11:36:17 CET 2004
>Description:

This was one of my plans with bsd.java.mk 2.0 so here it is. This patch moves
all the JDK bootstrap picking logic from the port to bsd.java.mk.  I had to
modify bsd.java.mk itself so there's also a patch for it.

It's just a "draft" for now (things haven't been removed but just commented
out).

I realize that maybe I should have patched java/jdk13 instead as Greg is the
maintainer and is more aware of the internals of bsd.java.mk but I noticed this
port (java/jdk14) would not bootstrap with a native JDK if a linux one was
installed. So Greg, if you wish to work on your maintained JDK port instead,
please tell me and I will provide a patch as well.

As I said above, this is still "work-in-progress" as more testing needs to be
done. Especially building with IBM JDKs... There was a discussion a long ago on
freebsd-java at FreeBSD.org regarding building this IBM bootstrapping but I can't
find it in the archives. Anyway, IIRC it was regarding JDK 1.3

The main problem encountered was cyclic dependency issues but this has been
fixed.

If someone feels like having time to spare (and CPU to burn), please help
yourself and try the patch ;) I will do tests on my own anyway but this will
take time obviously.

java/jdk14 Port maintainer (phantom at FreeBSD.org) is cc'd.
java/jdk13 Port maintainer (glewis at FreeBSD.org) is cc'd.
bsd.java.mk maintainer (znerd at FreeBSD.org) is cc'd.

Generated with FreeBSD Port Tools 0.50

>How-To-Repeat:

$ cd /usr/portsjava/linux-sun-jdk14
$ make install

  [...]

$ cd /usr/ports/java/jdk14
$ make install

  [...]

$ cd /usr/ports/java/jdk14
$ make build-depends-list
/usr/ports/archivers/unzip
/usr/ports/archivers/zip
/usr/ports/devel/gmake
/usr/ports/devel/m4
/usr/ports/devel/nspr
/usr/ports/java/linux-sun-jdk14
/usr/ports/x11-toolkits/open-motif

IMHO, 'java/linux-sun-jdk14' should not be used as 'java/jdk14' is already
there for bootstrapping.

>Fix:

--- jdk-1.4.2p6_4.patch begins here ---
diff -ruN --exclude=CVS /usr/ports/java/jdk14.original/Makefile /usr/ports/java/jdk14/Makefile
--- /usr/ports/java/jdk14.original/Makefile	Thu Apr  8 20:19:11 2004
+++ /usr/ports/java/jdk14/Makefile	Thu Apr  8 20:50:39 2004
@@ -29,54 +29,62 @@
 RUN_DEPENDS+=	${X11BASE}/lib/X11/fonts/URW/fonts.dir:${PORTSDIR}/x11-fonts/urwfonts
 .endif
 
+USE_JAVA=	yes
+JAVA_VERSION=	1.4
+JAVA_BUILD=	jdk
+
 WRKSRC=		${WRKDIR}/control/make
 
 JDK_VERSION=	1.4.2
 JDK_PATCHSET_VERSION=	6
 LATEST_LINK=	jdk14
 
-SUN_LINUX_JDK_VERSION=  1.4.2
-
-.if !defined(WITH_LINUX_BOOTSTRAP)
-NATIVE_BOOTSTRAP_JDKS=	${LOCALBASE}/jdk1.4.2 \
-			${LOCALBASE}/jdk1.4.1
-.endif
-
-LINUX_BOOTSTRAP_JDKS=	${LOCALBASE}/linux-sun-jdk1.4.2_03 \
-			${LOCALBASE}/linux-sun-jdk1.4.2_02 \
-			${LOCALBASE}/linux-sun-jdk1.4.2_01 \
-			${LOCALBASE}/linux-sun-jdk1.4.2 \
-			${LOCALBASE}/linux-sun-jdk1.4.1_02 \
-			${LOCALBASE}/linux-sun-jdk1.4.1_01 \
-			${LOCALBASE}/linux-sun-jdk1.4.1
+#SUN_LINUX_JDK_VERSION=  1.4.2
+#
+#.if !defined(WITH_LINUX_BOOTSTRAP)
+#NATIVE_BOOTSTRAP_JDKS=	${LOCALBASE}/jdk1.4.2 \
+#			${LOCALBASE}/jdk1.4.1
+#.endif
+#
+#LINUX_BOOTSTRAP_JDKS=	${LOCALBASE}/linux-sun-jdk1.4.2_03 \
+#			${LOCALBASE}/linux-sun-jdk1.4.2_02 \
+#			${LOCALBASE}/linux-sun-jdk1.4.2_01 \
+#			${LOCALBASE}/linux-sun-jdk1.4.2 \
+#			${LOCALBASE}/linux-sun-jdk1.4.1_02 \
+#			${LOCALBASE}/linux-sun-jdk1.4.1_01 \
+#			${LOCALBASE}/linux-sun-jdk1.4.1
 
 .include <bsd.port.pre.mk>
 
-# do we have valid native jdk installed?
-.if !defined(WITH_LINUX_BOOTSTRAP)
-.for CJDK in ${NATIVE_BOOTSTRAP_JDKS}
-.  if !defined(JDK14DIR) && exists(${CJDK}/bin/javac)
-JDK14DIR=	${CJDK}
-.  endif
-.endfor
+.if (${JAVA_PORT_OS} == "linux")
+WITH_LINUX_BOOTSTRAP=	yes
 .endif
 
+# do we have valid native jdk installed?
+#.if !defined(WITH_LINUX_BOOTSTRAP)
+#.for CJDK in ${NATIVE_BOOTSTRAP_JDKS}
+#.  if !defined(JDK14DIR) && exists(${CJDK}/bin/javac)
+#JDK14DIR=	${CJDK}
+#.  endif
+#.endfor
+#.endif
+
 # do we have valid linux jdk installed?
-.if !defined(JDK14DIR)
-.for CJDK in ${LINUX_BOOTSTRAP_JDKS}
-.  if !defined(JDK14DIR) && exists(${CJDK}/bin/javac)
-JDK14DIR=	${CJDK}
-WITH_LINUX_BOOTSTRAP=	YES
-.  endif
-.endfor
-.endif
+#.if !defined(JDK14DIR)
+#.for CJDK in ${LINUX_BOOTSTRAP_JDKS}
+#.  if !defined(JDK14DIR) && exists(${CJDK}/bin/javac)
+#JDK14DIR=	${CJDK}
+#WITH_LINUX_BOOTSTRAP=	YES
+#.  endif
+#.endfor
+#.endif
 
 # if no valid jdk found, set dependency
-.if !defined(JDK14DIR)
-JDK14DIR?=	${LOCALBASE}/linux-sun-jdk${SUN_LINUX_JDK_VERSION}
-.endif
-
-BUILD_DEPENDS+=	${JDK14DIR}/bin/javac:${PORTSDIR}/java/linux-sun-jdk14
+#.if !defined(JDK14DIR)
+#JDK14DIR?=	${LOCALBASE}/linux-sun-jdk${SUN_LINUX_JDK_VERSION}
+#.endif
+#
+#BUILD_DEPENDS+=	${JDK14DIR}/bin/javac:${PORTSDIR}/java/linux-sun-jdk14
 
 # workaround to handle both 'zip' and 'tar.gz' distfiles
 USE_ZIP=	YES
@@ -87,7 +95,7 @@
 USE_REINPLACE=	YES
 RESTRICTED=	"Redistribution of pre-compiled binaries is not permitted"
 NO_CDROM=	"Redistribution of pre-compiled binaries is not permitted"
-MAKE_ENV=	ALT_BOOTDIR="${JDK14DIR}" \
+MAKE_ENV=	ALT_BOOTDIR="${JAVA_HOME}" \
 		ALT_MOTIF_DIR="${X11BASE}" \
 		SYS_CFLAGS="${CFLAGS}" \
 		DEV_ONLY="YES" \
--- jdk-1.4.2p6_4.patch ends here ---

--- bsd.java.mk.patch begins here ---
diff -u /usr/ports/Mk/bsd.java.mk.original /usr/ports/Mk/bsd.java.mk
--- bsd.java.mk.original	Thu Apr  8 17:01:00 2004
+++ bsd.java.mk	Thu Apr  8 20:48:00 2004
@@ -295,6 +295,16 @@
 .		endif
 # From here, the port is using bsd.java.mk v2.0
 
+# Determine if the current port is a JDK port
+# (We should have a more generic way of doing this)
+.		if (${PORTNAME} == "jdk")
+.			if (${PWD} == "${PORTSDIR}/${_JAVA_PORT_NATIVE_BSDJAVA_JDK_1_3}")
+_THIS_JAVA_PORT=	JAVA_PORT_NATIVE_BSDJAVA_JDK_1_3
+.			elif (${PWD} == "${PORTSDIR}/${_JAVA_PORT_NATIVE_BSDJAVA_JDK_1_4}")
+_THIS_JAVA_PORT=	JAVA_PORT_NATIVE_BSDJAVA_JDK_1_4
+.			endif
+.		endif
+
 # List JDK ports by version
 _JAVA_PORTS_1_4= JAVA_PORT_NATIVE_BSDJAVA_JDK_1_4 \
 				 JAVA_PORT_LINUX_BLACKDOWN_JDK_1_4 \
@@ -448,7 +458,7 @@
 
 # If no installed JDK port fits, then pick one from the list of possible ones
 .		else
-_JAVA_PORT!=	${ECHO_CMD} "${_JAVA_PORTS_POSSIBLE}" \
+_JAVA_PORT!=	${ECHO_CMD} "${_JAVA_PORTS_POSSIBLE:S/${_THIS_JAVA_PORT}//}" \
 				| ${AWK} '{ print $$1 }'
 .		endif
 _JAVA_PORT_INFO:=	${_JAVA_PORT:S/^/\${_/:S/$/_INFO}/}
@@ -475,6 +485,8 @@
 	@${ECHO_CMD} "_JAVA_PORTS_POSSIBLE=           ${_JAVA_PORTS_POSSIBLE}"
 	@${ECHO_CMD} "_JAVA_PORTS_INSTALLED=          ${_JAVA_PORTS_INSTALLED}"
 	@${ECHO_CMD} "_JAVA_PORTS_INSTALLED_POSSIBLE= ${_JAVA_PORTS_INSTALLED_POSSIBLE}"
+	@${ECHO_CMD} "_THIS_JAVA_PORT=                ${_THIS_JAVA_PORT}"
+	@${ECHO_CMD} "_JAVA_PORTS_POSSIBLE (-THIS)=   ${_JAVA_PORTS_POSSIBLE:S/${_THIS_JAVA_PORT}//}"
 	@${ECHO_CMD} "_JAVA_PORT=                     ${_JAVA_PORT}"
 	@${ECHO_CMD} "_JAVA_PORT_INFO=                ${_JAVA_PORT_INFO:S/\t/ /}"
 	@${ECHO_CMD}
@@ -575,7 +587,9 @@
 	@${ECHO_CMD} "${PKGNAME}: JAVA_BUILD and NO_BUILD cannot be set at the same time.";
 	@${FALSE}
 .		endif
+.		if  (${_JAVA_PORT} != "${_THIS_JAVA_PORT}")
 _DEPEND_JAVA=	${JAVA}:${PORTSDIR}/${JAVA_PORT}
+.		endif
 .		if !defined(JAVA_EXTRACT) && !defined(JAVA_BUILD) && !defined(JAVA_RUN)
 # In general, an EXTRACT_DEPENDS on java is not wanted, so only
 # automatically set up BUILD_DEPENDS and RUN_DEPENDS
--- bsd.java.mk.patch ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-java mailing list