ports/86902: [patch] Align devel/apache-ant invocation to the java/javavmwrapper way
"Panagiotis Astithas" <Panagiotis Astithas
past at ebs.gr
Tue Oct 4 21:40:15 UTC 2005
>Number: 86902
>Category: ports
>Synopsis: [patch] Align devel/apache-ant invocation to the java/javavmwrapper way
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Tue Oct 04 21:40:13 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator: Panagiotis Astithas
>Release: FreeBSD 6.0-BETA5 i386
>Organization:
EBS Ltd.
>Environment:
System: FreeBSD 6.0-BETA5 #7: Mon Oct 3 22:00:16 EEST 2005
past at ajax.ebs.gr:/usr/obj/usr/src/sys/GENERIC
>Description:
The ant startup script that launches ant has a hardcoded default
JAVA_HOME directory to that of ${JAVA_HOME}. This can be overridden
by the user's setting of JAVA_HOME. However, this is not the
recommended way to override the default jdk. Both javavmwrapper
(a dependency of the jdk ports) and bsd.java.mk recommend the use of
variables like JAVA_VERSION, JAVA_PREFERRED_PORTS, etc.
One known case where the current script fails to override the default
jdk, is when one has both jdk14 and jdk15 and tries to select jdk15
using JAVA_PREFERRED_PORTS. The attached patch (similar to the one
in PR ports/86860) makes the default JAVA_HOME directory correspond
to javavmwrapper's symlinks, in /usr/local/bin.
>How-To-Repeat:
Install java/jdk14, java/jdk15 and apache-ant.
Set JAVA_PREFERRED_PORTS to JAVA_PORT_NATIVE_BSDJAVA_JDK_1_5.
Try to use ant to build a project that contains Java 1.5 constructs.
Observe the compiler errors that prove jdk14 was used.
>Fix:
--- ant.patch begins here ---
diff -ruN /usr/ports/devel/apache-ant/files/ant apache-ant/files/ant
--- /usr/ports/devel/apache-ant/files/ant Sat Apr 3 14:30:54 2004
+++ apache-ant/files/ant Wed Oct 5 00:19:49 2005
@@ -11,8 +11,8 @@
#
-DEFAULT_JAVACMD=%%JAVA%%
-DEFAULT_JAVA_HOME=%%JAVA_HOME%%
+DEFAULT_JAVACMD=java
+DEFAULT_JAVA_HOME=%%PREFIX%%
DEFAULT_JIKES=false
ANT_HOME=%%ANT_HOME%%
@@ -38,6 +38,11 @@
# Set ANT_LIB location
ANT_LIB="${ANT_HOME}/lib"
+
+# Determine the JDK home directory
+if [ -z "${JAVA_HOME}" ]; then
+ JAVA_HOME=${DEFAULT_JAVA_HOME}
+fi
# Determine 'java' executable
if [ -z "${JAVACMD}" ]; then
--- ant.patch ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list