2002-03-28 11:24:43 +00:00
#-*- mode: Fundamental; tab-width: 4; -*-
# ex:ts=4
#
# bsd.java.mk - Support for Java-based ports.
#
# Created by: Ernst de Haan <znerd@FreeBSD.org>
#
# For FreeBSD committers:
# Please send all suggested changes to the maintainer instead of committing
# them to CVS yourself.
#
# $FreeBSD$
#
. i f ! d e f i n e d ( J a v a _ I n c l u d e )
Java_Include = bsd.java.mk
Java_Include_MAINTAINER = znerd@FreeBSD.org
2004-04-16 14:53:22 +00:00
#-------------------------------------------------------------------------------
2004-04-05 21:40:04 +00:00
# Variables that each port can define:
#
# USE_JAVA Should be defined to the remaining variables to have any
# effect
#
# JAVA_VERSION List of space-separated suitable java versions for the
# port. An optional "+" allows you to specify a range of
# versions. (allowed values: 1.1[+] 1.2[+] 1.3[+] 1.4[+])
#
# JAVA_OS List of space-separated suitable JDK port operating systems
# for the port. (allowed values: native linux)
#
# JAVA_VENDOR List of space-separated suitable JDK port vendors for the
# port. (allowed values: freebsd bsdjava sun ibm blackdown)
#
# JAVA_BUILD When set, it means that the selected JDK port should be
# added to build dependencies for the port.
#
# JAVA_RUN This variable works exactly the same as JAVA_BUILD but
# regarding run dependencies.
#
# USE_JIKES Whether the port should or should not use jikes(1) to build.
#
2004-04-16 14:53:22 +00:00
#-------------------------------------------------------------------------------
2004-04-05 21:40:04 +00:00
# Variables defined for the port:
#
# JAVA_PORT The name of the JDK port. (e.g. 'java/jdk14')
#
# JAVA_PORT_VERSION The version of the JDK port. (e.g. '1.4')
#
# JAVA_PORT_OS The operating system used by the JDK port. (e.g. 'linux')
#
# JAVA_PORT_VENDOR The vendor of the JDK port. (e.g. 'sun')
#
# JAVA_PORT_OS_DESCRIPTION Description of the operating system used by the
# JDK port. (e.g. 'Linux')
#
# JAVA_PORT_VENDOR_DESCRIPTION Description of the vendor of the JDK port.
# (e.g. 'FreeBSD Foundation')
#
# JAVA_HOME Path to the installation directory of the JDK. (e.g.
# '/usr/local/jdk1.3.1')
#
# JAVAC Path to the Java compiler to use. (e.g.
# '/usr/local/jdk1.1.8/bin/javac' or '/usr/local/bin/jikes')
#
# JAR Path to the JAR tool to use. (e.g.
# '/usr/local/jdk1.2.2/bin/jar' or '/usr/local/bin/fastjar')
#
# APPLETVIEWER Path to the appletviewer utility. (e.g.
# '/usr/local/linux-jdk1.2.2/bin/appletviewer')
#
# JAVA Path to the java executable. Use this for executing Java
# programs. (e.g. '/usr/local/jdk1.3.1/bin/java')
#
# JAVADOC Path to the javadoc utility program.
#
# JAVAH Path to the javah program.
#
# JAVAP Path to the javap program.
#
# JAVA_KEYTOOL Path to the keytool utility program. This settings is
# availble only 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 available
# only if the JDK is Java 1.2 or higher.
#
# JAVA_SERIALVER Path to the serialver utility program.
#
# RMIC Path to the RMI stub/skeleton generator, rmic.
#
# RMIREGISTRY Path to the RMI registry program, rmiregistry.
#
# RMID Path to the RMI daemon program. This settings is only
# available 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.
#
2004-04-16 14:53:22 +00:00
#-------------------------------------------------------------------------------
# Porter's hints
#
# To retrieve the Major version number from JAVA_PORT_VERSION (e.g. "1.3"):
# -> ${JAVA_PORT_VERSION:C/^([0-9])\.([0-9])(.*)$/\1.\2/}
2002-04-04 23:01:24 +00:00
#
2004-04-16 14:53:22 +00:00
#-------------------------------------------------------------------------------
2002-04-04 23:01:24 +00:00
# There are the following stages:
#
# Stage 1: Define constants
2004-04-16 14:53:22 +00:00
# Stage 2: bsd.java.mk 1.0 backward compatibility
# Stage 3: Determine which JDK ports are installed and which JDK ports are
# suitable
# Stage 4: <REMOVED> (merged in stage 3)
2004-04-03 03:37:05 +00:00
# Stage 5: Decide the exact JDK to use (or install)
2002-06-18 13:14:30 +00:00
# Stage 6: Define all settings for the port to use
# Stage 7: Add any dependencies if necessary
2002-04-04 23:01:24 +00:00
#
2002-03-28 11:24:43 +00:00
. i f d e f i n e d ( U S E _ J A V A )
2004-04-16 14:53:22 +00:00
#-------------------------------------------------------------------------------
2002-03-28 11:24:43 +00:00
# Stage 1: Define constants
#
2002-11-18 13:00:00 +00:00
# System-global directories
JAVASHAREDIR ?= ${ PREFIX } /share/java
JAVAJARDIR ?= ${ JAVASHAREDIR } /classes
2004-04-03 03:37:05 +00:00
# The complete list of Java versions, os and vendors supported.
2004-04-16 14:53:22 +00:00
__JAVA_VERSION_LIST = 1.1 1.2 1.3 1.4
_JAVA_VERSION_LIST = ${ __JAVA_VERSION_LIST } ${ __JAVA_VERSION_LIST : S / $/+/ }
_JAVA_OS_LIST = native linux
_JAVA_VENDOR_LIST = freebsd bsdjava sun blackdown ibm
2004-04-03 03:37:05 +00:00
# Set all meta-information about JDK ports:
# port location, corresponding JAVA_HOME, JDK version, OS, vendor
2004-04-16 14:53:22 +00:00
_JAVA_PORT_NATIVE_FREEBSD_JDK_1_3_INFO = PORT = java/diablo-jdk13 HOME = ${ LOCALBASE } /diablo-jdk1.3.1 \
VERSION = 1.3.1 OS = native VENDOR = freebsd
_JAVA_PORT_NATIVE_BSDJAVA_JDK_1_1_INFO = PORT = java/jdk11 HOME = ${ LOCALBASE } /jdk1.1.8 \
VERSION = 1.1.8 OS = native VENDOR = bsdjava
_JAVA_PORT_NATIVE_BSDJAVA_JDK_1_2_INFO = PORT = java/jdk12 HOME = ${ LOCALBASE } /jdk1.2.2 \
VERSION = 1.2.2 OS = native VENDOR = bsdjava
_JAVA_PORT_NATIVE_BSDJAVA_JDK_1_3_INFO = PORT = java/jdk13 HOME = ${ LOCALBASE } /jdk1.3.1 \
VERSION = 1.3.1 OS = native VENDOR = bsdjava
_JAVA_PORT_NATIVE_BSDJAVA_JDK_1_4_INFO = PORT = java/jdk14 HOME = ${ LOCALBASE } /jdk1.4.2 \
VERSION = 1.4.2 OS = native VENDOR = bsdjava
_JAVA_PORT_LINUX_BLACKDOWN_JDK_1_2_INFO = PORT = java/linux-blackdown-jdk12 HOME = ${ LOCALBASE } /linux-blackdown-jdk1.2.2 \
VERSION = 1.2.2 OS = linux VENDOR = blackdown
_JAVA_PORT_LINUX_BLACKDOWN_JDK_1_3_INFO = PORT = java/linux-blackdown-jdk13 HOME = ${ LOCALBASE } /linux-blackdown-jdk1.3.1 \
VERSION = 1.3.1 OS = linux VENDOR = blackdown
_JAVA_PORT_LINUX_BLACKDOWN_JDK_1_4_INFO = PORT = java/linux-blackdown-jdk14 HOME = ${ LOCALBASE } /linux-blackdown-jdk1.4.2 \
VERSION = 1.4.2 OS = linux VENDOR = blackdown
_JAVA_PORT_LINUX_IBM_JDK_1_3_INFO = PORT = java/linux-ibm-jdk13 HOME = ${ LOCALBASE } /linux-ibm-jdk1.3.1 \
VERSION = 1.3.1 OS = linux VENDOR = ibm
_JAVA_PORT_LINUX_IBM_JDK_1_4_INFO = PORT = java/linux-ibm-jdk14 HOME = ${ LOCALBASE } /linux-ibm-jdk1.4.1 \
VERSION = 1.4.1 OS = linux VENDOR = ibm
_JAVA_PORT_LINUX_SUN_JDK_1_2_INFO = PORT = java/linux-sun-jdk12 HOME = ${ LOCALBASE } /linux-sun-jdk1.2.2 \
VERSION = 1.2.2 OS = linux VENDOR = sun
_JAVA_PORT_LINUX_SUN_JDK_1_3_INFO = PORT = java/linux-sun-jdk13 HOME = ${ LOCALBASE } /linux-sun-jdk1.3.1 \
VERSION = 1.3.1 OS = linux VENDOR = sun
_JAVA_PORT_LINUX_SUN_JDK_1_4_INFO = PORT = java/linux-sun-jdk14 HOME = ${ LOCALBASE } /linux-sun-jdk1.4.2 \
VERSION = 1.4.2 OS = linux VENDOR = sun
# Verbose description for each VENDOR
2004-04-03 03:37:05 +00:00
_JAVA_VENDOR_freebsd = "FreeBSD Foundation"
2004-04-05 06:50:07 +00:00
_JAVA_VENDOR_bsdjava = "BSD Java Porting Team"
2004-04-03 03:37:05 +00:00
_JAVA_VENDOR_blackdown = Blackdown
_JAVA_VENDOR_ibm = IBM
_JAVA_VENDOR_sun = Sun
2004-04-16 14:53:22 +00:00
# Verbose description for each OS
2004-04-03 03:37:05 +00:00
_JAVA_OS_native = Native
_JAVA_OS_linux = Linux
2002-03-28 11:24:43 +00:00
2004-04-16 14:53:22 +00:00
# Enforce preferred Java ports according to OS
2004-04-19 16:56:04 +00:00
. i f $ { O S V E R S I O N } > = 5 0 0 0 0 0
2004-04-16 14:53:22 +00:00
_JAVA_PREFERRED_PORTS += JAVA_PORT_NATIVE_BSDJAVA_JDK_1_4
2004-04-19 16:56:04 +00:00
. e l i f $ { O S V E R S I O N } > = 4 0 0 0 0 0
2004-04-16 14:53:22 +00:00
_JAVA_PREFERRED_PORTS += JAVA_PORT_NATIVE_FREEBSD_JDK_1_3
. e l s e
_JAVA_PREFERRED_PORTS += JAVA_PORT_NATIVE_BSDJAVA_JDK_1_1
. e n d i f
# List all JDK ports
__JAVA_PORTS_ALL = JAVA_PORT_NATIVE_BSDJAVA_JDK_1_4 \
JAVA_PORT_NATIVE_BSDJAVA_JDK_1_3 \
JAVA_PORT_NATIVE_FREEBSD_JDK_1_3 \
JAVA_PORT_NATIVE_BSDJAVA_JDK_1_2 \
JAVA_PORT_NATIVE_BSDJAVA_JDK_1_1 \
JAVA_PORT_LINUX_SUN_JDK_1_4 \
JAVA_PORT_LINUX_SUN_JDK_1_3 \
JAVA_PORT_LINUX_SUN_JDK_1_2 \
JAVA_PORT_LINUX_BLACKDOWN_JDK_1_4 \
JAVA_PORT_LINUX_BLACKDOWN_JDK_1_3 \
JAVA_PORT_LINUX_BLACKDOWN_JDK_1_2 \
JAVA_PORT_LINUX_IBM_JDK_1_4 \
JAVA_PORT_LINUX_IBM_JDK_1_3
_JAVA_PORTS_ALL = ${ JAVA_PREFERRED_PORTS } \
${ _JAVA_PREFERRED_PORTS } \
${ __JAVA_PORTS_ALL }
2002-03-28 11:24:43 +00:00
# Set the name of the file that indicates that a JDK is indeed installed, as a
# relative path within the JAVA_HOME directory.
2002-04-04 23:01:24 +00:00
_JDK_FILE = bin/javac
2002-03-28 11:24:43 +00:00
# Set the path to Jikes and define the Jikes dependency
_JIKES_PATH = ${ LOCALBASE } /bin/jikes
2004-04-16 14:53:22 +00:00
DEPEND_JIKES = ${ _JIKES_PATH } :${ PORTSDIR } /java/jikes
2002-05-02 12:46:56 +00:00
2004-04-03 03:37:05 +00:00
2004-04-16 14:53:22 +00:00
#-------------------------------------------------------------------------------
# Stage 2: bsd.java.mk 1.0 backward compatibility
2002-03-28 11:24:43 +00:00
#
2004-04-03 03:37:05 +00:00
# First detect if we are using bsd.java.mk v1.0
2004-04-16 14:53:22 +00:00
_USE_BSD_JAVA_MK_1_0 != ${ ECHO_CMD } " ${ _JAVA_VERSION_LIST } " \
2004-04-05 21:24:25 +00:00
| ${ TR } " " "\n" \
| ${ GREP } -q " ^ ${ USE_JAVA } $$ " && ${ ECHO_CMD } "yes" || ${ ECHO_CMD } "no"
2004-04-16 14:53:22 +00:00
. i f (${_USE_BSD_JAVA_MK_1_0} = = "yes" )
2004-04-03 03:37:05 +00:00
# Then affect the variables so that we may use v2.0
2004-04-16 14:53:22 +00:00
# USE_JAVA --> JAVA_VERSION
. i f ! d e f i n e d ( J A V A _ V E R S I O N )
2004-04-03 03:37:05 +00:00
JAVA_VERSION = ${ USE_JAVA }
2004-04-16 14:53:22 +00:00
. e l s e
.BEGIN :
@${ ECHO_CMD } " ${ PKGNAME } : The port is using bsd.java.mk 1.0 but sets a value for JAVA_VERSION. This may cause problems. "
@${ FALSE }
2004-04-03 03:37:05 +00:00
. e n d i f
2004-04-16 14:53:22 +00:00
# NO_{BUILD|RUN}_DEPENDS_JAVA --> JAVA_{BUILD|RUN}
. i f d e f i n e d ( N O _ B U I L D _ D E P E N D S _ J A V A ) & & d e f i n e d ( N O _ R U N _ D E P E N D S _ J A V A )
.BEGIN :
@${ ECHO_CMD } " ${ PKGNAME } : NO_BUILD_DEPENDS_JAVA and NO_RUN_DEPENDS_JAVA cannot be set at the same time. " ;
@${ FALSE }
. e l s e
. i f ! d e f i n e d ( N O _ B U I L D _ D E P E N D S _ J A V A ) & & ! d e f i n e d ( N O _ B U I L D )
JAVA_BUILD = jdk
. e n d i f
. i f ! d e f i n e d ( N O _ R U N _ D E P E N D S _ J A V A )
JAVA_RUN = jdk
. e n d i f
2004-04-03 03:37:05 +00:00
. e n d i f
2004-04-16 14:53:22 +00:00
# NEED_JAVAC --> JAVA_{BUILD|RUN}={jdk|jre}
. i f d e f i n e d ( N E E D _ J A V A C )
. i f (${NEED_JAVAC} = = "YES" ) || ( ${ NEED_JAVAC } = = "yes" )
JAVA_BUILD = jdk
. e l i f (${NEED_JAVAC} = = "NO" ) || ( ${ NEED_JAVAC } = = "no" )
JAVA_BUILD = jre
. e l s e
2004-04-03 03:37:05 +00:00
.BEGIN :
2004-04-16 14:53:22 +00:00
@${ ECHO_CMD } " ${ PKGNAME } : \" ${ NEED_JAVAC } \" is not a valid value for NEED_JAVAC. It should be YES or NO, or it should be undefined. " ;
2004-04-03 03:37:05 +00:00
@${ FALSE }
2004-04-16 14:53:22 +00:00
. e n d i f
2004-04-03 03:37:05 +00:00
. e n d i f
2002-03-28 11:24:43 +00:00
. e n d i f
2004-04-16 14:53:22 +00:00
#-------------------------------------------------------------------------------
# Stage 3: Determine which JDK ports are suitable and which JDK ports are
# suitable
#
# From here, the port is using bsd.java.mk v2.0
# Error checking: JAVA_VERSION
_JAVA_VERSION_LIST_REGEXP != ${ ECHO_CMD } " ${ _JAVA_VERSION_LIST } " | ${ SED } "s/ /\\\|/g"
_ERROR_CHECKING_JAVA_VERSION != ${ ECHO_CMD } " ${ JAVA_VERSION } " | ${ TR } " " "\n" \
| ${ GREP } -v " ${ _JAVA_VERSION_LIST_REGEXP } " || true
. i f (${_ERROR_CHECKING_JAVA_VERSION} != "" )
2004-04-03 03:37:05 +00:00
.BEGIN :
2004-04-16 14:53:22 +00:00
@${ ECHO_CMD } " ${ PKGNAME } : \" ${ JAVA_VERSION } \" is not a valid value for JAVA_VERSION. It should be one or more of: ${ __JAVA_VERSION_LIST } (with an optional \"+\" suffix.) " ;
2004-04-03 03:37:05 +00:00
@${ FALSE }
. e n d i f
2004-04-16 14:53:22 +00:00
# Error checking: JAVA_VENDOR
_JAVA_VENDOR_LIST_REGEXP != ${ ECHO_CMD } " ${ _JAVA_VENDOR_LIST } " | ${ SED } "s/ /\\\|/g"
_ERROR_CHECKING_JAVA_VENDOR != ${ ECHO_CMD } " ${ JAVA_VENDOR } " | ${ TR } " " "\n" \
| ${ GREP } -v " ${ _JAVA_VENDOR_LIST_REGEXP } " || true
. i f (${_ERROR_CHECKING_JAVA_VENDOR} != "" )
2004-04-03 03:37:05 +00:00
.BEGIN :
2004-04-16 14:53:22 +00:00
@${ ECHO_CMD } " ${ PKGNAME } : \" ${ JAVA_VENDOR } \" is not a valid value for JAVA_VENDOR. It should be one or more of: ${ _JAVA_VENDOR_LIST } " ;
2002-03-28 11:24:43 +00:00
@${ FALSE }
. e n d i f
2004-04-16 14:53:22 +00:00
# Error checking: JAVA_OS
_JAVA_OS_LIST_REGEXP != ${ ECHO_CMD } " ${ _JAVA_OS_LIST } " | ${ SED } "s/ /\\\|/g"
_ERROR_CHECKING_JAVA_OS != ${ ECHO_CMD } " ${ JAVA_OS } " | ${ TR } " " "\n" \
| ${ GREP } -v " ${ _JAVA_OS_LIST_REGEXP } " || true
. i f (${_ERROR_CHECKING_JAVA_OS} != "" )
.BEGIN :
@${ ECHO_CMD } " ${ PKGNAME } : \" ${ JAVA_OS } \" is not a valid value for JAVA_OS. It should be one or more of: ${ _JAVA_OS_LIST } " ;
@${ FALSE }
. e n d i f
2004-04-03 03:37:05 +00:00
2004-04-16 14:53:22 +00:00
# JDK dependency setting
. u n d e f _ J A V A _ P O R T S _ I N S T A L L E D
. u n d e f _ J A V A _ P O R T S _ P O S S I B L E
. i f d e f i n e d ( J A V A _ V E R S I O N )
_JAVA_VERSION = ${ JAVA_VERSION : S /1.1+/1.1 1.2 1.3 1.4/ : S /1.2+/1.2 1.3 1.4/ : S /1.3+/1.3 1.4/ : S /1.4+/1.4/ }
. e l s e
_JAVA_VERSION = ${ __JAVA_VERSION_LIST }
. e n d i f
. i f d e f i n e d ( J A V A _ O S )
_JAVA_OS = ${ JAVA_OS }
. e l s e
_JAVA_OS = ${ _JAVA_OS_LIST }
. e n d i f
. i f d e f i n e d ( J A V A _ V E N D O R )
_JAVA_VENDOR = ${ JAVA_VENDOR }
. e l s e
_JAVA_VENDOR = ${ _JAVA_VENDOR_LIST }
. e n d i f
2004-04-03 03:37:05 +00:00
2004-04-16 14:53:22 +00:00
. f o r A _ J A V A _ P O R T i n $ { _ J A V A _ P O R T S _ A L L }
A_JAVA_PORT_INFO := ${ A_JAVA_PORT : S /^/ \$ {_/ : S / $/_INFO } /}
A_JAVA_PORT_HOME = ${ A_JAVA_PORT_INFO : MHOME =* : S ,HOME=,, }
A_JAVA_PORT_VERSION = ${ A_JAVA_PORT_INFO : MVERSION =* : C /VERSION=([0-9]) \. ([0-9])(.*)/ \1 . \2 / }
A_JAVA_PORT_OS = ${ A_JAVA_PORT_INFO : MOS =* : S ,OS=,, }
A_JAVA_PORT_VENDOR = ${ A_JAVA_PORT_INFO : MVENDOR =* : S ,VENDOR=,, }
A_JAVA_PORT_INSTALLED != ${ TEST } -x " ${ A_JAVA_PORT_HOME } / ${ _JDK_FILE } " \
&& ${ ECHO_CMD } " ${ A_JAVA_PORT } " \
|| ${ TRUE }
__JAVA_PORTS_INSTALLED != ${ ECHO_CMD } " ${ __JAVA_PORTS_INSTALLED } ${ A_JAVA_PORT_INSTALLED } "
A_JAVA_PORT_POSSIBLE != ${ ECHO_CMD } " ${ _JAVA_VERSION } " | ${ GREP } -q " ${ A_JAVA_PORT_VERSION } " \
&& ${ ECHO_CMD } " ${ _JAVA_OS } " | ${ GREP } -q " ${ A_JAVA_PORT_OS } " \
&& ${ ECHO_CMD } " ${ _JAVA_VENDOR } " | ${ GREP } -q " ${ A_JAVA_PORT_VENDOR } " \
&& ${ ECHO_CMD } " ${ A_JAVA_PORT } " \
|| ${ TRUE }
__JAVA_PORTS_POSSIBLE != ${ ECHO_CMD } " ${ __JAVA_PORTS_POSSIBLE } ${ A_JAVA_PORT_POSSIBLE } "
. e n d f o r
_JAVA_PORTS_INSTALLED = ${ __JAVA_PORTS_INSTALLED : C / [ ]+/ /g }
_JAVA_PORTS_POSSIBLE = ${ __JAVA_PORTS_POSSIBLE : C / [ ]+/ /g }
#-------------------------------------------------------------------------------
2004-04-03 03:37:05 +00:00
# Stage 5: Decide the exact JDK to use (or install)
#
# Find an installed JDK port that matches the requirements of the port
2004-04-16 14:53:22 +00:00
. u n d e f _ J A V A _ P O R T S _ I N S T A L L E D _ P O S S I B L E
. f o r A _ J A V A _ P O R T i n $ { _ J A V A _ P O R T S _ P O S S I B L E }
A_JAVA_PORT_INSTALLED_POSSIBLE != ${ ECHO_CMD } " ${ _JAVA_PORTS_INSTALLED } " | ${ GREP } -q " ${ A_JAVA_PORT } " \
&& ${ ECHO_CMD } " ${ A_JAVA_PORT } " || ${ TRUE }
__JAVA_PORTS_INSTALLED_POSSIBLE != ${ ECHO_CMD } " ${ __JAVA_PORTS_INSTALLED_POSSIBLE } ${ A_JAVA_PORT_INSTALLED_POSSIBLE } "
. e n d f o r
_JAVA_PORTS_INSTALLED_POSSIBLE = ${ __JAVA_PORTS_INSTALLED_POSSIBLE : C / [ ]+/ /g }
2004-04-03 03:37:05 +00:00
. i f ${_JAVA_PORTS_INSTALLED_POSSIBLE} != ""
2004-04-05 21:24:25 +00:00
_JAVA_PORT != ${ ECHO_CMD } " ${ _JAVA_PORTS_INSTALLED_POSSIBLE } " \
| ${ AWK } '{ print $$1 }'
2004-04-03 03:37:05 +00:00
# If no installed JDK port fits, then pick one from the list of possible ones
. e l s e
2004-04-05 21:24:25 +00:00
_JAVA_PORT != ${ ECHO_CMD } " ${ _JAVA_PORTS_POSSIBLE } " \
| ${ AWK } '{ print $$1 }'
2004-04-03 03:37:05 +00:00
. e n d i f
2004-04-16 14:53:22 +00:00
_JAVA_PORT_INFO := ${ _JAVA_PORT : S /^/ \$ {_/ : S / $/_INFO } /}
JAVA_PORT = ${ _JAVA_PORT_INFO : MPORT =* : S ,PORT=,, }
JAVA_HOME = ${ _JAVA_PORT_INFO : MHOME =* : S ,HOME=,, }
JAVA_PORT_VERSION = ${ _JAVA_PORT_INFO : MVERSION =* : S ,VERSION=,, }
JAVA_PORT_OS = ${ _JAVA_PORT_INFO : MOS =* : S ,OS=,, }
JAVA_PORT_VENDOR = ${ _JAVA_PORT_INFO : MVENDOR =* : S ,VENDOR=,, }
2004-04-03 03:37:05 +00:00
JAVA_PORT_VENDOR_DESCRIPTION := ${ JAVA_PORT_VENDOR : S /^/ \$ {_JAVA_VENDOR_/ : S / $/ } /}
JAVA_PORT_OS_DESCRIPTION := ${ JAVA_PORT_OS : S /^/ \$ {_JAVA_OS_/ : S / $/ } /}
2002-03-28 11:24:43 +00:00
#-----------------------------------------------------------------------------
2002-06-18 13:14:30 +00:00
# Stage 6: Define all settings for the port to use
2004-04-16 14:53:22 +00:00
#
2002-04-26 22:30:47 +00:00
# At this stage both JAVA_HOME and JAVA_PORT are definitely given a value.
2004-04-16 14:53:22 +00:00
#
2002-03-28 11:24:43 +00:00
# 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.
2002-04-26 22:30:47 +00:00
2004-04-16 14:53:22 +00:00
# Only define JAVAC if a JDK is needed or USE_JIKES=yes
2002-03-28 11:24:43 +00:00
. u n d e f J A V A C
2002-04-26 22:30:47 +00:00
2004-04-16 14:53:22 +00:00
# First test if jikes is needed (and if USE_JIKES has a correct value)
. i f d e f i n e d ( U S E _ J I K E S )
. i f (${USE_JIKES} = = "YES" ) || ( ${ USE_JIKES } = = "yes" )
2002-03-28 11:24:43 +00:00
JAVAC = ${ _JIKES_PATH }
2004-04-16 14:53:22 +00:00
BUILD_DEPENDS += ${ DEPEND_JIKES }
. e l i f ! ((${USE_JIKES} = = "NO" ) || ( ${ USE_JIKES } = = "no" ) )
2004-04-03 03:37:05 +00:00
.BEGIN :
2004-04-05 21:24:25 +00:00
@${ ECHO_CMD } " ${ PKGNAME } : \" ${ USE_JIKES } \" is not a valid value for USE_JIKES. It should be YES or NO, or it should be undefined. " ;
2002-03-28 11:24:43 +00:00
@${ FALSE }
2002-04-26 22:30:47 +00:00
. e n d i f
2004-04-16 14:53:22 +00:00
. e n d i f
# Then test if a JAVAC has to be set (JAVA_BUILD==jdk)
. i f d e f i n e d ( J A V A _ B U I L D )
. i f (${JAVA_BUILD} = = "jdk" || ${ JAVA_BUILD } = = "JDK" ) && !defined( JAVAC)
# Use jikes if available and not explicitly forbidden
. i f e x i s t s ( $ { _ J I K E S _ P A T H } ) & & ! d e f i n e d ( U S E _ J I K E S )
JAVAC = ${ _JIKES_PATH }
BUILD_DEPENDS += ${ DEPEND_JIKES }
# Otherwise use 'javac'
. e l s e
JAVAC = ${ JAVA_HOME } /bin/javac
. e n d i f
2002-04-26 22:30:47 +00:00
. e n d i f
2002-03-28 11:24:43 +00:00
. e n d i f
# Define the location of some more executables.
APPLETVIEWER = ${ JAVA_HOME } /bin/appletviewer
JAR = ${ JAVA_HOME } /bin/jar
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
2004-04-16 14:53:22 +00:00
. i f ${_JAVA_PORT} != "JAVA_PORT_NATIVE_BSDJAVA_JDK_1_1"
2002-03-28 11:24:43 +00:00
JAVA_KEYTOOL = ${ JAVA_HOME } /bin/keytool
JAVA_POLICYTOOL = ${ JAVA_HOME } /bin/policytool
RMID = ${ JAVA_HOME } /bin/rmid
. e n d i f
# Set the location of the ZIP or JAR file with all standard Java classes.
2004-04-16 14:53:22 +00:00
. i f ${_JAVA_PORT} = = "JAVA_PORT_NATIVE_BSDJAVA_JDK_1_1"
2002-03-28 11:24:43 +00:00
JAVA_CLASSES = ${ JAVA_HOME } /lib/classes.zip
. e l s e
JAVA_CLASSES = ${ JAVA_HOME } /jre/lib/rt.jar
. e n d i f
2002-04-04 23:01:24 +00:00
2004-04-16 14:53:22 +00:00
#-------------------------------------------------------------------------------
2002-06-18 13:14:30 +00:00
# Stage 7: Add any dependencies if necessary
2004-04-16 14:53:22 +00:00
#
2002-04-04 23:01:24 +00:00
# Add the JDK port to the dependencies
2004-04-16 14:53:22 +00:00
DEPEND_JAVA = ${ JAVA } :${ PORTSDIR } /${ JAVA_PORT }
# When nothing is set, assume JAVA_BUILD=jdk and JAVA_RUN=jre
# (unless NO_BUILD is set)
. i f ! d e f i n e d ( J A V A _ E X T R A C T ) & & ! d e f i n e d ( J A V A _ B U I L D ) & & ! d e f i n e d ( J A V A _ R U N )
. i f ! d e f i n e d ( N O _ B U I L D )
JAVA_BUILD = jdk
. e n d i f
JAVA_RUN = jre
2004-04-03 03:37:05 +00:00
. e n d i f
2004-04-16 14:53:22 +00:00
. i f d e f i n e d ( J A V A _ E X T R A C T )
EXTRACT_DEPENDS += ${ DEPEND_JAVA }
. e n d i f
. i f d e f i n e d ( J A V A _ B U I L D )
. i f d e f i n e d ( N O _ B U I L D )
2004-04-03 03:37:05 +00:00
.BEGIN :
2004-04-05 21:24:25 +00:00
@${ ECHO_CMD } " ${ PKGNAME } : JAVA_BUILD and NO_BUILD cannot be set at the same time. " ;
2002-03-28 11:24:43 +00:00
@${ FALSE }
2004-04-16 14:53:22 +00:00
. e n d i f
BUILD_DEPENDS += ${ DEPEND_JAVA }
2004-04-03 03:37:05 +00:00
. e n d i f
2004-04-16 14:53:22 +00:00
. i f d e f i n e d ( J A V A _ R U N )
RUN_DEPENDS += ${ DEPEND_JAVA }
2002-03-28 11:24:43 +00:00
. e n d i f
2004-04-16 14:53:22 +00:00
#-------------------------------------------------------------------------------
# Additional Java support
# Debug target
# Use it to check Java dependency while porting
java-debug :
@${ ECHO_CMD } " _USE_BSD_JAVA_MK_1_0= ${ _USE_BSD_JAVA_MK_1_0 } "
@${ ECHO_CMD }
@${ ECHO_CMD } "# User specified parameters:"
@${ ECHO_CMD } " JAVA_VERSION= ${ JAVA_VERSION } ( ${ _JAVA_VERSION } ) "
@${ ECHO_CMD } " JAVA_OS= ${ JAVA_OS } ( ${ _JAVA_OS } ) "
@${ ECHO_CMD } " JAVA_VENDOR= ${ JAVA_VENDOR } ( ${ _JAVA_VENDOR } ) "
@${ ECHO_CMD } " JAVA_BUILD= ${ JAVA_BUILD } "
@${ ECHO_CMD } " JAVA_RUN= ${ JAVA_RUN } "
@${ ECHO_CMD } " JAVA_EXTRACT= ${ JAVA_EXTRACT } "
@${ ECHO_CMD }
@${ ECHO_CMD } "# JDK port dependency selection process:"
@${ 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 } " _JAVA_PORT= ${ _JAVA_PORT } "
@${ ECHO_CMD } " _JAVA_PORT_INFO= ${ _JAVA_PORT_INFO : S / \t / / } "
@${ ECHO_CMD }
@${ ECHO_CMD } "# Selected JDK port:"
@${ ECHO_CMD } " JAVA_PORT= ${ JAVA_PORT } "
@${ ECHO_CMD } " JAVA_HOME= ${ JAVA_HOME } "
@${ ECHO_CMD } " JAVA_PORT_VERSION= ${ JAVA_PORT_VERSION } "
@${ ECHO_CMD } " JAVA_PORT_OS= ${ JAVA_PORT_OS } ( ${ JAVA_PORT_OS_DESCRIPTION } ) "
@${ ECHO_CMD } " JAVA_PORT_VENDOR= ${ JAVA_PORT_VENDOR } ( ${ JAVA_PORT_VENDOR_DESCRIPTION } ) "
@${ ECHO_CMD }
@${ ECHO_CMD } "# Additional variables:"
@${ ECHO_CMD } " JAVAC= ${ JAVAC } "
@${ ECHO_CMD } " JAVA_CLASSES= ${ JAVA_CLASSES } "
2002-03-28 11:24:43 +00:00
. e n d i f
. e n d i f