forked from firepick1/FireStep
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild
executable file
·134 lines (119 loc) · 3.16 KB
/
build
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
#! /bin/bash
echo
echo "COMMAND : ../FireStep/build"
echo "DATE : `date`"
function help() {
echo "Build FireStep (non-Windows)"
echo
echo "EXAMPLES:"
echo " ./build"
echo
echo "OPTIONS:"
echo " -h"
echo " --help"
echo " Print this help text"
}
while getopts "c:" flag
do
case "$flag" in
*) help ; exit 0;;
esac
done
if [ ! -e Adafruit_NeoPixel ]; then
echo "GIT : git clone https://github.com/adafruit/Adafruit_NeoPixel"
git clone https://github.com/adafruit/Adafruit_NeoPixel
fi
if [ ! -e ArduinoJson ]; then
echo "GIT : git clone https://github.com/firepick1/ArduinoJson.git"
git clone https://github.com/firepick1/ArduinoJson.git
RC=$?; if [ $RC -ne 0 ]; then
echo "ERROR : git clone failed (RC=$RC)"
exit -1
fi
pushd ArduinoJson
cmake .
make clean all
popd
fi
if [ "${MEMORY_MODEL}" == "" ]; then
export MEMORY_MODEL=MEMORY_MODEL_TINY
fi
echo "DEFINE : MEMORY_MODEL=${MEMORY_MODEL}"
if [ ! -e /usr/lib/lib_ph5.so ]; then
echo "GIT : git clone https://github.com/firepick1/ph5.git"
git clone https://github.com/firepick1/ph5.git
RC=$?; if [ $RC -ne 0 ]; then
echo "ERROR : git clone failed (RC=$RC)"
exit -1
fi
fi
if [ "$1" == "" ]; then
pushd ph5
git pull
./build clean all
popd
fi
if [ "$WINDIR" != "" ]; then
echo "SYSTEM : FireStep Windows support is limited to Arduino IDE"
echo "TRY : Copy ArduinoJson to <your-Arduino-sketch-folder>/libraries/ArduinoJson"
echo "TRY : Copy Adafruit_NeoPixel to <your-Arduino-sketch-folder>/libraries/Adafruit_NeoPixel"
echo "TRY : Launch Arduino 1.6.3 IDE and open FireStep/FireStep.ino"
echo "STATUS : build complete"
exit 0;
fi
if [ "$SUDO_USER" != "" ]; then
echo "ERROR : This script will call sudo as required and must be run by non-root user"
echo "TRY : ./build"
exit -1
fi
if [ "$(type -p gcc)" == "" ]; then
echo "COMMAND : pkgin -y install scmgit-base gcc47"
sudo pkgin -y install scmgit-base gcc47
else
echo "STATUS : GCC installed"
fi
if [ "$(type -p cmake)" == "" ]; then
if [ `uname -o` == "Solaris" ]; then
echo "COMMAND : pkgin -y install gmake; pkgin -y install cmake"
sudo pkgin -y install gmake
sudo pkgin -y install cmake
else
echo "COMMAND : apt-get -y install cmake"
sudo apt-get -y install cmake
fi
else
echo "STATUS : cmake installed"
fi
if [ "$(type -p libtool)" == "" ]; then
echo "COMMAND : pkgin -y install libtool"
sudo pkgin -y install libtool
else
echo "STATUS : libtool installed"
fi
if [ "$(type -p aclocal)" == "" ]; then
echo "COMMAND : pkgin -y install automake"
sudo pkgin -y install automake
else
echo "STATUS : automake insalled"
fi
if [ -e CMakeFiles ] ; then
echo "STATUS : removing existing makefiles"
rm -rf core CMakeCache.txt CMakeFiles CMakeFiles.txt target cmake_install.cmake CPackConfig.cmake CPackSourceConfig.cmake
mkdir target
fi
echo "STATUS : creating makefile"
cmake \
-DCMAKE_INSTALL_PREFIX:PATH=$installPrefix "$@" \
.
RC=$?; if [ $RC -ne 0 ]; then
echo "ERROR : cmake failed (RC=$RC)"
exit -1
fi
make
RC=$?; if [ $RC -ne 0 ]; then
echo "ERROR : make failed (RC=$RC)"
exit -1
fi
echo "----------------------------------"
echo "DATE : `date`"
echo "SUCCESS : FireStep compiled"