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