aoqi@0: #!/bin/bash aoqi@0: # aoqi@0: # Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. aoqi@0: # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. aoqi@0: # aoqi@0: # This code is free software; you can redistribute it and/or modify it aoqi@0: # under the terms of the GNU General Public License version 2 only, as aoqi@0: # published by the Free Software Foundation. aoqi@0: # aoqi@0: # This code is distributed in the hope that it will be useful, but WITHOUT aoqi@0: # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or aoqi@0: # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License aoqi@0: # version 2 for more details (a copy is included in the LICENSE file that aoqi@0: # accompanied this code). aoqi@0: # aoqi@0: # You should have received a copy of the GNU General Public License version aoqi@0: # 2 along with this work; if not, write to the Free Software Foundation, aoqi@0: # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. aoqi@0: # aoqi@0: # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA aoqi@0: # or visit www.oracle.com if you need additional information or have any aoqi@0: # questions. aoqi@0: # aoqi@0: aoqi@0: # The boot_cycle.sh script performs two complete image builds (no javadoc though....) aoqi@0: # where the second build uses the first build as the boot jdk. aoqi@0: # aoqi@0: # This is useful to verify that the build is self hoisting and assists aoqi@0: # in flushing out bugs. You can follow up with compare_objects.sh to check aoqi@0: # that the two boot_cycle_?/images/j2sdk are identical. They should be. aoqi@0: # aoqi@0: # Usage: aoqi@0: # Specify the configure arguments to boot_cycle.sh, for example: aoqi@0: # aoqi@0: # sh common/bin/boot_cycle.sh --enable-debug --with-jvm-variants=server aoqi@0: # aoqi@0: # The same arguments will be used for both builds, except of course --with-boot-jdk aoqi@0: # that will be adjusted to boot_cycle_1 for the second build. aoqi@0: aoqi@0: SCRIPT_DIR=`pwd`/`dirname $0` aoqi@0: ROOT_DIR=`(cd $SCRIPT_DIR/../.. ; pwd)` aoqi@0: BUILD_DIR=$ROOT_DIR/build aoqi@0: mkdir -p $BUILD_DIR aoqi@0: AUTOCONF_DIR=`(cd $SCRIPT_DIR/../autoconf ; pwd)` aoqi@0: BOOT_CYCLE_1_DIR=$BUILD_DIR/boot_cycle_1 aoqi@0: BOOT_CYCLE_2_DIR=$BUILD_DIR/boot_cycle_2 aoqi@0: aoqi@0: # Create the boot cycle dirs in the build directory. aoqi@0: mkdir -p $BOOT_CYCLE_1_DIR aoqi@0: mkdir -p $BOOT_CYCLE_2_DIR aoqi@0: aoqi@0: cd $BOOT_CYCLE_1_DIR aoqi@0: # Configure! aoqi@0: sh $AUTOCONF_DIR/configure "$@" aoqi@0: # Now build! aoqi@0: make images aoqi@0: aoqi@0: if ! test -x $BOOT_CYCLE_1_DIR/images/j2sdk-image/bin/java ; then aoqi@0: echo Failed to build the executable $BOOT_CYCLE_1_DIR/images/j2sdk-image/bin/java aoqi@0: exit 1 aoqi@0: fi aoqi@0: aoqi@0: cd $BOOT_CYCLE_2_DIR aoqi@0: # Pickup the configure arguments, but drop any --with-boot-jdk=.... aoqi@0: # and add the correct --with-boot-jdk=...boot_cycle_1... at the end. aoqi@0: ARGUMENTS="`cat $BOOT_CYCLE_1_DIR/configure-arguments|sed 's/--with-boot-jdk=[^ ]*//'` --with-boot-jdk=$BOOT_CYCLE_1_DIR/images/j2sdk-image" aoqi@0: # Configure using these adjusted arguments. aoqi@0: sh $AUTOCONF_DIR/configure $ARGUMENTS aoqi@0: # Now build! aoqi@0: make images aoqi@0: aoqi@0: if ! test -x $BOOT_CYCLE_2_DIR/images/j2sdk-image/bin/java ; then aoqi@0: echo Failed to build the final executable $BOOT_CYCLE_2_DIR/images/j2sdk-image/bin/java aoqi@0: exit 1 aoqi@0: fi aoqi@0: aoqi@0: