Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 25 Feb 2002 11:18:52 +0100
From:      Ernst de Haan <ernsth@nl.euro.net>
To:        portmgr@FreeBSD.org
Cc:        ports@FreeBSD.org, java@FreeBSD.org, sobomax@FreeBSD.org, kevlo@FreeBSD.org, sebster@sebster.org
Subject:   Request for changing bsd.port.mk and adding bsd.java.mk
Message-ID:  <200202251018.g1PAIqi02136@zaphod.euronet.nl>

index | next in thread | raw e-mail

[-- Attachment #1 --]
Hi,


In order to make writing Java-based ports much easier, I've developped a 
bsd.java.mk.

Below I explain how this bsd.java.mk works. My request is threefold. First I 
would ask for permission to modify bsd.port.mk to include bsd.java.mk (see 
attached diff). Secondly, I would like to add the attached bsd.java.mk file 
as Mk/bsd.java.mk in the ports CVS module. Third, I would like to get the 
right to make updates to this latter file.

When this bsd.java.mk is added, it will have *no* effect on current ports, 
these will keep working. Note that this bsd.java.mk is specific for FreeBSD, 
I do not know if that is a problem.


This bsd.java.mk is loosely based on the following proposal:

http://www.metaverse.nl/~ernst/freebsd-java-proposal-20011116.html

It is loosely modelled after bsd.ruby.mk.

The current bsd.java.mk allows ports to use the following construction to use 
a Java runtime environment in their Makefile:

   USE_JAVA=	[ "YES" | "1.1" | "1.2" | "1.3" | "1.4" ]

If it set to "YES" then the default version of Java will be used, currently 
1.3, this can be overridden (for example in /etc/make.conf) by defining 
DEFAULT_JAVA_VER.

After setting USE_JAVA to a valid value, the port writer can use the 
following variables in the targets:

   JAVA_VENDOR: Vendor of the Java
   JAVA_VER: Java version, for example "1.1.8" or "1.3.1"
   JAVA_OS: Target OS for the JDK/JRE, "FreeBSD" or "Linux"
   JAVA_HOME: Home directory of the Java runtime environment
   JAVA_PORT: The location for the JDK/JRE port
   JAVA_CLASSES: Reference to classes.zip or rt.jar
   JAVAC: Points to a Java compiler (possibly Jikes)
   APPLETVIEWER: Appletviewer location
   JAVA: Points to JRE or JDK java executable
   JAVADOC: Points to the javadoc utility
   JAVAH: Points to the javah utility
   JAVAP: Points to the javap utility
   JAVA_N2A: Points to the native2ascii utility
   RMIC: Points to the rmic program
   RMIREGISTRY: Points to the rmiregistry program
   JAVA_SERIALVER: Points to the serialver program

And only for JDK 1.2+:

   JAVA_POLICYTOOL: Points to the policytool program
   RMID: Points to the rmid program

The correct JDK/JRE will be added to BUILD_DEPENDS unless 
JAVA_NO_BUILD_DEPENDS. It will be added to RUN_DEPENDS unless 
JAVA_NO_RUN_DEPENDS is defined.

Any and all comments are welcome, of course.


Ernst

-- 
Ernst de Haan
EuroNet Internet B.V.

    "Come to me all who are weary and burdened
        and I will give you rest" -- Jesus Christ

[-- Attachment #2 --]
Index: bsd.port.mk
===================================================================
RCS file: /home/ncvs/ports/Mk/bsd.port.mk,v
retrieving revision 1.400
diff -d -u -r1.400 bsd.port.mk
--- bsd.port.mk	24 Feb 2002 16:54:34 -0000	1.400
+++ bsd.port.mk	25 Feb 2002 09:49:27 -0000
@@ -781,6 +781,8 @@
 .include "${PORTSDIR}/Mk/bsd.ruby.mk"
 .endif
 
+.include "${PORTSDIR}/Mk/bsd.java.mk"
+
 .if defined(USE_QT) || defined(USE_QT2) || defined(USE_QT_VER) || defined(USE_KDELIBS_VER) || defined(USE_KDEBASE_VER)
 .include "${PORTSDIR}/Mk/bsd.kde.mk"
 .endif

[-- Attachment #3 --]
#-*- mode: Fundamental; tab-width: 4; -*-
# ex:ts=4
#
# bsd.java.mk - Support for Java-based ports.
#
# Created by: Ernst de Haan <znerd@FreeBSD.org>
#
# $FreeBSD$
#

.if !defined(Java_Include)

Java_Include=				bsd.java.mk
Java_Include_MAINTAINER=	znerd@FreeBSD.org

.	if defined(USE_JAVA)

# The complete list of Java versions supported.
JAVA_VERSIONS=		1.1 1.2 1.3 1.4

# The default Java version. This setting can be overridden.
DEFAULT_JAVA_VER?=	1.3

# Check that the DEFAULT_JAVA_VER setting is valid
.		for _TMP_JAVA_VER in ${JAVA_VERSIONS}
.			if ${DEFAULT_JAVA_VER} == ${_TMP_JAVA_VER}
_DEFAULT_JAVA_VER_VALID=	yes
.			endif
.		endfor
.		if !defined(_DEFAULT_JAVA_VER_VALID)
.BEGIN:
	@${ECHO} "${PKGNAME}: \"${DEFAULT_JAVA_VER}\" is not a valid value for DEFAULT_JAVA_VER. It should be one of: ${JAVA_VERSIONS}.";
	@${FALSE}
.		endif

# If USE_JAVA is not specifying a version, then use the default one.
.		if ${USE_JAVA} == "YES" || ${USE_JAVA} == "yes"
USE_JAVA=	${DEFAULT_JAVA_VER}
.		endif

# Apply different settings for different values of USE_JAVA.
.		if (${USE_JAVA} == "1.1")
JAVA_VENDOR=	FreeBSD
JAVA_VER=	1.1.8
JAVA_OS=	FreeBSD
JAVA_HOME=	${LOCALBASE}/jdk1.1.8
JAVA_PORT=	java/jdk
.		elif ${USE_JAVA} == "1.2"
JAVA_VENDOR=	FreeBSD
JAVA_VER=	1.2.2
JAVA_OS=	FreeBSD
JAVA_HOME=	${LOCALBASE}/jdk1.2.2
JAVA_PORT=	java/jdk12-beta
JAVA_CLASSES=	${JAVA_HOME}/jre/lib/rt.jar
.		elif ${USE_JAVA} == "1.3"
JAVA_VENDOR=	FreeBSD
JAVA_VER=	1.3.1
JAVA_OS=	FreeBSD
JAVA_HOME=	${LOCALBASE}/jdk1.3.1
JAVA_PORT=	java/jdk13
JAVA_CLASSES=	${JAVA_HOME}/jre/lib/rt.jar
.		elif ${USE_JAVA} == "1.4"
JAVA_VENDOR=	Sun
JAVA_VER=	1.4.0
JAVA_OS=	Linux
JAVA_HOME=	${LOCALBASE}/linux-jdk1.4.0
JAVA_PORT=	java/linux-jdk14
JAVA_CLASSES=	${JAVA_HOME}/jre/lib/rt.jar
.		else
.BEGIN:
	@${ECHO} "${PKGNAME}: \"${USE_JAVA}\" is not a valid value for USE_JAVA. It should be one of: ${JAVA_VERSIONS}.";
	@${FALSE}
.		endif

# Define the location of the Java compiler. Use Jikes if that is already
# installed, unless NO_JIKES is defined.
.		undef JAVAC
.		if !defined(NO_JIKES)
JIKES_PATH=	${LOCALBASE}/bin/jikes
.			if exists(${JIKES_PATH})
JAVAC=		${JIKES_PATH}
.			endif
.		endif
.			if !defined(JAVAC)
JAVAC=		${JAVA_HOME}/bin/javac
.		endif

# Define the location of some more executables.
APPLETVIEWER=	${JAVA_HOME}/bin/appletviewer
JAVA=		${JAVA_HOME}/bin/java
JAVADOC=	${JAVA_HOME}/bin/javadoc
JAVAH=		${JAVA_HOME}/bin/javah
JAVAP=		${JAVA_HOME}/bin/javap
JAVA_N2A=	${JAVA_HOME}/bin/native2ascii
RMIC=		${JAVA_HOME}/bin/rmic
RMIREGISTRY=	${JAVA_HOME}/bin/rmiregistry
JAVA_SERIALVER=	${JAVA_HOME}/bin/serialver

# Some executables only exists in JDK 1.2 and up
.		if ${USE_JAVA} != "1.1"
JAVA_POLICYTOOL=	${JAVA_HOME}/bin/policytool
RMID=		${JAVA_HOME}/bin/rmid
.		endif

# Set the location of the ZIP or JAR file with all standard Java classes.
.		if ${USE_JAVA} == "1.1"
JAVA_CLASSES=	${JAVA_HOME}/lib/classes.zip
.		else
JAVA_CLASSES=	${JAVA_HOME}/jre/lib/rt.jar
.		endif

# Add the Java port to the dependencies
DEPEND_JAVA=	${JAVA}:${PORTSDIR}/${JAVA_PORT}
.		if !defined(JAVA_NO_BUILD_DEPENDS)
BUILD_DEPENDS+=		${DEPEND_JAVA}
.		endif
.		if !defined(JAVA_NO_RUN_DEPENDS)
RUN_DEPENDS+=		${DEPEND_JAVA}
.		endif
.	endif
.endif
help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200202251018.g1PAIqi02136>