aboutsummaryrefslogtreecommitdiffstats
path: root/cross-x86.sh
blob: 87678ef8afe431417199fac0729cd7ddc3856b5f (plain) (blame)
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

#!/bin/sh

GCC=5.4.0
BINUTILS=2.24
ARCH=x86

cd `dirname $0`

export BASEDIR=`pwd`
export PREFIX=$HOME/usr
export TARGET=i586-elf

#export MIRROR=http://ftp.gnu.org/gnu
export MIRROR=http://mirror.ibcp.fr/pub/gnu

echo " ==> FETCHING CROSS COMPILER ARCHIVES <=="
if [ ! -f gcc-$GCC.tar.bz2 ]; then wget $MIRROR/gcc/gcc-$GCC/gcc-$GCC.tar.bz2; fi
if [ ! -f binutils-$BINUTILS.tar.bz2 ]; then wget $MIRROR/binutils/binutils-$BINUTILS.tar.bz2; fi

mkdir build-$ARCH
cd build-$ARCH

echo " ==> EXTRACTING ARCHIVES <=="
tar xjf ../gcc-$GCC.tar.bz2
tar xjf ../binutils-$BINUTILS.tar.bz2

mkdir build-binutils-$BINUTILS
mkdir build-gcc-$GCC

echo " =>> STARTING BUILD <<="
cd build-binutils-$BINUTILS
../binutils-$BINUTILS/configure --prefix=$PREFIX --target=$TARGET --disable-nls --disable-werror --with-sysroot || exit
make -j4 configure-host || exit
make -j4 all || exit
make -j4 install || exit

export PATH=$PATH:$PREFIX/bin

cd ../build-gcc-$GCC
../gcc-$GCC/configure --prefix=$PREFIX --target=$TARGET --disable-nls --enable-languages=c,c++ --without-headers --disable-werror || exit
make -j4 all-gcc || exit
make -j4 install-gcc || exit
make -j4 all-target-libgcc || exit
make -j4 install-target-libgcc || exit