-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathinstall-3rdparty-macos-sierra.sh
executable file
·209 lines (172 loc) · 5.42 KB
/
install-3rdparty-macos-sierra.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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
#!/bin/bash
#
# Copyright (C) 2007 National Institute For Space Research (INPE) - Brazil.
#
# This file is part of TerraMA2 - a free and open source computational
# platform for analysis, monitoring, and alert of geo-environmental extremes.
#
# TerraMA2 is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License,
# or (at your option) any later version.
#
# TerraMA2 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 Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with TerraMA2. See LICENSE. If not, write to
# TerraMA2 Team at <[email protected]>.
#
#
# Description: Install all required software for TerraMA2 on MAC OS Sierra.
#
# Author: Gilberto Ribeiro de Queiroz
#
# Example:
# $ ./install-3rdparty-macos-sierra.sh /home/gribeiro/MyLibs /home/gribeiro/MyDevel/terrama2/codebase
#
echo "****************************************"
echo "* TerraMA2 Installer for Mac OS Sierra *"
echo "****************************************"
echo ""
sleep 1s
#
# Used to update the package location at header of generated third parties.
# Usage: fixRPath <arg1>, where arg1 is a list of files (full path) to be fixed.
# Note: used in build proccess of Boost and QWT packages.
#
function fixRPath()
{
_FILES=$1
for _FILE in $_FILES;
do
install_name_tool -id $_FILE $_FILE
for _FILE2 in $_FILES;
do
install_name_tool -change @rpath/`basename "$_FILE"` $_FILE $_FILE2
done
done
}
#
# Used to append informations on build log file.
# Usage: log_lib <arg1>, where arg1 the name of package being logged.
#
function log_lib()
{
echo "=========================================================================" >> build.log
echo "Warnings for $1">> build.log
}
#
# If first argument is false it aborts the script and
# report the message passed as second argument.
#
function valid()
{
if [ $1 -ne 0 ]; then
echo $2
echo ""
exit 1
fi
}
#
# Check installation dir
#
if [ -z "$TERRAMA2_DEPENDENCIES_DIR" ]; then
echo "Please, select the installation folder of the third-party libraries through the variable TERRAMA2_DEPENDENCIES_DIR."
exit
fi
export PATH=$PATH:$HOME/Qt5.4.1/5.4/clang_64/bin:/Applications/CMake.app/Contents/bin
export LD_LIBRARY_PATH="$PATH:$TERRAMA2_DEPENDENCIES_DIR/lib"
echo "installing 3rd-party libraries to '$TERRAMA2_DEPENDENCIES_DIR' ..."
sleep 1s
#
# Brew
#
which -s brew > /dev/null
if [[ $? != 0 ]] ; then
echo "Installing Brew..."
sleep 1s
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi
#
# GnuTLS
#
if [ ! -d "/usr/local/Cellar/gnutls" ]; then
echo "Installing GnuTLS..."
sleep 1s
brew install gnutls > /dev/null 2>> ../build.log
valid $? "Error: could not install GnuTLS!"
fi
#
# GnuSASL
#
gsasl --version > /dev/null
if [[ $? != 0 ]] ; then
echo "Installing GnuSASL..."
sleep 1s
brew install gsasl > /dev/null 2>> ../build.log
valid $? "Error: could not install GnuSASL!"
fi
#
# Quazip
#
if [ ! -f "$TERRAMA2_DEPENDENCIES_DIR/lib/libquazip5.dylib" ]; then
echo "Installing Quazip..."
sleep 1s
log_lib "QUAZIP"
unzip -o quazip-0.7.3.zip &> /dev/null
valid $? "Error: could not uncompress quazip-0.7.3.zip!"
cd quazip-0.7.3 > /dev/null
valid $? "Error: could not enter quazip-0.7.3"
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE:STRING="Release" -DCMAKE_PREFIX_PATH:PATH=${TERRAMA2_DEPENDENCIES_DIR} -DCMAKE_INSTALL_PREFIX=$TERRAMA2_DEPENDENCIES_DIR > /dev/null 2>> ../build.log
valid $? "Error: could not configure Quazip!"
make -j 4 > /dev/null 2>> ../build.log
valid $? "Error: could not make Quazip!"
make install > /dev/null 2>> ../build.log
valid $? "Error: Could not install Quazip!"
cd .. > /dev/null
fixRPath "$TERRAMA2_DEPENDENCIES_DIR/lib/libquazip5.dylib" > /dev/null
fi
#
# VMime
#
if [ ! -f "$TERRAMA2_DEPENDENCIES_DIR/lib/libvmime.dylib" ]; then
echo "Installing VMime..."
sleep 1s
log_lib "VMIME"
unzip -o vmime-master.zip &> /dev/null
valid $? "Error: could not uncompress vmime-master.zip!"
cd vmime-master > /dev/null
valid $? "Error: could not enter vmime-master"
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE:STRING="Release" -DCMAKE_MACOSX_RPATH:BOOL=YES -DCMAKE_PREFIX_PATH:PATH=/usr -DCMAKE_INSTALL_PREFIX=$TERRAMA2_DEPENDENCIES_DIR > /dev/null 2>> ../build.log
valid $? "Error: could not configure VMime!"
make -j 4 > /dev/null 2>> ../build.log
valid $? "Error: could not make VMime!"
make install > /dev/null 2>> ../build.log
valid $? "Error: Could not install VMime!"
cd .. > /dev/null
fixRPath "$TERRAMA2_DEPENDENCIES_DIR/lib/libvmime.1.dylib" > /dev/null
fi
#
# NodeJS
#
node --version > /dev/null
if [[ $? != 0 ]] ; then
echo "Installing NodeJS..."
sleep 1s
curl -O https://nodejs.org/dist/v6.11.3/node-v6.11.3.pkg &> /dev/null
valid $? "Error: could not download nodejs!"
sudo installer -pkg node-v6.11.3.pkg -target /
valid $? "Error: could not install nodejs!"
fi
#
# Finished!
#
echo ""
echo "****************************************"
echo "* TerraMA2 Installer for Mac OS Sierra *"
echo "****************************************"
echo ""
echo "finished successfully!"