-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild
executable file
·64 lines (48 loc) · 1.34 KB
/
build
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
#!/bin/sh
set -x
ORIGIN_DIR=$(pwd)
ROOTDIR=$(dirname $0)
export MAKEFLAGS=-j` nproc`
export CFLAGS="-s"
export CXXFLAGS="-s"
GCC_VERSION=8.2.0
export PREFIX="$ROOTDIR/opt/gcc-$GCC_VERSION"
# bootstrap binutils
cd $ROOTDIR
mkdir -p build-binutils
cd build-binutils
../binutils-gdb/configure --prefix="$PREFIX" --disable-nls --disable-werror
make
make install
# bootstrap gcc
cd $ROOTDIR
mkdir -p build-gcc
cd build-gcc
../gcc/configure --prefix="$PREFIX" --disable-nls --enable-languages=c,c++
make
make install-strip
export PATH="$ROOTDIR/opt/gcc-$GCC_VERSION-cross/bin:$PATH"
export PREFIX="$ROOTDIR/opt/gcc-$GCC_VERSION-cross"
export TARGET=i686-elf
export PATH="$PREFIX/bin:$PATH"
# build cross binutils
cd $ROOTDIR
mkdir build-binutils-cross
cd build-binutils-cross
../binutils-gdb/configure --target=$TARGET --prefix="$PREFIX" --with-sysroot --disable-nls --disable-werror
make
make install
echo $PATH
# build cross gcc
cd $ROOTDIR
# The $PREFIX/bin dir _must_ be in the PATH. We did that above.
which -- $TARGET-as || echo $TARGET-as is not in the PATH
mkdir -p build-gcc-cross
cd build-gcc-cross
../gcc/configure --target=$TARGET --prefix="$PREFIX" --disable-nls --enable-languages=c,c++ --without-headers
make all-gcc -j13
make all-target-libgcc
make install-strip-gcc
make install-strip-target-libgcc
cd $ROOTDIR
tar cf - opt | pigz > gcc-bin.tar.gz