-
Notifications
You must be signed in to change notification settings - Fork 24
/
build.sh
executable file
·84 lines (69 loc) · 2.53 KB
/
build.sh
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
#!/bin/bash -e
# Where to install the toolchain
if [ "x$PREFIX" == "x" ]; then
export PREFIX=/opt/toolchains/or1k-elf
fi
# We need the previously installed tools
export PATH=$PATH:$PREFIX/bin
# Build mutlticore variant
if [ "x$BUILD_MULTICORE" == "x" ]; then
export CFLAGS_PARAM=""
else
export CFLAGS_PARAM="CFLAGS=-D__OR1K_MULTICORE__"
fi
# Location of newlib repository
if [ "x$NEWLIB_CHECKOUT" == "x" ]; then
if [ ! -d newlib ]; then
git clone git://sourceware.org/git/newlib-cygwin.git newlib
fi
export NEWLIB_CHECKOUT=$PWD/newlib
fi
if [ "x$JOBS" != "x" ]; then
export JOBS="-j $JOBS"
fi
# Clone binutils and gdb if necessary
if [ ! -d binutils ]; then
git clone git://sourceware.org/git/binutils-gdb.git binutils
fi
if [ ! -d gdb ]; then
git clone https://github.com/openrisc/binutils-gdb.git gdb
fi
# Clone gcc if necessary
if [ ! -d gcc ]; then
git clone https://github.com/openrisc/or1k-gcc.git gcc
fi
rm -rf build-*
if [ "x$LOG_REDIRECT" != "x" ]; then
export LOG='> $LOG_REDIRECT'
fi
# Build!
echo "++ build binutils"
mkdir build-binutils; cd build-binutils
eval ../binutils/configure --target=or1k-elf --prefix=$PREFIX --disable-itcl --disable-tk --disable-tcl --disable-winsup --disable-gdbtk --disable-libgui --disable-rda --disable-sid --disable-sim --disable-gdb --with-sysroot --disable-newlib --disable-libgloss --with-system-zlib $LOG
eval make $JOBS $LOG
eval make install $LOG
cd ..
echo "++ build gcc (stage 1)"
mkdir build-gcc-stage1; cd build-gcc-stage1
eval ../gcc/configure --target=or1k-elf --prefix=$PREFIX --enable-languages=c --disable-shared --disable-libssp $LOG
eval make $JOBS $LOG
eval make install $LOG
cd ..
echo "++ build newlib"
mkdir build-newlib; cd build-newlib
eval ${NEWLIB_CHECKOUT}/configure --target=or1k-elf --prefix=$PREFIX ${CFLAGS_PARAM} $LOG
eval make $JOBS $LOG
eval make install $LOG
cd ..
echo "++ build gcc (stage 2)"
mkdir build-gcc-stage2; cd build-gcc-stage2
eval ../gcc/configure --target=or1k-elf --prefix=$PREFIX --enable-languages=c,c++ --disable-shared --disable-libssp --with-newlib $LOG
eval make $JOBS $LOG
eval make install $LOG
cd ..
echo "++ build gdb"
mkdir build-gdb; cd build-gdb
eval ../gdb/configure --target=or1k-elf --prefix=$PREFIX --disable-shared --disable-itcl --disable-tk --disable-tcl --disable-winsup --disable-gdbtk --disable-libgui --disable-rda --disable-sid --with-sysroot --disable-newlib --disable-libgloss --disable-gas --disable-ld --disable-binutils --disable-gprof --with-system-zlib $LOG
eval make $JOBS $LOG
eval make install $LOG
cd ..