forked from pioneers/tenshi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_build_deps.sh
executable file
·149 lines (116 loc) · 4.03 KB
/
install_build_deps.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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#!/bin/bash -e
# Licensed to Pioneers in Engineering under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Pioneers in Engineering licenses
# this file to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License
#
# This script will install packages required to build tenshi on Ubuntu
#
## Ubuntu version checking
[[ -f /etc/lsb-release ]] || {
cat <<EOF
This script is designed to run on Ubuntu only.
Ubuntu version detection failed, so it cannot run. Please install build
dependencies manually.
EOF
exit 1
}
source /etc/lsb-release
[[ "$DISTRIB_ID" = "Ubuntu" ]] || {
cat <<EOF
This script is designed to run on Ubuntu only.
Please install build dependencies manually on your system.
EOF
exit 1
}
case "$DISTRIB_CODENAME" in
trusty|saucy)
echo "Installing build dependencies for $DISTRIB_ID $DISTRIB_RELEASE ($DISTRIB_CODENAME)"
;;
*)
echo "This script has not been tested on $DISTRIB_ID $DISTRIB_RELEASE ($DISTRIB_CODENAME)"
echo -n "Continue? [y/N]"
read answer
if [ "x$answer" = "xY" ] || [ "x$answer" = "xy" ]; then
:
else
exit 1
fi
;;
esac
## Set up temporary directory for downloads
TMPDIR="/tmp/tenshi-build-dep.$$"
mkdir "$TMPDIR"
pushd "$TMPDIR"
## Make sure to cleanup if aborted
trap 'popd; rm -rf $TMPDIR; exit 15' 1 2 3 15
## Install misc dependencies
sudo apt-get install xvfb openjdk-7-jre-headless coreutils build-essential gcc-multilib
## Install Python and related
which pip >/dev/null || {
sudo apt-get install python-pip
}
sudo pip install pyyaml pep8
## Install nodejs and related
which node >/dev/null || {
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs
}
sudo npm install jshint csslint -g
## Install atmel toolchain
### Dependency for the toolchain
dpkg -s libmpc2 >/dev/null || {
wget http://launchpadlibrarian.net/118496223/libmpc2_0.9-4build1_amd64.deb
sudo dpkg -i libmpc2_0.9-4build1_amd64.deb
}
dpkg -s atmel-toolchain-binutils-avr atmel-toolchain-gcc-avr atmel-toolchain-avr-libc > /dev/null || {
### Set up PPA
sudo add-apt-repository ppa:nonolith/avr-toolchain
if [ -f /etc/apt/sources.list.d/nonolith-avr-toolchain-trusty.list ]; then
# The PPA is not currently up-to-date for Ubuntu 14.04, so use the
# 13.10 sources instead
sed "s/trusty/saucy/g" /etc/apt/sources.list.d/nonolith-avr-toolchain-trusty.list > nonolith-avr-toolchain-trusty.list
sudo mv nonolith-avr-toolchain-trusty.list /etc/apt/sources.list.d
fi
sudo apt-get update
### Toolchain installation
sudo apt-get install atmel-toolchain-binutils-avr atmel-toolchain-gcc-avr atmel-toolchain-avr-libc
}
## Install eagle
### Check for existing eagle instalation
EAGLE_INSTALLED=0
which eagle && EAGLE_INSTALLED=1
[ -x /opt/eagle-6.5.0/bin/eagle ] && EAGLE_INSTALLED=1
### If there is no existing installation, install eagle
if [[ "$EAGLE_INSTALLED" = 0 ]]; then
sudo apt-get install libxrender1:i386 libxrandr2:i386 libxcursor1:i386 libfreetype6:i386 libfontconfig1:i386 libxi6:i386 libpng12-0:i386 libstdc++6:i386 libjpeg62:i386 libssl1.0.0:i386
wget ftp://ftp.cadsoft.de/eagle/program/6.5/eagle-lin-6.5.0.run
chmod +x eagle-lin-6.5.0.run
sudo ./eagle-lin-6.5.0.run
fi
## Cleanup
popd
rm -rf $TMPDIR
## Pre-run tool extraction to avoid downloads later
[ -f "tools/extract-tools.sh" ] && tools/extract-tools.sh
## Run eagle
which ealge && eagle
[ -x /opt/eagle-6.5.0/bin/eagle ] && /opt/eagle-6.5.0/bin/eagle
## Run emcc
. tools/begin-build.sh
emcc
## Done
echo "Done: build dependencies have been installed"