summaryrefslogtreecommitdiff
path: root/binary/solaris/build-gcc
blob: 2258ba095e2dcb4fee0c827c36941b8e76414af0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#! /usr/bin/env bash

# Create GCC compiler Solaris distribution.
#
# -rebuild
# -arch
#
trap 'exit 1' ERR

function error ()
{
  echo "$*" 1>&2
}

arhc=i686-solaris2.10
rebuild=n

while [ $# -gt 0 ]; do
  case $1 in
    -rebuild)
      rebuild=y
      shift
      ;;
    -arch)
      shift
      arch=$1
      shift
      ;;
    *)
      error "unknown option: $1"
      exit 1
      ;;
  esac
done

# Make sure we have objdump.
#
objdump --version 2>/dev/null 1>&2 || {
  error "no objdump can be found"
  error "consider: ln -s /usr/sfw/bin/gobjdump /usr/local/bin/objdump"
  exit 1
}

cpu=`echo $arch | sed -e 's/^\([^-]*\)-.*$/\1/'`

mkdir -p gcc-build

# Clean everything up if we are rebuilding.
#
if [ $rebuild = y ]; then
  rm -rf gcc-build/*
  rm -rf /$arch/*
fi

# Build gcc
#
cd gcc-build

if [ $rebuild = y ]; then
  ../gcc-configure $arch $cpu
fi

# SPARC gas is buggy and cannot handle -g.
#
make -j 2
make install
make -C $arch/libstdc++-v3 install-strip

cd ..