forked from arduino/toolchain-avr
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathavr-libc.build.bash
executable file
·82 lines (63 loc) · 2.08 KB
/
avr-libc.build.bash
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 -ex
# Copyright (c) 2014-2015 Arduino LLC
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
if [[ ! -d toolsdir ]] ;
then
echo "You must first build the tools: run build_tools.bash"
exit 1
fi
cd toolsdir/bin
TOOLS_BIN_PATH=`pwd`
cd -
export PATH="$TOOLS_BIN_PATH:$PATH"
if [[ ! -f avr-libc-1.8.0.tar.bz2 ]] ;
then
wget http://download.savannah.gnu.org/releases/avr-libc/avr-libc-1.8.0.tar.bz2
fi
tar xfv avr-libc-1.8.0.tar.bz2
cd avr-libc-1.8.0
for p in ../avr-libc-patches/*.patch; do echo Applying $p; patch --binary -p1 < $p; done
cd -
if [[ ! -f avr8-headers-6.2.0.469.zip ]] ;
then
wget http://distribute.atmel.no/tools/opensource/Atmel-AVR-GNU-Toolchain/3.4.5/avr8-headers-6.2.0.469.zip
fi
unzip avr8-headers-6.2.0.469.zip
mv avr avr8-headers-6.2.0.469
for i in avr8-headers-6.2.0.469/io[0-9a-zA-Z]*.h
do
cp -v -f $i avr-libc-1.8.0/include/avr/
done
cd avr-libc-1.8.0
./bootstrap
cd -
mkdir -p objdir
cd objdir
PREFIX=`pwd`
cd -
mkdir -p avr-libc-build
cd avr-libc-build
CONFARGS=" \
--prefix=$PREFIX \
--host=avr \
--disable-doc"
PATH=$PREFIX/bin:$PATH CC="avr-gcc" CXX="avr-g++" CFLAGS="-w -Os $CFLAGS" CXXFLAGS="-w -Os $CXXFLAGS" LDFLAGS="-s $LDFLAGS" ../avr-libc-1.8.0/configure $CONFARGS
for p in ../avr-libc-patches/*.patch.post.automake; do echo Applying $p; patch -p1 < $p; done
if [ -z "$MAKE_JOBS" ]; then
MAKE_JOBS="2"
fi
PATH=$PREFIX/bin:$PATH nice -n 10 make -j $MAKE_JOBS
PATH=$PREFIX/bin:$PATH make install