| 1 | #! /bin/sh
|
|---|
| 2 |
|
|---|
| 3 | ########################################################################
|
|---|
| 4 | #
|
|---|
| 5 | # File: gcc_build
|
|---|
| 6 | # Author: Mark Mitchell
|
|---|
| 7 | # Date: 07/10/2000
|
|---|
| 8 | #
|
|---|
| 9 | # Contents:
|
|---|
| 10 | # Script to automatically download and build GCC.
|
|---|
| 11 | #
|
|---|
| 12 | # Copyright (c) 2000, 2001 Free Software Foundation.
|
|---|
| 13 | #
|
|---|
| 14 | # This file is part of GNU CC.
|
|---|
| 15 | #
|
|---|
| 16 | # GNU CC is free software; you can redistribute it and/or modify
|
|---|
| 17 | # it under the terms of the GNU General Public License as published by
|
|---|
| 18 | # the Free Software Foundation; either version 2, or (at your option)
|
|---|
| 19 | # any later version.
|
|---|
| 20 | #
|
|---|
| 21 | # GNU CC is distributed in the hope that it will be useful,
|
|---|
| 22 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 23 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 24 | # GNU General Public License for more details.
|
|---|
| 25 | #
|
|---|
| 26 | # You should have received a copy of the GNU General Public License
|
|---|
| 27 | # along with GNU CC; see the file COPYING. If not, write to
|
|---|
| 28 | # the Free Software Foundation, 59 Temple Place - Suite 330,
|
|---|
| 29 | # Boston, MA 02111-1307, USA.
|
|---|
| 30 | #
|
|---|
| 31 | ########################################################################
|
|---|
| 32 |
|
|---|
| 33 | ########################################################################
|
|---|
| 34 | # Notes
|
|---|
| 35 | ########################################################################
|
|---|
| 36 |
|
|---|
| 37 | # If you are using password-based CVS, you must manually log in, and
|
|---|
| 38 | # not log out from, the CVS server before running this script.
|
|---|
| 39 |
|
|---|
| 40 | # You can set the following variables in the environment. They
|
|---|
| 41 | # have no corresponding command-line options because they should
|
|---|
| 42 | # only be needed infrequently:
|
|---|
| 43 | #
|
|---|
| 44 | # MAKE The path to `make'.
|
|---|
| 45 |
|
|---|
| 46 | ########################################################################
|
|---|
| 47 | # Functions
|
|---|
| 48 | ########################################################################
|
|---|
| 49 |
|
|---|
| 50 | # Issue the error message given by $1 and exit with a non-zero
|
|---|
| 51 | # exit code.
|
|---|
| 52 |
|
|---|
| 53 | error() {
|
|---|
| 54 | echo "gcc_build: error: $1"
|
|---|
| 55 | exit 1
|
|---|
| 56 | }
|
|---|
| 57 |
|
|---|
| 58 | # Issue a usage message explaining how to use this script.
|
|---|
| 59 |
|
|---|
| 60 | usage() {
|
|---|
| 61 | cat <<EOF
|
|---|
| 62 | gcc_build [-c configure_options]
|
|---|
| 63 | [-d destination_directory]
|
|---|
| 64 | [-m make_boot_options]
|
|---|
| 65 | [-o objdir]
|
|---|
| 66 | [-u username]
|
|---|
| 67 | [-p protocol]
|
|---|
| 68 | [-t tarfile]
|
|---|
| 69 | [bootstrap]
|
|---|
| 70 | [build]
|
|---|
| 71 | [checkout]
|
|---|
| 72 | [configure]
|
|---|
| 73 | [export]
|
|---|
| 74 | [install]
|
|---|
| 75 | [test]
|
|---|
| 76 | [update]
|
|---|
| 77 | EOF
|
|---|
| 78 | exit 1
|
|---|
| 79 | }
|
|---|
| 80 |
|
|---|
| 81 | # Change to the directory given by $1.
|
|---|
| 82 |
|
|---|
| 83 | changedir() {
|
|---|
| 84 | cd $1 || \
|
|---|
| 85 | error "Could not change directory to $1"
|
|---|
| 86 | }
|
|---|
| 87 |
|
|---|
| 88 | # Set up CVS environment variables
|
|---|
| 89 |
|
|---|
| 90 | cvs_setup() {
|
|---|
| 91 | CVSROOT=":${CVS_PROTOCOL}:${CVS_USERNAME}@"
|
|---|
| 92 | CVSROOT="${CVSROOT}${CVS_SERVER}:${CVS_REPOSITORY}"
|
|---|
| 93 | export CVSROOT
|
|---|
| 94 | }
|
|---|
| 95 |
|
|---|
| 96 | # Checkout a fresh copy of the GCC build tree.
|
|---|
| 97 |
|
|---|
| 98 | checkout_gcc() {
|
|---|
| 99 | # Tell CVS where to find everything.
|
|---|
| 100 | cvs_setup
|
|---|
| 101 |
|
|---|
| 102 | # If the destination already exists, don't risk destroying it.
|
|---|
|
|---|