Date: Tue, 26 Feb 2002 09:44:17 +0100 From: Ernst de Haan <znerd@FreeBSD.org> To: java@FreeBSD.org, ports@FreeBSD.org Cc: sobomax@FreeBSD.org, kevlo@FreeBSD.org, sebster@sebster.org Subject: New version of bsd.java.mk Message-ID: <200202260844.g1Q8iHu11156@zaphod.euronet.nl>
index | next in thread | raw e-mail
[-- Attachment #1 --]
Here's a new proposed version of bsd.java.mk.
I am not going to submit this one to portmgr, because I don't want to bother
portmgr with all new versions I have. Major changes:
* Added a lot of documentation in the file itself
* Added JAVA_KEYTOOL
* Added support for FastJAR, added support for USE_FASTJAR
* Now using USE_JIKES instead of NO_JIKES
* Recognizes already installed Linux JDKs
Any and all comments are -as usual- more than welcome.
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 --]
#-*- 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$
#
#-----------------------------------------------------------------------------
# Information for system administrators:
#
#
# You can override the default Java version by setting DEFAULT_JAVA_VER in
# your /etc/make.conf to one of the allowed values. These are currently:
# 1.1, 1.2, 1.3 and 1.4. Do not quote this value.
# If you set this value in /etc/make.conf, and the port set USE_JAVA to YES,
# then the port actually does not care what JDK is used. In this case your
# setting from /etc/make.conf will be used.
#
# When installing a port, you can override the default version as well, by
# specifying it on the command line, for example:
#
# % make DEFAULT_JAVA_VER=1.3 install
#
# If you installed Jikes (from java/jikes) or FastJAR (from
# archivers/fastjar), then these will by default be used instead of javac and
# jar, respectively. If you don't want this, set USE_JIKES or USE_FASTJAR to
# NO, respectively. Again you can do this in your /etc/make.conf or on the
# command line. For example:
#
# % make USE_JIKES=YES USE_FASTJAR=NO install
#
# On the other hand, if you would *like* your port to use Jikes or FastJAR,
# then set USE_JIKES or USE_FASTJAR to YES, respectively.
#
# Summarizing, here is a list of all settings you may set in /etc/make.conf or
# on the command line when installing a specific port:
#
# DEFAULT_JAVA_VER The default Java version to use. The fallback default
# value is set in this bsd.java.mk file, and it is bound
# to become higher in the future. A port should never
# override this setting.
# Possible values: 1.1, 1.2, 1.3 or 1.4
#
# USE_JIKES If Jikes should be used by default, or if it should
# definitely not be used. A port can override this
# setting.
# Possible values: YES or NO.
#
# USE_FASTJAR If FastJAR should be used by default, or if it should
# definitely not be used. A port can override this
# setting.
# Possible values: YES or NO.
#
#-----------------------------------------------------------------------------
# Information for port authors:
#
#
# You can specify what version of the JDK your port needs, you can specify if
# you want to use Jikes and/or FastJAR or not, and you can specify if you
# don't want the JDK to be a dependency (either in BUILD_DEPENDS or in
# RUN_DEPENDS.)
#
# The least you have to do in order to make use of the support this
# bsd.java.mk file offers, is setting USE_JAVA to YES. If you just need a JDK,
# and you don't care which one, then this is the way to go. In the Makefile
# targets for your port you will receive a whole bunch of variables you can
# use at will. These are listed further below. For example:
#
# PORTNAME= bsdjavamktest
# PORTVERSION= 1.0
# CATEGORIES= java
# MASTER_SITES= # ???
# DISTFILES= # ???
#
# MAINTAINER= znerd@FreeBSD.org
#
# USE_JAVA= YES
#
# If you need a specific JDK, then set USE_JAVA to either 1.1, 1.2, 1.3 or
# 1.4. For example:
#
# PORTNAME= bsdjavamktest
# PORTVERSION= 1.0
# CATEGORIES= java
# MASTER_SITES= # ???
# DISTFILES= # ???
#
# MAINTAINER= znerd@FreeBSD.org
#
# USE_JAVA= 1.2
#
# Now your port will get a Java 1.2.x JDK as a dependency. Not a lower version
# (1.1) and not a higher version (1.3 or 1.4). It will get variables that
# point to specific resources, see the list further below.
#
# You can optionally specify whether you would like your port to use Jikes or
# not, by setting NO_JIKES to either YES or NO, respectively. By default, your
# port will get a pointer to Jikes as the Java compiler to use only if it is
# already installed. If you have a problem with that, then set USE_JIKES to
# NO. If you definitely want you port to use Jikes, even if it is not yet
# installed, then set USE_JIKES to YES.
#
# You can also optionally specify whether you would like your port to use
# FastJAR or not, by setting NO_FASTJAR to either YES or NO, respectively. By
# default, your port will get a pointer to FastJAR as the JAR tool to use
# only if it is already installed. If you have a problem with that, then set
# USE_FASTJAR to NO. If you definitely want your port to use FastJAR, even if
# it is not yet installed, then set USE_FASTJAR to YES.
#
# By default, the selected JDK will be added to both the build-time
# dependencies (BUILD_DEPENDS) and to the run-time dependencies for your port
# (RUN_DEPENDS). If you would like to disable either one, then define either
# JAVA_NO_BUILD_DEPENDS or JAVA_NO_RUN_DEPENDS, respectively. You should not
# define both.
#
# Summarizing, here is a list of all settings you may set in the Makefile for
# your port:
#
# USE_JAVA The Java version to use, or YES for any version. The
# fallback default value is set in this bsd.java.mk
# file, and it is bound to become higher in the future.
# A port should never override this setting. This
# variable is mandatory for Java support.
# Possible values are: YES, 1.1, 1.2, 1.3 or 1.4
#
# USE_JIKES If Jikes should be used, or if it should definitely
# not be used. This variable is optional.
# Possible values: YES or NO.
#
# USE_FASTJAR If FastJAR should be used, or if it should definitely
# not be used. This variable is optional.
# Possible values: YES or NO.
#
# JAVA_NO_BUILD_DEPENDS
# Set this variable (to any value) if the JDK should not
# be added as a build-time dependency for your port.
# Setting this variable excludes setting
# JAVA_NO_RUN_DEPENDS. These 2 variables cannot both be
# defined.
#
# JAVA_NO_RUN_DEPENDS Set this variable (to any value) if the JDK should not
# be added as a run-time dependency for your port.
# Setting this variable excludes setting
# JAVA_NO_BUILD_DEPENDS. These 2 variables cannot both
# be defined.
#
# The following variables will be set for use in your targets:
#
# JAVA_VENDOR The vendor of the JDK.
# Example values: FreeBSD, Blackdown, Sun and IBM.
#
# JAVA_VER The Java version used. It is set to the major, medior
# and minor version number of the JDK, separated by
# dots.
# Example values: 1.1.8, 1.2.2, 1.3.1 and 1.4.0.
#
# JAVA_OS The operating system for which the port is targeted.
# Example values: FreeBSD and Linux.
#
# JAVA_HOME Path to the installation directory of the JDK. For
# example: /usr/local/jdk1.3.1.
#
# JAVA_PORT The port that installs the JDK this port uses. For
# example java/jdk, java/jdk12-beta or java/linux-jdk.
#
# JAVAC Path to the Java compiler to use, for example
# /usr/local/jdk1.1.8/bin/javac or /usr/local/bin/jikes.
#
# JAR Path to the JAR tool to use, for example
# /usr/local/jdk1.2.2/bin/jar or /usr/local/bin/fastjar.
#
# APPLETVIEWER Path to the appletviewer utility.
#
# JAVA Path to the java executable. Use this for executing
# Java programs.
#
# JAVADOC Path to the JavaDoc utility program.
#
# JAVAH Path to the javah tool.
#
# JAVAP Path to the javap tool.
#
# JAVA_KEYTOOL Path to the keytool program. This variable is only set
# if the JDK is Java 1.2 or higher.
#
# JAVA_N2A Path to the native2ascii tool.
#
# JAVA_POLICYTOOL Path to the policytool program. This variable is only
# set if the JDK is Java 1.2 or higher.
#
# JAVA_SERIALVER Path to the serialver tool.
#
# RMIC Path to the RMI stub/skeleton generator.
#
# RMIREGISTRY Path the RMI registry program.
#
# RMID Path to the RMI daemon program. This variable is only
# set if the JDK is Java 1.2 or higher.
#
# JAVA_CLASSES Path to the archive that contains the JDK class files.
# On JDK 1.2 or later, this is
# ${JAVA_HOME}/jre/lib/rt.jar. Earlier JDK's use
# ${JAVA_HOME/lib/classes.zip.
#
.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.2
# Set the JAVA_HOME directories for all recognized JDKs
_JAVA_HOME_FREEBSD_1_1= ${LOCALBASE}/jdk1.1.8
_JAVA_HOME_FREEBSD_1_2= ${LOCALBASE}/jdk1.2.2
_JAVA_HOME_FREEBSD_1_3= ${LOCALBASE}/jdk1.3.1
_JAVA_HOME_BLACKDOWN_LINUX_1_2= ${LOCALBASE}/linux-jdk1.2.2
_JAVA_HOME_IBM_LINUX_1_3= ${LOCALBASE}/linux-ibm-jdk1.3.0
_JAVA_HOME_SUN_LINUX_1_3= ${LOCALBASE}/linux-jdk1.3.1
_JAVA_HOME_SUN_LINUX_1_4= ${LOCALBASE}/linux-jdk1.4.0
# 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 the port needs Java 1.1, then there's only one choice, the JDK 1.1.8 for
# FreeBSD.
. if (${USE_JAVA} == "1.1")
JAVA_VENDOR= FreeBSD
JAVA_VER= 1.1.8
JAVA_OS= FreeBSD
JAVA_HOME= ${_JAVA_HOME_FREEBSD_1_1}
JAVA_PORT= java/jdk
# If the port needs Java 1.3, then there are 2 choices. They are, in order or
# preference:
#
# (1) JDK 1.2.2 for FreeBSD
# (2) Blackdown JDK 1.2.2 for Linux
#
# If the Blackdown JDK 1.2.2 is installed, but the FreeBSD JDK 1.2.2 is *not*
# installed, then the Blackdown JDK will be used as the dependency. Otherwise
# the FreeBSD JDK 1.2.2 will be used as the dependency.
. elif ${USE_JAVA} == "1.2"
. if exists(${_JAVA_HOME_BLACKDOWN_LINUX_1_2}/bin/javac) \
&& !exists(${_JAVA_HOME_FREEBSD_1_2}/bin/javac)
JAVA_VENDOR= Blackdown
JAVA_VER= 1.2.2
JAVA_OS= Linux
JAVA_HOME= ${_JAVA_HOME_BLACKDOWN_LINUX_1_2}
JAVA_PORT= java/linux-jdk12
. else
JAVA_VENDOR= FreeBSD
JAVA_VER= 1.2.2
JAVA_OS= FreeBSD
JAVA_HOME= ${_JAVA_HOME_FREEBSD_1_2}
JAVA_PORT= java/jdk12-beta
. endif
# If the port needs Java 1.3, then there are 3 choices. They are, in order or
# preference:
#
# (1) JDK 1.3.1 for FreeBSD
# (2) Sun JDK 1.3.1 for Linux
# (3) IBM JDK 1.3.1 for Linux
#
# If the FreeBSD JDK 1.3.1 is installed or if none of the 1.3.1 JDKs is
# installed, then the FreeBSD JDK 1.3.1 is used as a dependency for the port.
#
# Otherwise, if the Sun JDK 1.3.1 is already installed, then that will be
# used. If it is not installed, but the IBM JDK 1.3.1 is installed, then that
# one will be used.
. elif ${USE_JAVA} == "1.3"
. if exists(${_JAVA_HOME_IBM_LINUX_1_3}/bin/javac) \
&& !exists(${_JAVA_HOME_SUN_LINUX_1_3}/bin/java) \
&& !exists(${_JAVA_HOME_FREEBSD_1_3}/bin/javac)
JAVA_VENDOR= IBM
JAVA_VER= 1.3.1
JAVA_OS= Linux
JAVA_HOME= ${_JAVA_HOME_IBM_LINUX_1_3}
JAVA_PORT= java/linux-ibm-jdk13
. elif exists(${_JAVA_HOME_SUN_LINUX_1_3}/bin/javac) \
&& !exists(${_JAVA_HOME_FREEBSD_1_3}/bin/javac)
JAVA_VENDOR= Sun
JAVA_VER= 1.3.1
JAVA_OS= Linux
JAVA_HOME= ${_JAVA_HOME_SUN_LINUX_1_3}
JAVA_PORT= java/linux-jdk13
. else
JAVA_VENDOR= FreeBSD
JAVA_VER= 1.3.1
JAVA_OS= FreeBSD
JAVA_HOME= ${_JAVA_HOME_FREEBSD_1_3}
JAVA_PORT= java/jdk13
. endif
# If the port needs JDK 1.4, then there's currently only one choice, the Sun
# JDK 1.4.0 for Linux.
. elif ${USE_JAVA} == "1.4"
JAVA_VENDOR= Sun
JAVA_VER= 1.4.0
JAVA_OS= Linux
JAVA_HOME= ${_JAVA_HOME_SUN_LINUX_1_4}
JAVA_PORT= java/linux-jdk14
. else
.BEGIN:
@${ECHO} "${PKGNAME}: \"${USE_JAVA}\" is not a valid value for USE_JAVA. It should be one of: ${JAVA_VERSIONS} or YES.";
@${FALSE}
. endif
# Define the location of the Java compiler. If USE_JIKES is set to YES, then
# use Jikes. If USE_JIKES is set to NO, then don't use it. If it is set to a
# different value, then fail with an error message. Otherwise USE_JIKES is not
# set, in which case it is checked if Jikes is already installed. If it is,
# then it will be used, otherwise it will not be used.
. undef JAVAC
_JIKES_PATH= ${LOCALBASE}/bin/jikes
. if defined(USE_JIKES)
. if (${USE_JIKES} == "YES") || (${USE_JIKES} == "yes")
JAVAC=${_JIKES_PATH}
. elif !((${USE_JIKES} == "NO") || (${USE_JIKES} == "no"))
.BEGIN:
@${ECHO} "${PKGNAME}: \"${USE_JIKES}\" is not a valid value for USE_JIKES. It should be YES or NO, or it should be undefined.";
@${FALSE}
. endif
. elif exists(${_JIKES_PATH})
JAVAC= ${_JIKES_PATH}
. endif
. if !defined(JAVAC)
JAVAC= ${JAVA_HOME}/bin/javac
. endif
# Define the location of the JAR tool. If USE_FASTJAR is set to YES, then
# use FastJAR. If USE_FASTJAR is set to NO, then don't use it. If it is set to
# a different value, then fail with an error message. Otherwise USE_FASTJAR is
# not set, in which case it is checked if FastJAR is already installed. If it
# is, then it will be used, otherwise it will not be used.
. undef JAR
_FASTJAR_PATH= ${LOCALBASE}/bin/fastjar
. if defined(USE_FASTJAR)
. if (${USE_FASTJAR} == "YES") || (${USE_FASTJAR} == "yes")
JAR=${_FASTJAR_PATH}
. elif !((${USE_FASTJAR} == "NO") || (${USE_FASTJAR} == "no"))
.BEGIN:
@${ECHO} "${PKGNAME}: \"${USE_FASTJAR}\" is not a valid value for USE_FASTJAR. It should be YES or NO, or it should be undefined.";
@${FALSE}
. endif
. elif exists(${_FASTJAR_PATH})
JAVAC= ${_FASTJAR_PATH}
. endif
. if !defined(JAR)
JAR= ${JAVA_HOME}/bin/jar
. 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
JAVA_SERIALVER= ${JAVA_HOME}/bin/serialver
RMIC= ${JAVA_HOME}/bin/rmic
RMIREGISTRY= ${JAVA_HOME}/bin/rmiregistry
# Some executables only exists in JDK 1.2 and up
. if ${USE_JAVA} != "1.1"
JAVA_KEYTOOL= ${JAVA_HOME}/bin/keytool
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
.if defined(JAVA_NO_BUILD_DEPENDS) && defined(JAVA_NO_RUN_DEPENDS)
.BEGIN:
@${ECHO} "${PKGNAME}: JAVA_NO_BUILD_DEPENDS and JAVA_NO_RUN_DEPENDS cannot be set at the same time.";
@${FALSE}
.endif
_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
home |
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200202260844.g1Q8iHu11156>
