1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/common/bin/boot_cycle.sh Wed Apr 27 01:39:08 2016 +0800 1.3 @@ -0,0 +1,77 @@ 1.4 +#!/bin/bash 1.5 +# 1.6 +# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. 1.7 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 +# 1.9 +# This code is free software; you can redistribute it and/or modify it 1.10 +# under the terms of the GNU General Public License version 2 only, as 1.11 +# published by the Free Software Foundation. 1.12 +# 1.13 +# This code is distributed in the hope that it will be useful, but WITHOUT 1.14 +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.15 +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.16 +# version 2 for more details (a copy is included in the LICENSE file that 1.17 +# accompanied this code). 1.18 +# 1.19 +# You should have received a copy of the GNU General Public License version 1.20 +# 2 along with this work; if not, write to the Free Software Foundation, 1.21 +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.22 +# 1.23 +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 1.24 +# or visit www.oracle.com if you need additional information or have any 1.25 +# questions. 1.26 +# 1.27 + 1.28 +# The boot_cycle.sh script performs two complete image builds (no javadoc though....) 1.29 +# where the second build uses the first build as the boot jdk. 1.30 +# 1.31 +# This is useful to verify that the build is self hoisting and assists 1.32 +# in flushing out bugs. You can follow up with compare_objects.sh to check 1.33 +# that the two boot_cycle_?/images/j2sdk are identical. They should be. 1.34 +# 1.35 +# Usage: 1.36 +# Specify the configure arguments to boot_cycle.sh, for example: 1.37 +# 1.38 +# sh common/bin/boot_cycle.sh --enable-debug --with-jvm-variants=server 1.39 +# 1.40 +# The same arguments will be used for both builds, except of course --with-boot-jdk 1.41 +# that will be adjusted to boot_cycle_1 for the second build. 1.42 + 1.43 +SCRIPT_DIR=`pwd`/`dirname $0` 1.44 +ROOT_DIR=`(cd $SCRIPT_DIR/../.. ; pwd)` 1.45 +BUILD_DIR=$ROOT_DIR/build 1.46 +mkdir -p $BUILD_DIR 1.47 +AUTOCONF_DIR=`(cd $SCRIPT_DIR/../autoconf ; pwd)` 1.48 +BOOT_CYCLE_1_DIR=$BUILD_DIR/boot_cycle_1 1.49 +BOOT_CYCLE_2_DIR=$BUILD_DIR/boot_cycle_2 1.50 + 1.51 +# Create the boot cycle dirs in the build directory. 1.52 +mkdir -p $BOOT_CYCLE_1_DIR 1.53 +mkdir -p $BOOT_CYCLE_2_DIR 1.54 + 1.55 +cd $BOOT_CYCLE_1_DIR 1.56 +# Configure! 1.57 +sh $AUTOCONF_DIR/configure "$@" 1.58 +# Now build! 1.59 +make images 1.60 + 1.61 +if ! test -x $BOOT_CYCLE_1_DIR/images/j2sdk-image/bin/java ; then 1.62 + echo Failed to build the executable $BOOT_CYCLE_1_DIR/images/j2sdk-image/bin/java 1.63 + exit 1 1.64 +fi 1.65 + 1.66 +cd $BOOT_CYCLE_2_DIR 1.67 +# Pickup the configure arguments, but drop any --with-boot-jdk=.... 1.68 +# and add the correct --with-boot-jdk=...boot_cycle_1... at the end. 1.69 +ARGUMENTS="`cat $BOOT_CYCLE_1_DIR/configure-arguments|sed 's/--with-boot-jdk=[^ ]*//'` --with-boot-jdk=$BOOT_CYCLE_1_DIR/images/j2sdk-image" 1.70 +# Configure using these adjusted arguments. 1.71 +sh $AUTOCONF_DIR/configure $ARGUMENTS 1.72 +# Now build! 1.73 +make images 1.74 + 1.75 +if ! test -x $BOOT_CYCLE_2_DIR/images/j2sdk-image/bin/java ; then 1.76 + echo Failed to build the final executable $BOOT_CYCLE_2_DIR/images/j2sdk-image/bin/java 1.77 + exit 1 1.78 +fi 1.79 + 1.80 +