1#! /bin/sh
2
3# Build a GCC compiler, using environment variables defined by several
4# reghunt scripts and config files.
5#
6# This doesn't work for sources earlier than about 2003-02-25.
7#
8# Copyright (C) 2007 Free Software Foundation.
9#
10# This file is free software; you can redistribute it and/or modify
11# it under the terms of the GNU General Public License as published by
12# the Free Software Foundation; either version 3 of the License, or
13# (at your option) any later version.
14#
15# This program is distributed in the hope that it will be useful,
16# but WITHOUT ANY WARRANTY; without even the implied warranty of
17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18# GNU General Public License for more details.
19#
20# For a copy of the GNU General Public License, write the the
21# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22# Boston, MA 02111-1301, USA.
23
24ID="${1}"
25LOGDIR=${REG_BUILDDIR}/logs/${BUGID}/${ID}
26mkdir -p $LOGDIR
27
28msg() {
29    echo "`date`  ${1}"
30}
31
32abort() {
33    msg "${1}"
34    exit 1
35}
36
37msg "building $REG_COMPILER for id $ID"
38
39rm -rf $REG_OBJDIR
40mkdir $REG_OBJDIR
41cd $REG_OBJDIR
42
43#msg "configure"
44${REG_GCCSRC}/configure \
45    --prefix=$REG_PREFIX \
46    --enable-languages=$REG_LANGS \
47    $REG_CONFOPTS \
48  > configure.log 2>&1 || abort "  configure failed"
49
50#msg "make libraries"
51make all-build-libiberty > ${LOGDIR}/make.all-build-libiberty.log 2>&1 || true
52make all-libcpp > ${LOGDIR}/make.all-libcpp.log 2>&1 || true
53make all-libdecnumber > ${LOGDIR}/make.all-libdecnumber.log 2>&1 || true
54make all-intl > ${LOGDIR}/make.all-intl.log 2>&1 || true
55make all-libbanshee > ${LOGDIR}/make.all-libbanshee.log 2>&1 || true
56make configure-gcc > ${LOGDIR}/make.configure-gcc.log  2>&1 || true
57
58# hack for 3.3 branch
59if [ ! -f libiberty/libiberty.a ]; then
60  if [ -d libiberty ]; then
61    # another hack for 3.2!
62    cd libiberty
63    make > ${LOGDIR}/make.libiberty.log 2>&1 || true
64    cd ..
65  else
66    mkdir -p libiberty
67    cd libiberty
68    ln -s ../build-${REG_BLD}/libiberty/libiberty.a .
69    cd ..
70  fi
71fi
72
73cd gcc
74# REG_COMPILER is cc1, cc1plus, or f951
75#msg "make $REG_COMPILER"
76make $REG_MAKE_J $REG_COMPILER > ${LOGDIR}/make.${REG_COMPILER}.log 2>&1 \
77  || abort "  make failed"
78msg "build completed"
79exit 0
80