-
Notifications
You must be signed in to change notification settings - Fork 32
/
build_environment_setup.sh
executable file
·143 lines (105 loc) · 3.68 KB
/
build_environment_setup.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
#/bin/sh
# This script will create a folder named "tf" in your home directory,
# clone all of the tinkerforge gits, install all packages to build,
# the Bindings, the distribution zips, the documentation, Brick firmwares,
# Bricklet plugins, Brick Viewer and Brick Daemon.
# You will also be able to open, view and edit the schematics and layouts
# for Bricks and Bricklets as well as the design files of the cases.
# It was tested in a Ubuntu 15.04 VirtualBox image from osboxes.org.
cd ~
sudo apt-get update
# Packages for general use
sudo apt-get -y install python git
# Packages for "generators/generate_all.py"
sudo apt-get -y install php5 # in older Ubuntu there was a package named php5
sudo apt-get -y install php # in newer Ubuntu there is a meta package named php that depends on php7.0
sudo apt-get -y install build-essential mono-complete mono-reference-assemblies-2.0 python3 perl default-jre default-jdk nodejs npm php-pear ruby zip
sudo npm install -g browserify
sudo ln -s /usr/bin/nodejs /usr/local/bin/node
# Packages for "generators/test_all.py"
sudo apt-get -y install libxml2-utils libgd-dev libgd-perl libterm-readkey-perl libb-lint-perl
# Packages for "$:~/doc/ make html"
sudo apt-get -y install python-sphinx python-sphinxcontrib.spelling
# Packages for building and running brickv
sudo apt-get -y install python-qt4 python-qt4-gl python-opengl python-serial python-setuptools pyqt4-dev-tools
# Packages for building and running brickd
sudo apt-get -y install pkg-config libusb-1.0-0-dev libudev-dev pm-utils
# Packages for building Brick firmwares and Bricklet plugins
sudo apt-get -y install cmake gcc-arm-none-eabi
# Packages for hardware development (schematic, layout, case design)
sudo apt-get -y install kicad freecad
# Clone all necessary gits
gitgetter=$(mktemp)
cat > ${gitgetter} <<- EOF
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib2
import json
page = 1
repos = []
names = []
while True:
request = urllib2.urlopen('https://api.github.com/orgs/Tinkerforge/repos?page={0}&per_page=100'.format(page))
data = request.read()
decoded = json.loads(data)
repos += decoded
if len(decoded) < 100:
break
page += 1
for repo in repos:
name = repo['name'].replace('Tinkerforge/', '')
if not name.startswith('red-brick-'):
names.append(name)
print ' '.join(names)
EOF
chmod +x ${gitgetter}
gits=( $(${gitgetter}) )
rm ${gitgetter}
mkdir tf
cd tf
for g in "${gits[@]}"
do
git clone https://github.com/Tinkerforge/$g.git
done
# Generate Bindings and Copy examples to documentation
cd ~/tf/generators/
python generate_all.py
python copy_all.py
# Install additional pygments lexers
cd ~/tf/doc/pygments-mathematica/
sudo python setup.py install
cd ~/tf/doc/pygments-octave-fixed/
sudo python setup.py install
# Generate doc
cd ~/tf/doc/
make html
# Generate brickv GUI
cd ~/tf/brickv/src/
python build_all_ui.py
# Build brickd
cd ~/tf/brickd/src/
ln -s ../../daemonlib/ .
cd ~/tf/brickd/src/brickd/
make
# To show how it works we set up one Brick for use with kicad and one
# Brick as well as one Bricklet to compile with gcc.
# Build Master Brick
cd ~/tf/master-brick/software/src/
ln -s ../../../bricklib/ .
cd ~/tf/master-brick/software/
make
# Build Temperature Bricklet
cd ~/tf/temperature-bricklet/software/src/
ln -s ../../../bricklib/ .
ln -s ../../../brickletlib/ .
cd ~/tf/temperature-bricklet/software/
make
# Set up hardware design files for Master Brick
cd ~/tf/master-brick/hardware/
ln -s ../../kicad-libraries/ .
# To open schematics and layout:
# kicad ~/tf/master-brick/hardware/master.pro
# Cases can be found in ~/tf/cases and directly opend with freecad. e.g.:
# freecad ~/tf/cases/ambient_light/ambient_light.fcstd
cd ~
echo done