8006676: Integrate Nashorn into new build system
authorjlaskey
Mon, 28 Jan 2013 16:29:34 -0400
changeset 21148 56d120d0c2b7
parent 15173 b4b4893c6b4d
child 21149 4427343751c8
8006676: Integrate Nashorn into new build system Reviewed-by: jlaskey Contributed-by: james.laskey@oracle.com
common/autoconf/generated-configure.sh
common/autoconf/source-dirs.m4
common/autoconf/spec.gmk.in
common/bin/compare.sh
common/makefiles/Main.gmk
common/makefiles/MakeBase.gmk
make/nashorn-rules.gmk
make/scripts/hgforest.sh
--- a/common/autoconf/generated-configure.sh	Tue Jan 22 21:02:06 2013 -0800
+++ b/common/autoconf/generated-configure.sh	Mon Jan 28 16:29:34 2013 -0400
@@ -738,6 +738,7 @@
 OVERRIDE_SRC_ROOT
 ADD_SRC_ROOT
 JDK_TOPDIR
+NASHORN_TOPDIR
 HOTSPOT_TOPDIR
 JAXWS_TOPDIR
 JAXP_TOPDIR
@@ -15627,6 +15628,7 @@
 JAXP_TOPDIR="$SRC_ROOT/jaxp"
 JAXWS_TOPDIR="$SRC_ROOT/jaxws"
 HOTSPOT_TOPDIR="$SRC_ROOT/hotspot"
+NASHORN_TOPDIR="$SRC_ROOT/nashorn"
 JDK_TOPDIR="$SRC_ROOT/jdk"
 
 
@@ -15637,6 +15639,7 @@
 
 
 
+
 ###############################################################################
 #
 # Pickup additional source for a component from outside of the source root
@@ -15867,6 +15870,19 @@
     { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes with $HOTSPOT_TOPDIR" >&5
 $as_echo "yes with $HOTSPOT_TOPDIR" >&6; }
 fi
+if test "x$with_override_nashorn" != x; then
+    CURDIR="$PWD"
+    cd "$with_override_nashorn"
+    NASHORN_TOPDIR="`pwd`"
+    cd "$CURDIR"
+    if ! test -f $NASHORN_TOPDIR/makefiles/BuildNashorn.gmk; then
+        as_fn_error $? "You have to override nashorn with a full nashorn repo!" "$LINENO" 5
+    fi
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking if nashorn should be overridden" >&5
+$as_echo_n "checking if nashorn should be overridden... " >&6; }
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes with $NASHORN_TOPDIR" >&5
+$as_echo "yes with $NASHORN_TOPDIR" >&6; }
+fi
 if test "x$with_override_jdk" != x; then
     CURDIR="$PWD"
     cd "$with_override_jdk"
--- a/common/autoconf/source-dirs.m4	Tue Jan 22 21:02:06 2013 -0800
+++ b/common/autoconf/source-dirs.m4	Mon Jan 28 16:29:34 2013 -0400
@@ -33,12 +33,14 @@
 JAXP_TOPDIR="$SRC_ROOT/jaxp"
 JAXWS_TOPDIR="$SRC_ROOT/jaxws"
 HOTSPOT_TOPDIR="$SRC_ROOT/hotspot"
+NASHORN_TOPDIR="$SRC_ROOT/nashorn"
 JDK_TOPDIR="$SRC_ROOT/jdk"
 AC_SUBST(LANGTOOLS_TOPDIR)
 AC_SUBST(CORBA_TOPDIR)
 AC_SUBST(JAXP_TOPDIR)
 AC_SUBST(JAXWS_TOPDIR)
 AC_SUBST(HOTSPOT_TOPDIR)
+AC_SUBST(NASHORN_TOPDIR)
 AC_SUBST(JDK_TOPDIR)
 ])
 
@@ -233,7 +235,18 @@
     fi
     AC_MSG_CHECKING([if hotspot should be overridden])
     AC_MSG_RESULT([yes with $HOTSPOT_TOPDIR])
-fi    
+fi
+if test "x$with_override_nashorn" != x; then
+    CURDIR="$PWD"
+    cd "$with_override_nashorn"
+    NASHORN_TOPDIR="`pwd`"
+    cd "$CURDIR"
+    if ! test -f $NASHORN_TOPDIR/makefiles/BuildNashorn.gmk; then
+        AC_MSG_ERROR([You have to override nashorn with a full nashorn repo!])
+    fi
+    AC_MSG_CHECKING([if nashorn should be overridden])
+    AC_MSG_RESULT([yes with $NASHORN_TOPDIR])
+fi
 if test "x$with_override_jdk" != x; then
     CURDIR="$PWD"
     cd "$with_override_jdk"
--- a/common/autoconf/spec.gmk.in	Tue Jan 22 21:02:06 2013 -0800
+++ b/common/autoconf/spec.gmk.in	Mon Jan 28 16:29:34 2013 -0400
@@ -141,6 +141,7 @@
 JAXP_TOPDIR:=@JAXP_TOPDIR@
 JAXWS_TOPDIR:=@JAXWS_TOPDIR@
 HOTSPOT_TOPDIR:=@HOTSPOT_TOPDIR@
