forked from jbrandwood/v810-gcc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_compiler.sh
executable file
·129 lines (99 loc) · 2.63 KB
/
build_compiler.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#! /bin/sh
#
# Build script for V810-GCC.
#
# Use this to download the GNU source code files and then build the whole
# V810 GCC toolchain in a single step.
#
# If things break or don't compile, then you can look at this file as a
# template for the individual steps that you need to take to fix things.
#
OSNAME=`uname -s`
GITDIR=$(pwd)
echo GITDIR is $GITDIR
rm -rf build
#---------------------------------------------------------------------------------
# Clean up the source & build directories?
#---------------------------------------------------------------------------------
if [ "${1}" = "clean" ] ; then
if [ -e build ] ; then
rm -rf build
fi
if [ -e binutils-2.27 ] ; then
rm -rf binutils-2.27
fi
if [ -e gcc-4.9.4 ] ; then
rm -rf gcc-4.9.4
fi
if [ -e newlib-2.2.0-1 ] ; then
rm -rf newlib-2.2.0-1
fi
exit 0
fi
#---------------------------------------------------------------------------------
# Check Prerequisites
#---------------------------------------------------------------------------------
## Test for executables
TestEXE()
{
TEMP=`type $1`
if [ $? != 0 ]; then
echo "Error: $1 not installed";
exit 1;
fi
}
TestEXE "curl";
#---------------------------------------------------------------------------------
# Download the source files from GNU and Sourceware (Redhat)
#---------------------------------------------------------------------------------
./step0_download_prereqs.sh
if [ $? != 0 ]; then
echo "Error: Failed to download source archives";
exit 1;
fi
#---------------------------------------------------------------------------------
# Now go through the 8-stage build process
#---------------------------------------------------------------------------------
./step1_prepare_binutils.sh
if [ $? != 0 ]; then
echo "Error: Failed to prepare binutils";
exit 1;
fi
./step2_make_binutils.sh
if [ $? != 0 ]; then
echo "Error: Failed to build binutils";
exit 1;
fi
./step3_prepare_initial_gcc.sh
if [ $? != 0 ]; then
echo "Error: Failed to prepare initial gcc";
exit 1;
fi
./step4_make_initial_gcc.sh
if [ $? != 0 ]; then
echo "Error: Failed to build initial gcc";
exit 1;
fi
./step5_prepare_newlib.sh
if [ $? != 0 ]; then
echo "Error: Failed to prepare newlib";
exit 1;
fi
./step6_make_newlib.sh
if [ $? != 0 ]; then
echo "Error: Failed to build newlib";
exit 1;
fi
./step7_prepare_final_gcc.sh
if [ $? != 0 ]; then
echo "Error: Failed to prepare final gcc";
exit 1;
fi
./step8_make_final_gcc.sh
if [ $? != 0 ]; then
echo "Error: Failed to build final gcc";
exit 1;
fi
echo
echo "$0 finished, don't forget to check for any error messages."
exit 0