forked from joaopizani/multiarch-toolchain-buildscripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_avr_toolchain.sh
executable file
·81 lines (62 loc) · 3.22 KB
/
build_avr_toolchain.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
#!/bin/bash
# Toolchain buildscript
# This script requires TWO command-line parameters: the number of threads for make and the
# directory under which all tools are going to be installed.
# 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
THREADS="-j $1" # DON'T CHANGE
BUILD_HOME=$2 # DON'T CHANGE
# if you want less messages from compilation in your output, use SILENT_BUILD=1
SILENT_BUILD=
# use the GCC target name for the desired architecture here, i.e, "avr", "mips-elf", etc.
TARGET=avr
# You should probably use the most recent stable versions... but sometimes you need
# a bit more research...
BINUTILS_VERSION=2.22
GMP_VERSION=5.0.4
MPFR_VERSION=3.1.0
MPC_VERSION=0.9
GCC_VERSION=4.7.1
AVRLIBC_VERSION=1.8.0
SIMULAVR_VERSION=1.0.0
GDB_VERSION=7.4.1
AVRDUDE_VERSION=5.11.1
# Optional editing: only if some site has changed
BINUTILS_SITE=http://ftp.gnu.org/gnu/binutils
GMP_SITE=ftp://ftp.gmplib.org/pub/gmp-$GMP_VERSION
MPFR_SITE=http://mpfr.loria.fr/mpfr-current
MPC_SITE=http://www.multiprecision.org/mpc/download
GCC_SITE=http://gnu.c3sl.ufpr.br/ftp/gcc/gcc-$GCC_VERSION
AVRLIBC_SITE=http://download.savannah.gnu.org/releases/avr-libc
SIMULAVR_SITE=http://download.savannah.gnu.org/releases/simulavr
GDB_SITE=http://ftp.gnu.org/gnu/gdb
AVRDUDE_SITE=http://savannah.c3sl.ufpr.br/avrdude
#### CAREFUL EDITING FROM HERE ON ####
PREFIX=$BUILD_HOME/$TARGET/gcc-$GCC_VERSION
BINUTILS=binutils-$BINUTILS_VERSION
GMP=gmp-$GMP_VERSION
MPFR=mpfr-$MPFR_VERSION
MPC=mpc-$MPC_VERSION
GCC=gcc-$GCC_VERSION
AVRLIBC=avr-libc-$AVRLIBC_VERSION
SIMULAVR=simulavr-$SIMULAVR_VERSION
GDB=gdb-$GDB_VERSION
AVRDUDE=avrdude-$AVRDUDE_VERSION
PACKLITERALS=( '$BINUTILS' '$GMP' '$MPFR' '$MPC' '$GCC' '$AVRLIBC' '$SIMULAVR' '$GDB' '$AVRDUDE')
PACKEXTENSIONS=('.tar.gz' '.tar.bz2' '.tar.gz' '.tar.gz' '.tar.gz' '.tar.bz2' '.tar.gz' '.tar.gz' '.tar.gz')
TASKLITERALS='$BINUTILS $GMP $MPFR $MPC $GCC $AVRLIBC $GCC $SIMULAVR $GDB $AVRDUDE' # 2 GCC tasks (bootstrap)
# Configure options for all packages. Change only if the "reasonable" defaults don't work
BINUTILS_OPT="--target=$TARGET --disable-nls --disable-shared --disable-threads --with-gcc --with-gnu-as --with-gnu-ld --enable-install-libbfd --enable-install-libiberty --disable-werror"
GMP_OPT=""
MPFR_OPT="--with-gmp=$PREFIX"
MPC_OPT="--with-gmp=$PREFIX --with-mpfr=$PREFIX"
GCC_OPT="--target=$TARGET --with-mpfr=$PREFIX --with-mpc=$PREFIX --disable-nls --enable-languages=c --without-headers --with-multilib --disable-libssp --disable-shared --disable-threads"
AVRLIBC_OPT="--host=$TARGET"
GCC_2_OPT="--target=$TARGET --with-mpfr=$PREFIX --with-mpc=$PREFIX --disable-nls --enable-languages=c,c++ --with-multilib --disable-libssp --disable-shared --disable-threads"
SIMULAVR_OPT="--with-bfd=$PREFIX/i686-pc-linux-gnu/avr --with-libiberty=$PREFIX/lib CFLAGS=-Wno-error"
GDB_OPT="--target=$TARGET --with-gmp=$PREFIX --with-mpfr=$PREFIX --disable-nls --disable-libssp --disable-werror"
AVRDUDE_OPT="--target=$TARGET"
#### After defining all necessary variables, source the generic build script now ####
source ./build_toolchain.sh