+NASHORN_TOPDIR:=@NASHORN_TOPDIR@
 COPYRIGHT_YEAR:=@COPYRIGHT_YEAR@
 
 # Location where build customization files may be found
@@ -230,6 +231,7 @@
 JAXWS_OUTPUTDIR=$(BUILD_OUTPUT)/jaxws
 HOTSPOT_OUTPUTDIR=$(BUILD_OUTPUT)/hotspot
 JDK_OUTPUTDIR=$(BUILD_OUTPUT)/jdk
+NASHORN_OUTPUTDIR=$(BUILD_OUTPUT)/nashorn
 IMAGES_OUTPUTDIR=$(BUILD_OUTPUT)/images
 JCE_OUTPUTDIR=$(BUILD_OUTPUT)/jce-release
 
@@ -238,6 +240,7 @@
 JAXP_DIST=$(JAXP_OUTPUTDIR)/dist
 JAXWS_DIST=$(JAXWS_OUTPUTDIR)/dist
 HOTSPOT_DIST=@HOTSPOT_DIST@
+NASHORN_DIST=$(NASHORN_OUTPUTDIR)/dist
 
 BUILD_HOTSPOT=@BUILD_HOTSPOT@
 
--- a/common/bin/compare.sh	Tue Jan 22 21:02:06 2013 -0800
+++ b/common/bin/compare.sh	Mon Jan 28 16:29:34 2013 -0400
@@ -350,9 +350,15 @@
     OTHER_DIR=$2
     WORK_DIR=$3
     ZIP_FILE=$4
+    # Optionally provide different name for other zipfile
+    OTHER_ZIP_FILE=$5
 
     THIS_ZIP=$THIS_DIR/$ZIP_FILE
-    OTHER_ZIP=$OTHER_DIR/$ZIP_FILE
+    if [ -n "$OTHER_ZIP_FILE" ]; then
+        OTHER_ZIP=$OTHER_DIR/$OTHER_ZIP_FILE
+    else
+        OTHER_ZIP=$OTHER_DIR/$ZIP_FILE
+    fi
 
     THIS_SUFFIX="${THIS_ZIP##*.}"
     OTHER_SUFFIX="${OTHER_ZIP##*.}"
@@ -962,6 +968,9 @@
     echo "[FILTER]            List filenames in the image to compare, works for jars, zips, libs and execs"
     echo "Example:"
     echo "bash ./common/bin/compareimages.sh CodePointIM.jar"
+    echo ""
+    echo "-2zips <file1> <file2> Compare two zip files only"
+    echo ""
     exit 10
 fi
 
@@ -1023,6 +1032,13 @@
         -execs)
             CMP_EXECS=true
             ;;
+        -2zips)
+            CMP_2_ZIPS=true
+            THIS_FILE=$2
+            OTHER_FILE=$3
+            shift
+            shift
+            ;;
         *)
             CMP_NAMES=false
             CMP_PERMS=false
@@ -1041,6 +1057,18 @@
     shift
 done
 
+if [ "$CMP_2_ZIPS" = "true" ]; then
+    THIS_DIR="$(dirname $THIS_FILE)"
+    THIS_DIR="$(cd "$THIS_DIR" && pwd )"
+    OTHER_DIR="$(dirname $OTHER_FILE)"
+    OTHER_DIR="$(cd "$OTHER_DIR" && pwd )"
+    THIS_FILE_NAME="$(basename $THIS_FILE)"
+    OTHER_FILE_NAME="$(basename $OTHER_FILE)"
+    echo Comparing $THIS_DIR/$THIS_FILE_NAME and $OTHER_DIR/$OTHER_FILE_NAME
+    compare_zip_file $THIS_DIR $OTHER_DIR $COMPARE_ROOT/2zips $THIS_FILE_NAME $OTHER_FILE_NAME
+    exit
+fi
+
 if [ "$CMP_NAMES" = "false" ] && [ "$CMP_TYPES" = "false" ] && [ "$CMP_PERMS" = "false" ] && [ "$CMP_GENERAL" = "false" ] && [ "$CMP_ZIPS" = "false" ] && [ "$CMP_JARS" = "false" ] && [ "$CMP_LIBS" = "false" ] && [ "$CMP_EXECS" = "false" ]; then
     CMP_NAMES=true
     CMP_PERMS=true
--- a/common/makefiles/Main.gmk	Tue Jan 22 21:02:06 2013 -0800
+++ b/common/makefiles/Main.gmk	Mon Jan 28 16:29:34 2013 -0400
@@ -116,13 +116,19 @@
 	@($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk $(JDK_TARGET))
 	@$(call TargetExit)
 
