summaryrefslogtreecommitdiff
path: root/binary/linux-gnu/build-gcc
blob: 0f4815d7e0c495f0c60457e48a9283fbe4d3b496 (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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#! /usr/bin/env bash

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

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

arch=x86_64-linux-gnu
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

out_root=`pwd`

mkdir -p binutils-build
mkdir -p gcc-build

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

  if [ $arch = "x86_64-linux-gnu" ]; then
    mkdir /$arch/lib
    ln -s lib /$arch/lib64
  fi 
fi

# Build binutils
#
cd binutils-build

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

make -j 4
make install
cd ..

# Remove installed binutils libraries.
#
rm -rf /$arch/lib/* /$arch/include/*

# Build gcc
#
cd gcc-build

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

make -j 4
make install
make -C $arch/libstdc++-v3 install-strip

cd ..

# Clean up arch-prefixed g++, etc.
#
rm -f /$arch/bin/$arch-*