On 12/14/11 19:34, Matthias Kilian wrote: > If jdk-1.7 is already installed when apache-ant gets installed, > javaPathHelper -c apache-ant will use jdk-1.7, which is quite > confusing. For example, naddy reported a problem with postgresql-jdbc > which failed to build because the JDBC interfaces got some new > declarations since jdk-1.7. Yet, postgresql-jdbc ports-wise build > depends on jdk-1.6. > > The diff below passes JAVA_HOME via MAKE_ENV whenever MODJAVA_BUILD=ant > is set. > > It would be nice if someone could test this in a bulk build before > I commit it. > > comments? > > Ciao, > Kili > > Index: java.port.mk > =================================================================== > RCS file: /cvs/ports/devel/jdk/java.port.mk,v > retrieving revision 1.29 > diff -u -p -r1.29 java.port.mk > --- java.port.mk 7 Oct 2011 13:54:31 -0000 1.29 > +++ java.port.mk 14 Dec 2011 19:16:59 -0000 > @@ -93,6 +93,7 @@ CATEGORIES+= java > # respectively. > .if defined(MODJAVA_BUILD) && ${MODJAVA_BUILD:L} == "ant" > BUILD_DEPENDS += devel/apache-ant > + MAKE_ENV += JAVA_HOME=${JAVA_HOME} > MODJAVA_BUILD_TARGET ?= > MODJAVA_BUILD_FILE ?= build.xml > MODJAVA_BUILD_DIR ?= ${WRKSRC} > > Hi,
Hit this issue before in java/jna see below, the line added to java/jna is the same your adding. jna could have it's MAKE_ENV line removed, as now it's in java.port.mk. Nigel ..... Hi, On 09/10/11 14:24, Nigel Taylor wrote: > Hi, > > jna only builds some of the time. Narrowed this down. > > jna will only builds if jdk-1.5.0 hasn't been installed. Wrongly setting > the path to 1.5.0 javac during the build, which can't build for a 1.6 > target. From build log > > -dynamic-properties: > [echo] Java version 1.5.0_16-p9, compatibility: 1.4 > [echo] JNA version 3.2.7, native 3.2.2 > [echo] Java HotSpot(TM) 64-Bit Server VM (Sun Microsystems Inc., > 1.5.0_16-p9-ntayl01_10_sep_2011_02_43) > [echo] java.home=/usr/local/jdk-1.5.0/jre > [echo] > java.library.path=/usr/local/jdk-1.5.0/jre/lib/amd64/server:/usr/local/jdk-1.5.0/jre/lib/amd64:/usr/local/jdk-1.5.0/jre/../lib/amd64:/usr/lib:/usr/X11R6/lib:/usr/local/lib > ...... > -do-compile: > [javac] Compiling 16 source files to > /usr/ports/pobj/jna-3.2.7/twall-jna-d928d42/jnalib/contrib/ntservice/build/classes > [javac] javac: invalid target release: 1.6 > [javac] Usage: javac <options> <source files> > [javac] where possible options include: > > > >From a build that worked ... > > -dynamic-properties: > [echo] Java version 1.6.0_03-p4, compatibility: 1.4 > [echo] JNA version 3.2.7, native 3.2.2 > [echo] Java HotSpot(TM) 64-Bit Server VM (Sun Microsystems Inc., > 1.6.0_03-p4-ntayl01_10_sep_2011_03_59-b00) > [echo] java.home=/usr/local/jdk-1.6.0/jre > [echo] > java.library.path=/usr/local/jdk-1.6.0/jre/lib/amd64/server:/usr/local/jdk-1.6.0/jre/lib/amd64:/usr/local/jdk-1.6.0/jre/../lib/amd64:/usr/java/packages/lib/amd64:/usr/lib:/ > usr/X11R6/lib:/usr/local/lib > > > Nigel Hi, The JAVA_HOME for ant build.xml, is set by default to apache-ant's JAVA_HOME, which can be any one of jdk-1.5.0, jdk-1.6.0, jdk-1.7.0. To get the correct JAVA_HOME, MAKE_ENV can be set, devel/jdk/java.port.mk uses MAKE_ENV when running ant. Builds ok on amd64/i386 with jdk 1.5.0 installed. Nigel Index: Makefile =================================================================== RCS file: /home/cvs/ports/java/jna/Makefile,v retrieving revision 1.6 diff -u -p -r1.6 Makefile --- Makefile 12 Sep 2011 12:50:24 -0000 1.6 +++ Makefile 12 Sep 2011 14:30:38 -0000 @@ -25,6 +25,7 @@ MODULES= java MODJAVA_VER= 1.6+ MODJAVA_BUILD= ant MODJAVA_BUILD_DIR=${WRKSRC}/jnalib/ +MAKE_ENV += JAVA_HOME=${JAVA_HOME} # jnalib/build.xml specifically wants gmake (and ggrep) USE_GMAKE= Yes