aboutsummaryrefslogtreecommitdiff
path: root/Mk
diff options
context:
space:
mode:
authorGreg Lewis <glewis@FreeBSD.org>2004-08-02 21:44:17 +0000
committerGreg Lewis <glewis@FreeBSD.org>2004-08-02 21:44:17 +0000
commite2e2d90fbed793495db30d2a397aa55b7381a081 (patch)
tree027318002fa55466458b5e47658a396ec769438a /Mk
parent795a30b529db9340a0add7e1e2cda65a512f560d (diff)
downloadports-e2e2d90fbed793495db30d2a397aa55b7381a081.tar.gz
ports-e2e2d90fbed793495db30d2a397aa55b7381a081.zip
. 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).
Notes
Notes: svn path=/head/; revision=115312
Diffstat (limited to 'Mk')
-rw-r--r--Mk/bsd.java.mk24
1 files changed, 24 insertions, 0 deletions
diff --git a/Mk/bsd.java.mk b/Mk/bsd.java.mk
index 44eb1c3a718c..dffdd4a27156 100644
--- a/Mk/bsd.java.mk
+++ b/Mk/bsd.java.mk
@@ -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