forked from arduino/avrdude-build-script
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpackage-avrdude.bash
executable file
·99 lines (77 loc) · 2.99 KB
/
package-avrdude.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#!/bin/bash -ex
# Copyright (c) 2014-2016 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.
OUTPUT_VERSION=6.3.0-arduino9
export OS=`uname -o || uname`
export TARGET_OS=$OS
if [[ $CROSS_COMPILE == "mingw" ]] ; then
export CC="i686-w64-mingw32-gcc"
export CXX="i686-w64-mingw32-g++"
export CROSS_COMPILE_HOST="i686-w64-mingw32"
export TARGET_OS="Windows"
OUTPUT_TAG=i686-w64-mingw32
elif [[ $OS == "GNU/Linux" ]] ; then
export MACHINE=`uname -m`
if [[ $MACHINE == "x86_64" ]] ; then
OUTPUT_TAG=x86_64-pc-linux-gnu
elif [[ $MACHINE == "i686" ]] ; then
OUTPUT_TAG=i686-pc-linux-gnu
elif [[ $MACHINE == "armv7l" ]] ; then
OUTPUT_TAG=armhf-pc-linux-gnu
elif [[ $MACHINE == "aarch64" ]] ; then
OUTPUT_TAG=aarch64-pc-linux-gnu
else
echo Linux Machine not supported: $MACHINE
exit 1
fi
elif [[ $OS == "Msys" || $OS == "Cygwin" ]] ; then
echo *************************************************************
echo WARNING: Build on native Cygwin or Msys has been discontinued
echo you may experience build failure or weird behaviour
echo *************************************************************
export PATH=$PATH:/c/MinGW/bin/:/c/cygwin/bin/
export CC="mingw32-gcc -m32"
export CXX="mingw32-g++ -m32"
export TARGET_OS="Windows"
OUTPUT_TAG=i686-mingw32
elif [[ $OS == "Darwin" ]] ; then
export PATH=/opt/local/libexec/gnubin/:/opt/local/bin:$PATH
export CC="gcc -arch i386 -mmacosx-version-min=10.5"
export CXX="g++ -arch i386 -mmacosx-version-min=10.5"
OUTPUT_TAG=i386-apple-darwin11
else
echo OS Not supported: $OS
exit 2
fi
rm -rf avrdude-6.3 libusb-1.0.20 libusb-compat-0.1.5 libusb-win32-bin-1.2.6.0 libelf-0.8.13 objdir
./libusb-1.0.20.build.bash
./libusb-compat-0.1.5.build.bash
./libelf-0.8.13.build.bash
./avrdude-6.3.build.bash
# if producing a windows build, compress as zip and
# copy *toolchain-precompiled* content to any folder containing a .exe
if [[ ${OUTPUT_TAG} == *"mingw"* ]] ; then
cp libusb-win32-bin-1.2.6.0/bin/x86/libusb0_x86.dll objdir/bin/libusb0.dll
rm -f avrdude-${OUTPUT_VERSION}-${OUTPUT_TAG}.zip
cp -a objdir avrdude
zip -r avrdude-${OUTPUT_VERSION}-${OUTPUT_TAG}.zip avrdude
rm -r avrdude
else
rm -f avrdude-${OUTPUT_VERSION}-${OUTPUT_TAG}.tar.bz2
cp -a objdir avrdude
tar -cjvf avrdude-${OUTPUT_VERSION}-${OUTPUT_TAG}.tar.bz2 avrdude
rm -r avrdude
fi