-
Notifications
You must be signed in to change notification settings - Fork 17
/
build_template.sh
128 lines (99 loc) · 3.8 KB
/
build_template.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
#!/bin/bash
# TEMPLATE - Fill with data for your architecture
#
# Toolchain buildscript
# This script requires TWO command-line parameters:
# * The directory under which all tools are going to be installed
# * The number of threads for make
# Before running the script, the following packages need to be installed in your distro:
# (These are Ubuntu package names, if you don't use Ubuntu, look for equivalents)
# build-essential, automake, autoconf, m4, flex, bison, texinfo
TARGET=""
declare -A VERSIONS=( \
['BINUTILS']="" \
['GMP']="" \
['MPFR']="" \
['MPC']="" \
['GCC']="" \
['NEWLIB']="" \
['GDB']="" \
)
declare -A SITES=( \
['BINUTILS']="http://ftp.gnu.org/gnu/binutils" \
['GMP']="https://gmplib.org/download/gmp" \
['MPFR']="http://www.mpfr.org/mpfr-${VERSIONS['MPFR']}" \
['MPC']="http://www.multiprecision.org/mpc/download" \
['GCC']="http://gnu.c3sl.ufpr.br/ftp/gcc/gcc-${VERSIONS['GCC']}" \
['NEWLIB']="ftp://sources.redhat.com/pub/newlib" \
['GDB']="http://ftp.gnu.org/gnu/gdb" \
)
declare -A PACKS=( \
['BINUTILS']="binutils-${VERSIONS['BINUTILS']}.tar.gz" \
['GMP']="gmp-${VERSIONS['GMP']}.tar.bz2" \
['MPFR']="mpfr-${VERSIONS['MPFR']}.tar.gz" \
['MPC']="mpc-${VERSIONS['MPC']}.tar.gz" \
['GCC']="gcc-${VERSIONS['GCC']}.tar.gz" \
['NEWLIB']="newlib-${VERSIONS['NEWLIB']}.tar.gz" \
['GDB']="gdb-${VERSIONS['GDB']}.tar.gz" \
)
### DO NOT EDIT THE BLOCK AFTER THIS LINE ###
DIR="$(cd -P "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")" )" && pwd)"
THR_DEFAULT="$(grep -c ^processor '/proc/cpuinfo')"
THR="${1:-"${THR_DEFAULT}"}"
BUILD_HOME_DEFAULT="${DIR}/toolchains"
BUILD_HOME="$(readlink -f "${2:-"${BUILD_HOME_DEFAULT}"}")"
PACKDIR_DEFAULT="${BUILD_HOME}/packs"
PACKDIR="$(readlink -f "${3:-"${PACKDIR_DEFAULT}"}")"
BUILDDIR_DEFAULT="${BUILD_HOME}"
BUILDDIR="$(readlink -f "${4:-"${BUILDDIR_DEFAULT}"}/${TARGET}-gcc-${VERSIONS['GCC']}-build")"
PREFIX="${BUILD_HOME}/${TARGET}/gcc-${VERSIONS['GCC']}"
### DO NOT EDIT THE BLOCK ABOVE ###
OPTS=( 'BINUTILS' 'GMP' 'MPFR' 'MPC' 'GCC' 'NEWLIB' 'GCC' 'GDB' )
BINUTILS=( "--target=${TARGET}" \
"--disable-nls" \
"--disable-shared" \
"--with-gnu-as" \
"--with-gnu-ld" \
"--enable-install-libbfd" \
"--disable-werror" \
)
GMP=
MPFR=( "--with-gmp=${PREFIX}" )
MPC=( "--with-gmp=${PREFIX}" \
"--with-mpfr=${PREFIX}" \
)
GCC=( "--target=${TARGET}" \
"--with-gmp=${PREFIX}" \
"--with-mpfr=${PREFIX}" \
"--with=mpc=${PREFIX}" \
"--disable-nls" \
"--enable-languages=c" \
"--without-headers" \
"--with-newlib" \
"--with-multilib" \
"--disable-libssp" \
"--disable-shared" \
"--disable-threads" \
)
NEWLIB=( "--host=${TARGET}" )
GCC2=( "--target=${TARGET}" \
"--with-gmp=${PREFIX}/include" \
"--with-mpfr=${PREFIX}/include" \
"--with-mpc=${PREFIX}/include" \
"--disable-nls" \
"--enable-languages=c,c++" \
"--with-newlib" \
"--with-multilib" \
"--disable-libssp" \
"--disable-shared" \
"--disable-threads" \
)
GDB=( "--target=${TARGET}" \
"--with-gmp=${PREFIX}" \
"--with-mpfr=${PREFIX}" \
"--disable-nls" \
"--disable-libssp" \
"--disable-werror" \
)
#### After defining all necessary variables, source the generic part now ####
source "${DIR}/common.sh"