1 #!/bin/bash 2 # 3 # Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. 4 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5 # 6 # This code is free software; you can redistribute it and/or modify it 7 # under the terms of the GNU General Public License version 2 only, as 8 # published by the Free Software Foundation. 9 # 10 # This code is distributed in the hope that it will be useful, but WITHOUT 11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13 # version 2 for more details (a copy is included in the LICENSE file that 14 # accompanied this code). 15 # 16 # You should have received a copy of the GNU General Public License version 17 # 2 along with this work; if not, write to the Free Software Foundation, 18 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 19 # 20 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 21 # or visit www.oracle.com if you need additional information or have any 22 # questions. 23 # 24 25 # The boot_cycle.sh script performs two complete image builds (no javadoc though....) 26 # where the second build uses the first build as the boot jdk. 27 # 28 # This is useful to verify that the build is self hoisting and assists 29 # in flushing out bugs. You can follow up with compare_objects.sh to check 30 # that the two boot_cycle_?/images/j2sdk are identical. They should be. 31 # 32 # Usage: 33 # Specify the configure arguments to boot_cycle.sh, for example: 34 # 35 # sh common/bin/boot_cycle.sh --enable-debug --with-jvm-variants=server 36 # 37 # The same arguments will be used for both builds, except of course --with-boot-jdk 38 # that will be adjusted to boot_cycle_1 for the second build. 39 40 SCRIPT_DIR=`pwd`/`dirname $0` 41 ROOT_DIR=`(cd $SCRIPT_DIR/../.. ; pwd)` 42 BUILD_DIR=$ROOT_DIR/build 43 mkdir -p $BUILD_DIR 44 AUTOCONF_DIR=`(cd $SCRIPT_DIR/../autoconf ; pwd)` 45 BOOT_CYCLE_1_DIR=$BUILD_DIR/boot_cycle_1 46 BOOT_CYCLE_2_DIR=$BUILD_DIR/boot_cycle_2 47 48 # Create the boot cycle dirs in the build directory. 49 mkdir -p $BOOT_CYCLE_1_DIR 50 mkdir -p $BOOT_CYCLE_2_DIR 51 52 cd $BOOT_CYCLE_1_DIR 53 # Configure! 54 sh $AUTOCONF_DIR/configure "$@" 55 # Now build! 56 make images 57 58 if ! test -x $BOOT_CYCLE_1_DIR/images/j2sdk-image/bin/java ; then 59 echo Failed to build the executable $BOOT_CYCLE_1_DIR/images/j2sdk-image/bin/java 60 exit 1 61 fi 62 63 cd $BOOT_CYCLE_2_DIR 64 # Pickup the configure arguments, but drop any --with-boot-jdk=.... 65 # and add the correct --with-boot-jdk=...boot_cycle_1... at the end. 66 ARGUMENTS="`cat $BOOT_CYCLE_1_DIR/configure-arguments|sed 's/--with-boot-jdk=[^ ]*//'` --with-boot-jdk=$BOOT_CYCLE_1_DIR/images/j2sdk-image" 67 # Configure using these adjusted arguments. 68 sh $AUTOCONF_DIR/configure $ARGUMENTS 69 # Now build! 70 make images 71 72 if ! test -x $BOOT_CYCLE_2_DIR/images/j2sdk-image/bin/java ; then 73 echo Failed to build the final executable $BOOT_CYCLE_2_DIR/images/j2sdk-image/bin/java 74 exit 1 75 fi 76 77