+nashorn: jdk nashorn-only
+nashorn-only: start-make
+	@$(call TargetEnter)
+	@($(CD) $(NASHORN_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildNashorn.gmk)
+	@$(call TargetExit)
+
 demos: jdk demos-only
 demos-only: start-make
 	@$(call TargetEnter)
 	@($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk demos)
 	@$(call TargetExit)
 
-images: source-tips demos images-only
+images: source-tips demos nashorn images-only
 images-only: start-make
 	@$(call TargetEnter)
 	@($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk images)
@@ -173,7 +179,7 @@
 
 
 # Remove everything, except the output from configure.
-clean: clean-langtools clean-corba clean-jaxp clean-jaxws clean-hotspot clean-jdk clean-images clean-overlay-images clean-bootcycle-build clean-docs
+clean: clean-langtools clean-corba clean-jaxp clean-jaxws clean-hotspot clean-jdk clean-nashorn clean-images clean-overlay-images clean-bootcycle-build clean-docs
 	@($(CD) $(OUTPUT_ROOT) && $(RM) -r tmp source_tips build.log* build-trace*.log*)
 	@$(ECHO) Cleaned all build artifacts.
 
@@ -203,6 +209,8 @@
 	$(call CleanComponent,hotspot)
 clean-jdk:
 	$(call CleanComponent,jdk)
+clean-nashorn:
+	$(call CleanComponent,nashorn)
 clean-images:
 	$(call CleanComponent,images)
 clean-overlay-images:
@@ -216,6 +224,6 @@
 .PHONY: langtools corba jaxp jaxws hotspot jdk images overlay-images install
 .PHONY: langtools-only corba-only jaxp-only jaxws-only hotspot-only jdk-only images-only overlay-images-only install-only
 .PHONY: all test clean dist-clean bootcycle-images start-make
-.PHONY: clean-langtools clean-corba clean-jaxp clean-jaxws clean-hotspot clean-jdk clean-images clean-overlay-images clean-bootcycle-build
+.PHONY: clean-langtools clean-corba clean-jaxp clean-jaxws clean-hotspot clean-jdk clean-nashorn clean-images clean-overlay-images clean-bootcycle-build
 
 FRC: # Force target
--- a/common/makefiles/MakeBase.gmk	Tue Jan 22 21:02:06 2013 -0800
+++ b/common/makefiles/MakeBase.gmk	Mon Jan 28 16:29:34 2013 -0400
@@ -51,8 +51,9 @@
 		     -e 's|X98|$(OUTPUT_ROOT)|g' -e 's|X97|$(SRC_ROOT)|g' \
 		     -e 's|X00|X|g' | tr '\n' '$2'
 
+# Subst in an extra $ to prevent it from disappearing.
 define ListPathsSafely_If
-    $(if $(word $3,$($1)),$(eval $1_LPS$3:=$(call compress_paths,$(wordlist $3,$4,$($1)))))
+    $(if $(word $3,$($1)),$(eval $1_LPS$3:=$(call compress_paths,$(subst $$,$$$$,$(wordlist $3,$4,$($1))))))
 endef
 
 define ListPathsSafely_Printf
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/nashorn-rules.gmk	Mon Jan 28 16:29:34 2013 -0400
@@ -0,0 +1,56 @@
+#
+# Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+################################################################
+# NASHORN TARGETS
+################################################################
+
+NASHORN_BUILD_ARGUMENTS = \
+   $(COMMON_BUILD_ARGUMENTS) \
+   ALT_OUTPUTDIR=$(NASHORN_OUTPUTDIR) \
+   ALT_BOOTDIR=$(BOOTDIR) \
+   ALT_JDK_IMPORT_PATH=$(JDK_IMPORT_PATH)
+
+ifeq ($(BUILD_LANGTOOLS), true)
+   NASHORN_BUILD_ARGUMENTS += ALT_LANGTOOLS_DIST=$(ABS_LANGTOOLS_DIST)
+endif
+
+nashorn: nashorn-build
+nashorn-build:
+	$(MKDIR) -p $(NASHORN_OUTPUTDIR)
+	@$(call MakeStart,nashorn,all)
+	($(CD) $(NASHORN_TOPDIR)/make && \
+	 $(MAKE) $(NASHORN_BUILD_ARGUMENTS) all)
+	@$(call MakeFinish,nashorn,all)
+
+nashorn-clobber::
+	$(MKDIR) -p $(NASHORN_OUTPUTDIR)
+	@$(call MakeStart,nashorn,clobber)
+	($(CD) $(NASHORN_TOPDIR)/make &&  \
+	 $(MAKE) $(NASHORN_BUILD_ARGUMENTS) clobber)
+	@$(call MakeFinish,nashorn,clobber)
+
+.PHONY: nashorn nashorn-build nashorn-clobber 
+
--- a/make/scripts/hgforest.sh	Tue Jan 22 21:02:06 2013 -0800
+++ b/make/scripts/hgforest.sh	Mon Jan 28 16:29:34 2013 -0400
@@ -40,7 +40,7 @@
 repos=""
 repos_extra=""
 if [ "${command}" = "clone" -o "${command}" = "fclone" ] ; then
-  subrepos="corba jaxp jaxws langtools jdk hotspot"
+  subrepos="corba jaxp jaxws langtools jdk hotspot nashorn"
   if [ -f .hg/hgrc ] ; then
     pull_default=`hg paths default`
     if [ "${pull_default}" = "" ] ; then