2009-06-15 00:57:58 +02:00
|
|
|
# $NetBSD: java-env.mk,v 1.12 2009/06/14 22:58:05 joerg Exp $
|
2004-05-22 23:13:17 +02:00
|
|
|
#
|
|
|
|
# This Makefile fragment handles Java wrappers and is meant to be included
|
|
|
|
# by packages that provide a Java build-time and/or run-time environment.
|
|
|
|
#
|
|
|
|
# The following variables can be defined in package Makefiles to tune the
|
|
|
|
# behavior of this file:
|
|
|
|
#
|
|
|
|
# JAVA_CLASSPATH Classpath that will be prepended on all invocations
|
|
|
|
# to this implementation. Optional.
|
|
|
|
#
|
2007-02-18 17:25:54 +01:00
|
|
|
# JAVA_LD_LIBRARY_PATH
|
|
|
|
# Value to prepend to LD_LIBRARY_PATH before running
|
|
|
|
# the real command. Optional; use *only* if necessary.
|
|
|
|
#
|
2004-05-22 23:13:17 +02:00
|
|
|
# JAVA_HOME Path to the directory holding the Java implementation.
|
|
|
|
# Required.
|
|
|
|
#
|
|
|
|
# JAVA_NAME Base name of the Java implementation. This will be
|
|
|
|
# used as part of wrappers' names. Required.
|
|
|
|
#
|
|
|
|
# JAVA_UNLIMIT List of resources to be unlimited at runtime.
|
|
|
|
# Can include any of cmdsize, datasize and stacksize.
|
|
|
|
# Optional.
|
|
|
|
#
|
|
|
|
# JAVA_WRAPPERS List of wrappers to be created under ${PREFIX}/bin,
|
|
|
|
# pointing to binaries under ${JAVA_HOME}/bin. The
|
|
|
|
# names must match files in the later directory.
|
|
|
|
# Required (if empty, the inclusion of this file is
|
|
|
|
# useless).
|
|
|
|
#
|
|
|
|
|
|
|
|
.if !defined(JAVA_ENV_MK)
|
|
|
|
JAVA_ENV_MK= # defined
|
|
|
|
|
|
|
|
JAVA_NAME?= # undefined
|
|
|
|
JAVA_HOME?= # undefined
|
|
|
|
JAVA_CLASSPATH?= # empty
|
2007-02-18 17:25:54 +01:00
|
|
|
JAVA_LD_LIBRARY_PATH?= # empty
|
2004-05-22 23:13:17 +02:00
|
|
|
JAVA_UNLIMIT?= # empty
|
|
|
|
JAVA_WRAPPERS?= # empty
|
|
|
|
|
2006-05-16 23:25:38 +02:00
|
|
|
.include "../../mk/bsd.prefs.mk"
|
|
|
|
|
2004-05-23 12:29:43 +02:00
|
|
|
.if !empty(JAVA_WRAPPERS)
|
|
|
|
INSTALLATION_DIRS+= bin
|
|
|
|
|
2005-01-31 00:18:37 +01:00
|
|
|
ALTERNATIVES_SRC= ${WRKDIR}/.ALTERNATIVES
|
|
|
|
${WRKDIR}/.ALTERNATIVES:
|
2005-03-19 17:46:45 +01:00
|
|
|
. for w in ${JAVA_WRAPPERS}
|
2005-01-31 00:18:37 +01:00
|
|
|
@${ECHO} 'bin/${w} ${PREFIX}/bin/${JAVA_NAME}-${w}' \
|
|
|
|
>>${WRKDIR}/.ALTERNATIVES
|
2005-03-19 17:46:45 +01:00
|
|
|
. endfor
|
2005-01-31 00:18:37 +01:00
|
|
|
|
2005-03-19 17:46:45 +01:00
|
|
|
. for w in ${JAVA_WRAPPERS}
|
2004-05-22 23:13:17 +02:00
|
|
|
|
2004-05-23 12:19:28 +02:00
|
|
|
JAVA_WRAPPER_BIN.${w}?= ${JAVA_HOME}/bin/${w}
|
|
|
|
|
2004-05-22 23:13:17 +02:00
|
|
|
post-build: ${WRKDIR}/${w}
|
|
|
|
|
|
|
|
.PHONY: install-java-wrapper-${w}
|
|
|
|
post-install: install-java-wrapper-${w}
|
|
|
|
|
2005-03-19 17:46:45 +01:00
|
|
|
. if !target(${WRKDIR}/${w})
|
2004-05-22 23:13:17 +02:00
|
|
|
${WRKDIR}/${w}:
|
|
|
|
@${ECHO} 'Generating ${w} wrapper...'
|
|
|
|
@${ECHO} '#! ${SH}' >${WRKDIR}/${w}
|
|
|
|
@${ECHO} 'PATH=${JAVA_HOME}/bin:$${PATH}; export PATH' >>${WRKDIR}/${w}
|
|
|
|
@${ECHO} 'JAVA_HOME=${JAVA_HOME}; export JAVA_HOME' >>${WRKDIR}/${w}
|
|
|
|
@${ECHO} 'JVM_HOME=${JAVA_HOME}; export JVM_HOME' >>${WRKDIR}/${w}
|
2005-03-19 17:46:45 +01:00
|
|
|
. if !empty(JAVA_CLASSPATH)
|
2004-05-22 23:13:17 +02:00
|
|
|
@${ECHO} 'CLASSPATH=${JAVA_CLASSPATH}:$${CLASSPATH}; export CLASSPATH' \
|
|
|
|
>>${WRKDIR}/${w}
|
2005-03-19 17:46:45 +01:00
|
|
|
. endif
|
2007-02-18 17:25:54 +01:00
|
|
|
. if !empty(JAVA_LD_LIBRARY_PATH)
|
|
|
|
@${ECHO} 'LD_LIBRARY_PATH=${JAVA_LD_LIBRARY_PATH}$${LD_LIBRARY_PATH:+:}$${LD_LIBRARY_PATH}; export LD_LIBRARY_PATH' \
|
|
|
|
>>${WRKDIR}/${w}
|
|
|
|
. endif
|
2005-03-19 17:46:45 +01:00
|
|
|
. for f in ${JAVA_UNLIMIT}
|
2004-05-22 23:13:17 +02:00
|
|
|
@${ECHO} '${ULIMIT_CMD_${f}}' >>${WRKDIR}/${w}
|
2005-03-19 17:46:45 +01:00
|
|
|
. endfor
|
|
|
|
. undef f
|
2004-05-23 12:19:28 +02:00
|
|
|
@${ECHO} '${JAVA_WRAPPER_BIN.${w}} "$$@"' >>${WRKDIR}/${w}
|
2005-03-19 17:46:45 +01:00
|
|
|
. endif
|
2004-05-22 23:13:17 +02:00
|
|
|
|
|
|
|
install-java-wrapper-${w}:
|
2007-11-09 01:49:54 +01:00
|
|
|
${INSTALL_SCRIPT} ${WRKDIR}/${w} ${DESTDIR}${PREFIX}/bin/${JAVA_NAME}-${w}
|
2004-05-22 23:13:17 +02:00
|
|
|
|
2005-03-19 17:46:45 +01:00
|
|
|
. endfor
|
|
|
|
. undef w
|
|
|
|
.endif
|
2004-05-22 23:13:17 +02:00
|
|
|
|
|
|
|
# Handle the ${PREFIX}/java shared directory automatically.
|
2005-08-20 21:16:21 +02:00
|
|
|
REQD_DIRS+= ${PREFIX}/java
|
2004-05-22 23:13:17 +02:00
|
|
|
|
2007-08-02 20:04:48 +02:00
|
|
|
PLIST_SUBST+= JAVA_HOME=${JAVA_HOME:Q}
|
|
|
|
FILES_SUBST+= JAVA_HOME=${JAVA_HOME:Q}
|
|
|
|
|
2004-05-22 23:13:17 +02:00
|
|
|
.endif # JAVA_ENV_MK
|