common/bin/boot_cycle.sh

Wed, 27 Apr 2016 01:39:08 +0800

author
aoqi
date
Wed, 27 Apr 2016 01:39:08 +0800
changeset 0
75a576e87639
permissions
-rw-r--r--

Initial load
http://hg.openjdk.java.net/jdk8u/jdk8u/
changeset: 1170:d117f01bfb4f
tag: jdk8u25-b17

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

mercurial