-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-toolchain
executable file
·58 lines (46 loc) · 2 KB
/
build-toolchain
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
#!/bin/bash -ex
# Copyright 2010-2011 Daniel J Blueman <[email protected]>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
unset CFLAGS CXXFLAGS LDFLAGS
sudo apt-get build-dep binutils gcc-4.6-base
BINUTILS=2.21.1
GCC=4.6.1
# GNUMIRROR=http://www.mirrorservice.org/sites/ftp.gnu.org/gnu
GNUMIRROR=http://ftp.twaren.net/Unix/GNU/gnu/
TARGET=arm-linux-gnueabi
TOPDIR=`pwd`
PREFIX=$TOPDIR/toolchain
BUILDDIR=$TOPDIR/build
rm -rf $PREFIX $BUILDDIR
mkdir -p $BUILDDIR
PARALLEL=-j`getconf _NPROCESSORS_ONLN`
export PATH=/usr/sbin:/usr/bin:/sbin:/bin LANG=C CFLAGS="-O3" # -Wno-error"
mkdir -p $PREFIX
cd $TOPDIR
[ -f binutils-${BINUTILS}.tar.bz2 ] || wget -t10 -c $GNUMIRROR/binutils/binutils-${BINUTILS}.tar.bz2
tar -xjf binutils-$BINUTILS.tar.bz2 -C $BUILDDIR
mkdir -p $BUILDDIR/binutils-${BINUTILS}-obj
cd $BUILDDIR/binutils-${BINUTILS}-obj
../binutils-${BINUTILS}/configure --target=$TARGET --prefix=$PREFIX --disable-nls
make $PARALLEL
make install
cd $TOPDIR
[ -f gcc-core-${GCC}.tar.bz2 ] || wget -t10 -c $GNUMIRROR/gcc/gcc-$GCC/gcc-core-${GCC}.tar.bz2
tar -xjf gcc-core-${GCC}.tar.bz2 -C $BUILDDIR
mkdir -p $BUILDDIR/gcc-${GCC}-obj
cd $BUILDDIR/gcc-${GCC}-obj
../gcc-${GCC}/configure --target=$TARGET --prefix=$PREFIX --enable-languages=c --disable-threads --disable-shared --disable-nls
make $PARALLEL all-gcc all-target-libgcc
make install-gcc install-target-libgcc
# cleanup
cd $TOPDIR
rm -rf binutils-$BINUTILS.tar.bz2 gcc-core-${GCC}.tar.bz2 $BUILDDIR