changeset 5887:c9568c94c4e7

7191703: jprt cannot build jdk on MacOSX. Reviewed-by: anthony
author ohair
date Fri, 21 Sep 2012 12:22:52 -0700
parents 51594d095a4b
children d94613ac03d8
files make/common/shared/Defs.gmk make/java/jobjc/Makefile
diffstat 2 files changed, 16 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/make/common/shared/Defs.gmk	Wed Sep 19 15:46:32 2012 -0700
+++ b/make/common/shared/Defs.gmk	Fri Sep 21 12:22:52 2012 -0700
@@ -609,14 +609,18 @@
 #  2) ant attempts to detect JDK location based on java.exe location
 #     This is fragile as developer may have JRE first on the PATH. 
 #     To workaround this we will specify JAVA_HOME explicitly
+#  3) Sometimes we need to run ant with the boot jdk, sometimes with the import
+#     jdk, sometimes with the jdk we are building (see deploy repo).
 
 ANT_TMPDIR = $(ABS_OUTPUTDIR)/tmp
-ANT_WORKAROUNDS = ANT_OPTS=-Djava.io.tmpdir='$(ANT_TMPDIR)' JAVA_HOME='$(BOOTDIR)'
+ANT_WORKAROUNDS = ANT_OPTS=-Djava.io.tmpdir='$(ANT_TMPDIR)'
 
 ifeq ($(ANT_HOME),)
-  ANT = $(ANT_WORKAROUNDS) ant
+  ANT = $(ANT_WORKAROUNDS) JAVA_HOME='$(BOOTDIR)' ant
+  ANT_WITH_IMPORT = $(ANT_WORKAROUNDS) JAVA_HOME='$(JDK_IMPORT_PATH)' ant
 else
-  ANT = $(ANT_WORKAROUNDS) $(ANT_HOME)/bin/ant
+  ANT = $(ANT_WORKAROUNDS) JAVA_HOME='$(BOOTDIR)' $(ANT_HOME)/bin/ant
+  ANT_WITH_IMPORT = $(ANT_WORKAROUNDS) JAVA_HOME='$(JDK_IMPORT_PATH)' $(ANT_HOME)/bin/ant
 endif
 
 ifdef ALT_COPYRIGHT_YEAR
--- a/make/java/jobjc/Makefile	Wed Sep 19 15:46:32 2012 -0700
+++ b/make/java/jobjc/Makefile	Fri Sep 21 12:22:52 2012 -0700
@@ -62,15 +62,22 @@
 ABS_OUTPUTDIR=$(realpath $(OUTPUTDIR))
 ABS_STABLE_GEN_DIR=$(realpath $(STABLE_GEN_DIR))
 
+# How to run ant
+ifdef LANGTOOLS_DIST
+  ANT_CMD = $(ANT)
+else
+  ANT_CMD = $(ANT_WITH_IMPORT)
+endif
+
 $(BUILT_DYLIB) $(BUILT_JAR): $(STABLE_METADATA_FILES) $(CORE_SRC) $(GENERATOR_SRC) $(ADDITIONS_SRC) $(BUILD_SRC)
 	@echo JObjC dylib or jar out of data wrt FRAMEWORKS '(' $(FRAMEWORKS) ')' or JObjC source '(' core, generator, additions, build ')'
 	@echo Running ant with java_home set to ${ALT_BOOTDIR}
-	(cd $(SRCDIR); OBJROOT="$(ABS_OUTPUTDIR)/JObjC.build" DSTROOT="$(ABS_OUTPUTDIR)/JObjC.dst" JAVA_HOME=${ALT_BOOTDIR} STABLE_GEN_DIR="$(ABS_STABLE_GEN_DIR)" /usr/bin/ant -verbose all)
+	(cd $(SRCDIR); OBJROOT="$(ABS_OUTPUTDIR)/JObjC.build" DSTROOT="$(ABS_OUTPUTDIR)/JObjC.dst" JAVA_HOME=${ALT_BOOTDIR} STABLE_GEN_DIR="$(ABS_STABLE_GEN_DIR)" $(ANT_CMD) -verbose all)
 
 all: $(BUILD_DYLIB) $(BUILT_JAR)
 	$(CP) $(BUILT_DYLIB) $(LIB_LOCATION)/libJObjC.dylib
 
 clean clobber::
-	(cd $(SRCDIR); export OBJROOT=$(OUTPUTDIR)/JObjC.build; export DSTROOT=$(OUTPUTDIR)/JObjC.dst; /usr/bin/ant clean)
+	(cd $(SRCDIR); export OBJROOT=$(OUTPUTDIR)/JObjC.build; export DSTROOT=$(OUTPUTDIR)/JObjC.dst; $(ANT_CMD) clean)
 
 endif