. Add a USE_ANT variable with that provides a simple way to build a

Java-based port with ant, using MAKE_ENV, MAKE_ARGS and ALL_TARGET but
  using ant instead of make.  When a port is built this way it also
  causes ant to respect the JDK selected by bsd.java.mk rather than
  using the JDK that ant was build with.

  Most ports should just be able to do

  USE_ANT=	yes

  You may also need to set ALL_TARGET if your port doesn't use the
  default ant target.

  See the comments on USE_ANT at the head of bsd.java.mk for more
  information.

PR:		59997
Reviewed by:	hq (who spotted a bug and provided the comments
                    documenting USE_ANT).
This commit is contained in:
Greg Lewis 2004-08-02 21:44:17 +00:00
parent 795a30b529
commit e2e2d90fbe
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=115312

View file

@ -41,6 +41,13 @@ Java_Include_MAINTAINER= znerd@FreeBSD.org
#
# USE_JIKES Whether the port should or should not use jikes(1) to build.
#
# USE_ANT Should be defined when the port uses Apache Ant. Ant is thus
# considered to be the sub-make command. When no 'do-build'
# target is defined by the port, a default one will be set
# that simply runs Ant according to MAKE_ENV, MAKE_ARGS and
# ALL_TARGETS. Read the documentation in bsd.port.mk for more
# information.
#
#-------------------------------------------------------------------------------
# Variables defined for the port:
#
@ -381,6 +388,11 @@ JAVA_PORT_OS_DESCRIPTION:= ${JAVA_PORT_OS:S/^/\${_JAVA_OS_/:S/$/}/}
# Stage 6: Add any dependencies if necessary
#
# Ant Support: USE_ANT --> JAVA_BUILD=jdk
. if defined(USE_ANT)
JAVA_BUILD= jdk
. endif
# Add the JDK port to the dependencies
DEPEND_JAVA= ${JAVA}:${PORTSDIR}/${JAVA_PORT}
# When nothing is set, assume JAVA_BUILD=jdk and JAVA_RUN=jre
@ -406,6 +418,18 @@ BUILD_DEPENDS+= ${DEPEND_JAVA}
RUN_DEPENDS+= ${DEPEND_JAVA}
. endif
# Ant support: default do-build target
. if defined(USE_ANT)
ANT?= ${LOCALBASE}/bin/ant
MAKE_ENV+= JAVA_HOME=${JAVA_HOME}
BUILD_DEPENDS+= ${ANT}:${PORTSDIR}/devel/apache-ant
ALL_TARGET?=
. if !target(do-build)
do-build:
@(cd ${BUILD_WRKSRC}; \
${SETENV} ${MAKE_ENV} ${ANT} ${MAKE_ARGS} ${ALL_TARGET})
. endif
. endif
#-----------------------------------------------------------------------------
# Stage 7: Define all settings for the port to use