Blame view

install/install-3rdparty-macos-sierra.sh 40.1 KB
Carolina Galvão committed
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
#!/bin/bash
#
#  Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
#
#  This file is part of the TerraLib - a Framework for building GIS enabled applications.
#
#  TerraLib 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.
#
#  TerraLib 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 TerraLib. See COPYING. If not, write to
#  TerraLib Team at <terralib-team@terralib.org>.
#
#
#  Description: Install all required software for TerraLib/TerraView on MAC OS Sierra.
#
#  Author: Gilberto Ribeiro de Queiroz
#  Author: Carolina Galvão dos Santos
#
#  Example:
#  $ TERRALIB_DEPENDENCIES_DIR="/Users/gribeiro/MyLibs" ./install-3rdparty-macos-sierra.sh
#

clear

echo "****************************************"
echo "* TerraLib 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()
{
raphael.costa committed
46 47
  _FILES=$1

Carolina Galvão committed
48 49 50
  for _FILE in $_FILES;
  do
    install_name_tool -id $_FILE $_FILE
raphael.costa committed
51

Carolina Galvão committed
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
    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
  fi
}


#
# Check for terralib-3rdparty-macos-sierra.tar.gz
#
if [ ! -f ./terralib-3rdparty-macos-sierra.tar.gz ]; then
  echo "Please, make sure to have terralib-3rdparty-macos-sierra.tar.gz in the current directory!"
  exit
fi


#
# Extract packages
#
echo "extracting packages..."
sleep 1s

tar xzvf terralib-3rdparty-macos-sierra.tar.gz > /dev/null 2> /dev/null
valid $? "Error: could not extract 3rd party libraries (terralib-3rdparty-macos-sierra.tar.gz)"

echo "packages extracted!"
sleep 1s


#
# Go to 3rd party libraries dir
#
cd terralib-3rdparty-macos-sierra > /dev/null
valid $? "Error: could not enter 3rd-party libraries dir (terralib-3rdparty-macos-sierra)"


#
# Check installation dir
#
if [ "$TERRALIB_DEPENDENCIES_DIR" == "" ]; then
  TERRALIB_DEPENDENCIES_DIR="/opt/terralib"
fi

export PATH="$PATH:$TERRALIB_DEPENDENCIES_DIR/bin"
export LD_LIBRARY_PATH="$PATH:$TERRALIB_DEPENDENCIES_DIR/lib"

echo "installing 3rd-party libraries to '$TERRALIB_DEPENDENCIES_DIR' ..."
sleep 1s


#
# PCRE version 8.37
# Site: http://www.pcre.org
#
if [ ! -f "$TERRALIB_DEPENDENCIES_DIR/lib/libpcre.a" ]; then
  echo "installing PCRE..."
raphael.costa committed
132 133
  log_lib "PCRE"

Carolina Galvão committed
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155
  sleep 1s

  tar xzvf pcre-8.37.tar.gz > /dev/null 2> /dev/null
  valid $? "Error: could not uncompress pcre-8.37.tar.gz!"

  cd pcre-8.37 > /dev/null
  valid $? "Error: could not enter pcre-8.32 dir!"

  ./configure --prefix=$TERRALIB_DEPENDENCIES_DIR > /dev/null 2>> ../build.log
  valid $? "Error: could not configure PCRE!"

  make -j 4 > /dev/null 2>> ../build.log
  valid $? "Error: could not make PCRE!"

  make install > /dev/null 2>> ../build.log
  valid $? "Error: Could not install PCRE!"

  cd .. > /dev/null
fi


#
Carolina Galvão committed
156
# SWIG version 3.0.12
Carolina Galvão committed
157 158 159 160
# Site: http://www.swig.org
#
if [ ! -f "$TERRALIB_DEPENDENCIES_DIR/bin/swig" ]; then
  echo "installing SWIG..."
raphael.costa committed
161
  log_lib "SWIG"
Carolina Galvão committed
162 163 164

  sleep 1s

Carolina Galvão committed
165 166
  tar xzvf swig-3.0.12.tar.gz > /dev/null 2> /dev/null
  valid $? "Error: could not uncompress swig-3.0.12.tar.gz!"
Carolina Galvão committed
167

Carolina Galvão committed
168 169
  cd swig-3.0.12 > /dev/null
  valid $? "Error: could not enter swig-3.0.12 dir!"
Carolina Galvão committed
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189

  ./configure --prefix=$TERRALIB_DEPENDENCIES_DIR --with-pcre-prefix=$TERRALIB_DEPENDENCIES_DIR > /dev/null 2>> ../build.log
  valid $? "Error: could not configure SWIG!"

  make -j 4 > /dev/null 2>> ../build.log
  valid $? "Error: could not make SWIG!"

  make install > /dev/null 2>> ../build.log
  valid $? "Error: Could not install SWIG!"

  cd .. > /dev/null
fi


#
# FreeXL version 1.0.1
# Site: https://www.gaia-gis.it/fossil/freexl/index
#
if [ ! -f "$TERRALIB_DEPENDENCIES_DIR/lib/libfreexl.dylib" ]; then
  echo "installing FreeXL..."
raphael.costa committed
190
  log_lib "FreeXL"
Carolina Galvão committed
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218

  sleep 1s

  tar xzvf freexl-1.0.1.tar.gz > /dev/null 2> /dev/null
  valid $? "Error: could not uncompress freexl-1.0.1.tar.gz!"

  cd freexl-1.0.1 > /dev/null
  valid $? "Error: could not enter freexl-1.0.1 dir!"

  CPPFLAGS=-I$TERRALIB_DEPENDENCIES_DIR/include LDFLAGS=-L$TERRALIB_DEPENDENCIES_DIR/lib ./configure --prefix=$TERRALIB_DEPENDENCIES_DIR > /dev/null 2>> ../build.log
  valid $? "Error: could not configure FreeXL!"

  make -j 4 > /dev/null 2>> ../build.log
  valid $? "Error: could not make FreeXL!"

  make install > /dev/null 2>> ../build.log
  valid $? "Error: Could not install FreeXL!"

  cd .. > /dev/null
fi


#
# OOSP-UUID version 1.6.2
# Site: http://www.ossp.org/pkg/lib/uuid/
#
if [ ! -f "$TERRALIB_DEPENDENCIES_DIR/lib/libuuid.dylib" ]; then
  echo "installing OOSP-UUID..."
raphael.costa committed
219
  log_lib "OOSP-UUID"
Carolina Galvão committed
220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247

  sleep 1s

  tar xvf uuid-1.6.2.tar > /dev/null 2> /dev/null
  valid $? "Error: could not uncompress uuid-1.6.2.tar!"

  cd uuid-1.6.2 > /dev/null
  valid $? "Error: could not enter uuid-1.6.2 dir!"

  ./configure --prefix=$TERRALIB_DEPENDENCIES_DIR --with-cxx > /dev/null 2>> ../build.log
  valid $? "Error: could not configure OOSP-UUID!"

  make -j 4 > /dev/null 2>> ../build.log
  valid $? "Error: could not make OOSP-UUID!"

  make install > /dev/null 2>> ../build.log
  valid $? "Error: Could not install OOSP-UUID!"

  cd .. > /dev/null
fi


#
# BZIP2 verson 1.0.6
# Site: http://www.bzip.org
#
if [ ! -f "$TERRALIB_DEPENDENCIES_DIR/lib/libbz2.a" ]; then
  echo "installing bzip2..."
raphael.costa committed
248
  log_lib "bzip2"
Carolina Galvão committed
249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268

  sleep 1s

  tar xzvf bzip2-1.0.6.tar.gz > /dev/null 2> /dev/null
  valid $? "Error: could not uncompress bzip2-1.0.6.tar.gz!"

  cd bzip2-1.0.6 > /dev/null
  valid $? "Error: could not enter bzip2-1.0.6 dir!"

  make > /dev/null 2>> ../build.log
  valid $? "Error: could not make BZIP2!"

  make install PREFIX=$TERRALIB_DEPENDENCIES_DIR > /dev/null 2>> ../build.log
  valid $? "Error: Could not install BZIP2!"

  cd .. > /dev/null
fi


#
269 270
# Minizip version 1.3.1
# Site: http://www.winimage.com/zLibDll/minizip.html
Rodrigo Avancini committed
271
#
272 273 274
if [ ! -f "$TERRALIB_DEPENDENCIES_DIR/lib/libminizip.a" ]; then
  echo "installing minizip..."
  log_lib "minizip"
Rodrigo Avancini committed
275 276 277

  sleep 1s

278 279
  tar xzvf zlib-1.2.11.tar.gz > /dev/null 2> /dev/null
  valid $? "Error: could not uncompress zlib-1.2.11.tar.gz!"
Rodrigo Avancini committed
280

281 282
  cd zlib-1.2.11 > /dev/null
  valid $? "Error: could not enter minizip!"
Rodrigo Avancini committed
283

284 285
  CPPFLAGS=-I$TERRALIB_DEPENDENCIES_DIR/include LDFLAGS=-L$TERRALIB_DEPENDENCIES_DIR/lib ./configure --prefix=$TERRALIB_DEPENDENCIES_DIR > /dev/null 2>> ../build.log
  valid $? "Error: could not configure minizip!"
Rodrigo Avancini committed
286

287 288
  make > /dev/null 2>> ../build.log
  valid $? "Error: Could not make minizip"
Rodrigo Avancini committed
289 290 291

  make install > /dev/null 2>> ../build.log

292 293 294 295 296 297 298 299 300
  valid $? "Error: Could not install minizip"

  cd contrib/minizip > /dev/null
  valid $? "Error: could not enter minizip!"

  make -j 4 > /dev/null 2>> ../build.log
  valid $? "Error: could not make minizip"

  cd ../../.. > /dev/null
Rodrigo Avancini committed
301 302 303 304
fi


#
305 306
# OpenSSL version 1.1.1g
# Site: https://github.com/openssl/openssl/releases
Carolina Galvão committed
307
#
308 309
if [ ! -f "$TERRALIB_DEPENDENCIES_DIR/lib/libssl.dylib" ]; then
  echo "installing OpenSSL..."
Carolina Galvão committed
310 311
  sleep 1s

312 313
  tar xzvf openssl-1.1.1g.tar.gz > /dev/null 2> /dev/null
  valid $? "Error: could not uncompress openssl-1.1.1g.tar.gz!"
Carolina Galvão committed
314

315 316
  cd openssl-1.1.1g > /dev/null 2> /dev/null
  valid $? "Error: could not enter openssl-1.1.1g!"
Carolina Galvão committed
317

318 319
  ./config --prefix=$TERRALIB_DEPENDENCIES_DIR shared -fPIC zlib-dynamic no-asm no-gost --with-zlib-include=$TERRALIB_DEPENDENCIES_DIR/include > /dev/null 2> /dev/null
  valid $? "Error: could not configure OpenSSL!"
Rodrigo Avancini committed
320

321 322
  make -j 4 > /dev/null 2> /dev/null
  valid $? "Error: could not make OpenSSL!"
Carolina Galvão committed
323

324 325
  CONFIG_OPTS="--strict-warnings zlib" make test > /dev/null 2> /dev/null
  valid $? "Error: could not test OpenSSL!"
Rodrigo Avancini committed
326

327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355
  make install > /dev/null 2> /dev/null
  valid $? "Error: Could not install OpenSSL!"

  cd ..
fi



#
# SQLite version 3.32.3
# Site: https://www.sqlite.org
#
if [ ! -f "$TERRALIB_DEPENDENCIES_DIR/lib/libsqlite3.dylib" ]; then
  echo "installing SQLite..."
  log_lib "SQLite"

  sleep 1s

  tar xzvf sqlite-autoconf-3320300.tar.gz > /dev/null 2> /dev/null
  valid $? "Error: could not uncompress sqlite-autoconf-3320300.tar.gz!"

  cd sqlite-autoconf-3320300 > /dev/null
  valid $? "Error: could not enter sqlite-autoconf-3320300!"

  CFLAGS="-DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_RTREE -DSQLITE_SOUNDEX -DSQLITE_THREADSAFE=2" ./configure --prefix=$TERRALIB_DEPENDENCIES_DIR > /dev/null 2>> ../build.log
  valid $? "Error: could not configure sqlite!"

  make -j 4 > /dev/null 2>> ../build.log
  valid $? "Error: could not make sqlite"
Carolina Galvão committed
356 357

  make install > /dev/null 2>> ../build.log
358
  valid $? "Error: Could not install sqlite"
Carolina Galvão committed
359

360
 cd .. > /dev/null
Carolina Galvão committed
361 362 363
fi


364

Carolina Galvão committed
365
#
366 367
# CURL version 7.71.1
# Site: http://curl.haxx.se/libcurl/
Carolina Galvão committed
368
#
369 370 371
if [ ! -f "$TERRALIB_DEPENDENCIES_DIR/lib/libcurl.dylib" ]; then
  echo "installing CURL..."
  log_lib "CURL"
Carolina Galvão committed
372 373 374

  sleep 1s

375 376
  tar xzvf curl-7.71.1.tar.gz > /dev/null 2> /dev/null
  valid $? "Error: could not uncompress curl-7.71.1.tar.gz!"
Carolina Galvão committed
377

378 379
  cd curl-7.71.1 > /dev/null
  valid $? "Error: could not enter curl-7.71.1!"
Carolina Galvão committed
380

381 382
  ./configure --prefix=$TERRALIB_DEPENDENCIES_DIR --with-ssl=$TERRALIB_DEPENDENCIES_DIR --with-zlib --libdir=$TERRALIB_DEPENDENCIES_DIR/lib > /dev/null 2>> ../build.log
  valid $? "Error: could not configure CURL!"
Carolina Galvão committed
383 384

  make -j 4 > /dev/null 2>> ../build.log
385
  valid $? "Error: could not make CURL!"
Carolina Galvão committed
386 387

  make install > /dev/null 2>> ../build.log
388
  valid $? "Error: Could not install CURL!"
Carolina Galvão committed
389 390 391 392 393

  cd .. > /dev/null
fi


394 395


Carolina Galvão committed
396 397 398 399 400 401
#
# libPNG version 1.5.17
# Site: http://www.libpng.org/pub/png/libpng.html
#
if [ ! -f "$TERRALIB_DEPENDENCIES_DIR/lib/libpng.dylib" ]; then
  echo "installing libPNG..."
raphael.costa committed
402
  log_lib "libPNG"
Carolina Galvão committed
403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423

  sleep 1s

  tar xzvf libpng-1.5.17.tar.gz > /dev/null 2> /dev/null
  valid $? "Error: could not uncompress libpng-1.5.17.tar.gz!"

  cd libpng-1.5.17 > /dev/null
  valid $? "Error: could not enter libpng-1.5.17 dir!"

  ./configure --prefix=$TERRALIB_DEPENDENCIES_DIR > /dev/null 2>> ../build.log
  valid $? "Error: could not configure libPNG!"

  make -j 4 > /dev/null 2>> ../build.log
  valid $? "Error: could not make libPNG!"

  make install > /dev/null 2>> ../build.log
  valid $? "Error: Could not install libPNG!"

  cd .. > /dev/null
fi

Hugo Richard Gomes Vieira committed
424
#
425
# lib openjpeg version 2.3.1
Hugo Richard Gomes Vieira committed
426 427 428 429 430 431 432 433
# Site: https://www.openjpeg.org/
#

if [ ! -f "$TERRALIB_DEPENDENCIES_DIR/lib/libopenjp2.dylib" ]; then
  echo "installing openjpeg..."
  echo ""
  sleep 1s

434 435
  tar xzvf openjpeg-2.3.1.tar.gz > /dev/null 2> /dev/null
  valid $? "Error: could not uncompress openjpeg-2.3.1.tar.gz!"
Hugo Richard Gomes Vieira committed
436

437 438
  cd openjpeg-2.3.1 > /dev/null
  valid $? "Error: could not enter openjpeg-2.3.1 dir!"
Hugo Richard Gomes Vieira committed
439

Rodrigo Avancini committed
440
  cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE="Release" -DCMAKE_INSTALL_PREFIX=${TERRALIB_DEPENDENCIES_DIR} > /dev/null 2>> ../build.log
Hugo Richard Gomes Vieira committed
441 442
  valid $? "Error: could not configure openjpeg!"

Rodrigo Avancini committed
443
  make -j 4 > /dev/null 2>> ../build.log
Hugo Richard Gomes Vieira committed
444 445
  valid $? "Error: could not make openjpeg!"

Rodrigo Avancini committed
446
  make install > /dev/null 2>> ../build.log
Hugo Richard Gomes Vieira committed
447 448 449 450
  valid $? "Error: Could not install openjpeg!"

  cd ..
fi
Carolina Galvão committed
451 452 453

#
# Independent JPEG Group version v9a
454
# Site: http://www.ijg.orgs
Carolina Galvão committed
455 456 457
#
if [ ! -f "$TERRALIB_DEPENDENCIES_DIR/lib/libjpeg.dylib" ]; then
  echo "installing Independent JPEG Group Library..."
raphael.costa committed
458
  log_lib "JPEG"
Carolina Galvão committed
459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480

  sleep 1s

  tar xzvf jpegsrc.v9a.tar.gz > /dev/null 2> /dev/null
  valid $? "Error: could not uncompress jpegsrc.v9a.tar.gz!"

  cd jpeg-9a > /dev/null
  valid $? "Error: could not enter jpeg-9a dir!"

  ./configure --prefix=$TERRALIB_DEPENDENCIES_DIR > /dev/null 2>> ../build.log
  valid $? "Error: could not configure JPEG!"

  make -j 4 > /dev/null 2>> ../build.log
  valid $? "Error: could not make JPEG!"

  make install > /dev/null 2>> ../build.log
  valid $? "Error: Could not install JPEG!"

  cd .. > /dev/null
fi

#
481
# TIFF version 4.1.0
Carolina Galvão committed
482 483 484
#
if [ ! -f "$TERRALIB_DEPENDENCIES_DIR/lib/libtiff.dylib" ]; then
  echo "installing TIFF..."
raphael.costa committed
485
  log_lib "TIFF"
Carolina Galvão committed
486 487 488

  sleep 1s

489 490
  tar xzvf tiff-4.1.0.tar.gz > /dev/null 2> /dev/null
  valid $? "Error: could not uncompress tiff-4.1.0.tar.gz!"
Carolina Galvão committed
491

492 493
  cd tiff-4.1.0 > /dev/null
  valid $? "Error: could not enter tiff-4.1.0!"
Carolina Galvão committed
494 495 496 497 498 499 500 501 502 503 504 505 506

  ./configure --enable-cxx --with-jpeg-include-dir=$TERRALIB_DEPENDENCIES_DIR/include --with-jpeg-lib-dir=$TERRALIB_DEPENDENCIES_DIR/lib --prefix=$TERRALIB_DEPENDENCIES_DIR > /dev/null 2>> ../build.log
  valid $? "Error: could not configure TIFF!"

  make -j 4 > /dev/null 2>> ../build.log
  valid $? "Error: could not make TIFF!"

  make install > /dev/null 2>> ../build.log
  valid $? "Error: Could not install TIFF!"

  cd .. > /dev/null
fi

507 508
# Proj version 7.1.0
# Site: https://proj.org
Carolina Galvão committed
509
#
510 511 512
if [ ! -f "$TERRALIB_DEPENDENCIES_DIR/lib/libproj.dylib" ]; then
  echo "installing Proj..."
  log_lib "Proj"
Carolina Galvão committed
513 514 515

  sleep 1s

516 517
  tar xzvf proj-7.1.0.tar.gz > /dev/null 2> /dev/null
  valid $? "Error: could not uncompress proj-7.1.0.tar.gz!"
Carolina Galvão committed
518

519 520
  cd proj-7.1.0 > /dev/null
  valid $? "Error: could not enter proj-7.1.0 dir!"
Carolina Galvão committed
521

522 523 524
  mkdir cmake-build > /dev/null
  cd cmake-build > /dev/null

525
  cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${TERRALIB_DEPENDENCIES_DIR} -DSQLITE3_INCLUDE_DIR=${TERRALIB_DEPENDENCIES_DIR}/include -DSQLITE3_LIBRARY=${TERRALIB_DEPENDENCIES_DIR}/lib/libsqlite3.dylib -DTIFF_LIBRARY=${TERRALIB_DEPENDENCIES_DIR}/lib/libtiff.dylib -DTIFF_INCLUDE_DIR=$TERRALIB_DEPENDENCIES_DIR/include -DBUILD_TESTING=OFF -DBUILD_PROJ=ON -DBUILD_PROJINFO=ON -DENABLE_CURL=ON -DCURL_LIBRARY=${TERRALIB_DEPENDENCIES_DIR}/lib/libcurl.dylib -DCURL_INCLUDE_DIR=${TERRALIB_DEPENDENCIES_DIR}/include  .. > /dev/null 2>> ../build.log
526
  valid $? "Error: could not configure Proj!"
Carolina Galvão committed
527 528

  make -j 4 > /dev/null 2>> ../build.log
529 530 531 532
  valid $? "Error: could not make Proj!"

  ctest > /dev/null 2>> ../build.log
  valid $? "Error: Proj tests fail!"
Carolina Galvão committed
533 534

  make install > /dev/null 2>> ../build.log
535
  valid $? "Error: Could not install Proj!"
Carolina Galvão committed
536

537
  cd ../.. > /dev/null
Carolina Galvão committed
538 539 540 541
fi


#
542 543
# GEOS version 3.8.1
# Site: http://geos.osgeo.org
Carolina Galvão committed
544
#
545 546 547
if [ ! -f "$TERRALIB_DEPENDENCIES_DIR/lib/libgeos.dylib" ]; then
  echo "installing GEOS..."
  log_lib "GEOS"
Carolina Galvão committed
548 549 550

  sleep 1s

551 552
  tar xjvf geos-3.8.1.tar.bz2 > /dev/null 2> /dev/null
  valid $? "Error: could not uncompress geos-3.8.1.tar.bz2!"
Carolina Galvão committed
553

554 555
  cd geos-3.8.1 > /dev/null
  valid $? "Error: could not enter geos-3.8.1 dir!"
Carolina Galvão committed
556

Rodrigo Avancini committed
557
  ./configure --prefix=$TERRALIB_DEPENDENCIES_DIR > /dev/null 2>> ../build.log
558
  valid $? "Error: could not configure GEOS!"
Carolina Galvão committed
559 560

  make -j 4 > /dev/null 2>> ../build.log
561
  valid $? "Error: could not make GEOS!"
Carolina Galvão committed
562 563

  make install > /dev/null 2>> ../build.log
564
  valid $? "Error: Could not install GEOS!"
Carolina Galvão committed
565 566 567 568 569

  cd .. > /dev/null
fi


570

Carolina Galvão committed
571
#
572
# GeoTIFF version 1.6.0
Rodrigo Avancini committed
573
#
574 575 576
if [ ! -f "$TERRALIB_DEPENDENCIES_DIR/lib/libgeotiff.dylib" ]; then
  echo "installing GeoTIFF..."
  log_lib "GeoTIFF"
Rodrigo Avancini committed
577

578
  sleep 1s
Rodrigo Avancini committed
579

580 581
  tar xzvf libgeotiff-1.6.0.tar.gz > /dev/null 2> /dev/null
  valid $? "Error: could not uncompress libgeotiff-1.6.0.tar.gz!"
Rodrigo Avancini committed
582

583 584
  cd libgeotiff-1.6.0 > /dev/null
  valid $? "Error: could not enter libgeotiff-1.6.0!"
Rodrigo Avancini committed
585

586 587 588
  #CPPFLAGS="-DACCEPT_USE_OF_DEPRECATED_PROJ_API_H"
  ./configure --with-jpeg=$TERRALIB_DEPENDENCIES_DIR --with-zlib --with-libtiff=$TERRALIB_DEPENDENCIES_DIR --with-proj=$TERRALIB_DEPENDENCIES_DIR --prefix=$TERRALIB_DEPENDENCIES_DIR > /dev/null 2>> ../build.log
  valid $? "Error: could not configure GeoTIFF!"
Rodrigo Avancini committed
589

590 591
  make -j 4 > /dev/null 2>> ../build.log
  valid $? "Error: could not make GeoTIFF!"
Rodrigo Avancini committed
592

593 594
  make install > /dev/null 2>> ../build.log
  valid $? "Error: Could not install GeoTIFF!"
Rodrigo Avancini committed
595

596
  cd .. > /dev/null
Rodrigo Avancini committed
597 598 599 600
fi


#
601
# SZIP version 2.1
Carolina Galvão committed
602
#
603 604 605
if [ ! -f "$TERRALIB_DEPENDENCIES_DIR/lib/libsz.dylib" ]; then
  echo "installing SZIP..."
  log_lib "SZIP"
Carolina Galvão committed
606 607 608

  sleep 1s

609 610
  tar xzvf szip-2.1.tar.gz > /dev/null 2> /dev/null
  valid $? "Error: could not uncompress szip-2.1.tar.gz!"
Carolina Galvão committed
611

612 613
  cd szip-2.1 > /dev/null
  valid $? "Error: could not enter szip-2.1!"
Carolina Galvão committed
614

615 616
  ./configure --prefix=$TERRALIB_DEPENDENCIES_DIR > /dev/null 2>> ../build.log
  valid $? "Error: could not configure SZIP!"
Carolina Galvão committed
617 618

  make -j 4 > /dev/null 2>> ../build.log
619
  valid $? "Error: could not make SZIP!"
Carolina Galvão committed
620 621

  make install > /dev/null 2>> ../build.log
622
  valid $? "Error: Could not install SZIP!"
Carolina Galvão committed
623 624 625 626 627 628

  cd .. > /dev/null
fi


#
629
# ICU version 60.2
Carolina Galvão committed
630
#
631
if [ ! -f "$TERRALIB_DEPENDENCIES_DIR/lib/libicuuc.dylib" ]; then
Carolina Galvão committed
632
  echo "installing ICU..."
raphael.costa committed
633
  log_lib "ICU"
Carolina Galvão committed
634 635 636

  sleep 1s

637 638
  tar xzvf icu4c-60_2-src.tgz > /dev/null 2> /dev/null
  valid $? "Error: could not uncompress icu4c-60_2-src.tgz!"
Carolina Galvão committed
639 640 641 642 643 644 645

  cd icu/source > /dev/null
  valid $? "Error: could not enter icu/source!"

  chmod +x runConfigureICU configure install-sh > /dev/null
  valid $? "Error: could not set runConfigureICU to execute mode!"

raphael.costa committed
646
  CPPFLAGS="-DU_USING_ICU_NAMESPACE=0 -DU_CHARSET_IS_UTF8=1 -DU_NO_DEFAULT_INCLUDE_UTF_HEADERS=1" ./runConfigureICU MacOSX --prefix=$TERRALIB_DEPENDENCIES_DIR --enable-rpath > /dev/null 2>> ../build.log
Carolina Galvão committed
647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662
  valid $? "Error: could not runConfigureICU!"

  make -j 4 > /dev/null 2>> ../build.log
  valid $? "Error: could not make ICU!"

  #make check
  #valid $? "Error: could not check ICU build!"

  make install > /dev/null 2>> ../build.log
  valid $? "Error: Could not install ICU!"

  cd ../.. > /dev/null
fi


#
Rodrigo Avancini committed
663
# Xerces-c version 3.1.4
Carolina Galvão committed
664 665 666
#
if [ ! -f "$TERRALIB_DEPENDENCIES_DIR/lib/libxerces-c.dylib" ]; then
  echo "installing Xerces..."
raphael.costa committed
667
  log_lib "Xerces"
Carolina Galvão committed
668 669 670

  sleep 1s

Rodrigo Avancini committed
671 672
  tar xzvf xerces-c-3.1.4.tar.gz > /dev/null 2> /dev/null
  valid $? "Error: could not uncompress xerces-c-3.1.4.tar.gz!"
Carolina Galvão committed
673

Rodrigo Avancini committed
674 675
  cd xerces-c-3.1.4 > /dev/null
  valid $? "Error: could not enter xerces-c-3.1.4!"
Carolina Galvão committed
676

Rodrigo Avancini committed
677
  CFLAGS="-arch x86_64" CXXFLAGS="-arch x86_64 -O3 -std=c++11" CPPFLAGS=-I$TERRALIB_DEPENDENCIES_DIR/include LDFLAGS=-L$TERRALIB_DEPENDENCIES_DIR/lib ./configure --prefix=$TERRALIB_DEPENDENCIES_DIR --enable-netaccessor-curl --disable-static --enable-msgloader-icu --with-icu=$TERRALIB_DEPENDENCIES_DIR > /dev/null 2>> ../build.log
Carolina Galvão committed
678 679
  valid $? "Error: could not configure Xerces-c!"

Rodrigo Avancini committed
680
  make -j 4 > /dev/null 2>> ../build.log
Carolina Galvão committed
681 682 683 684 685 686 687 688 689 690
  valid $? "Error: could not make Xerces-c!"

  make install > /dev/null 2>> ../build.log
  valid $? "Error: Could not install Xerces-c!"

  cd .. > /dev/null
fi


#
Carolina Galvão committed
691
# libxml2 version 2.9.1
Carolina Galvão committed
692 693 694
#
if [ ! -f "$TERRALIB_DEPENDENCIES_DIR/lib/libxml2.dylib" ]; then
  echo "installing libxml2..."
raphael.costa committed
695
  log_lib "libxml2"
Carolina Galvão committed
696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718

  sleep 1s

  tar xzvf libxml2-2.9.1.tar.gz > /dev/null 2> /dev/null
  valid $? "Error: could not uncompress libxml2-2.9.1.tar.gz!"

  cd libxml2-2.9.1 > /dev/null
  valid $? "Error: could not enter libxml2-2.9.1!"

  CPPFLAGS=-I$TERRALIB_DEPENDENCIES_DIR/include LDFLAGS=-L$TERRALIB_DEPENDENCIES_DIR/lib ./configure --prefix=$TERRALIB_DEPENDENCIES_DIR --with-icu --without-python > /dev/null 2>> ../build.log
  valid $? "Error: could not configure libxml2!"

  make -j 4 > /dev/null 2>> ../build.log
  valid $? "Error: could not make libxml2"

  make install > /dev/null 2>> ../build.log
  valid $? "Error: Could not install libxml2"

  cd .. > /dev/null
fi


#
Carolina Galvão committed
719
# libxslt version 1.1.28
Carolina Galvão committed
720 721 722
#
if [ ! -f "$TERRALIB_DEPENDENCIES_DIR/lib/libxslt.dylib" ]; then
  echo "installing libxslt..."
raphael.costa committed
723
  log_lib "libxslt"
Carolina Galvão committed
724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746

  sleep 1s

  tar xzvf libxslt-1.1.28.tar.gz > /dev/null 2> /dev/null
  valid $? "Error: could not uncompress libxslt-1.1.28.tar.gz!"

  cd libxslt-1.1.28 > /dev/null
  valid $? "Error: could not enter libxslt-1.1.28!"

  CPPFLAGS=-I$TERRALIB_DEPENDENCIES_DIR/include LDFLAGS=-L$TERRALIB_DEPENDENCIES_DIR/lib ./configure --prefix=$TERRALIB_DEPENDENCIES_DIR --with-libxml-prefix=$TERRALIB_DEPENDENCIES_DIR --without-debug > /dev/null 2>> ../build.log
  valid $? "Error: could not configure libxslt!"

  make -j 4 > /dev/null 2>> ../build.log
  valid $? "Error: could not make libxslt"

  make install > /dev/null 2>> ../build.log
  valid $? "Error: Could not install libxslt"

  cd .. > /dev/null
fi


#
747
# Boost version 1.74.0
Carolina Galvão committed
748 749 750 751
# Site: http://www.boost.org
#
if [ ! -f "$TERRALIB_DEPENDENCIES_DIR/lib/libboost_thread.dylib" ]; then
  echo "installing boost..."
raphael.costa committed
752
  log_lib "boost"
Carolina Galvão committed
753 754 755

  sleep 1s

756 757
  tar xzvf boost_1_74_0.tar.gz > /dev/null 2> /dev/null
  valid $? "Error: could not uncompress boost_1_74_0.tar.gz!"
Carolina Galvão committed
758

759 760
  cd boost_1_74_0 > /dev/null
  valid $? "Error: could not enter boost_1_74_0!"
Carolina Galvão committed
761

raphael.costa committed
762
  ./bootstrap.sh --with-toolset=clang --prefix=$TERRALIB_DEPENDENCIES_DIR -with-icu=$TERRALIB_DEPENDENCIES_DIR > /dev/null 2>> ../build.log
Carolina Galvão committed
763 764
  valid $? "Error: could not configure Boost!"

765
  ./b2 runtime-link=shared link=shared variant=release threading=multi linkflags=-headerpad_max_install_names -sICU_PATH=$TERRALIB_DEPENDENCIES_DIR install > /dev/null 2>> ../build.log
Carolina Galvão committed
766 767 768 769 770 771 772
  valid $? "Error: could not make boost"

  cd .. > /dev/null

  fixRPath "`ls $TERRALIB_DEPENDENCIES_DIR/lib/libboost*.dylib`" > /dev/null
fi

773 774 775 776 777 778 779 780 781

#
# WebSocket 0.8.2
#
if [ ! -f "$TERRALIB_DEPENDENCIES_DIR/include/websocketpp/version.hpp" ]; then
  echo "installing WebSocket..."
  echo ""
  sleep 1s

782
  tar xzvf websocketpp-0.8.2.tar.gz > /dev/null 2>> ../build.log
783 784 785 786 787 788 789 790
  valid $? "Error: could not uncompress websocketpp-0.8.2.tar.gz!"

  cd websocketpp-0.8.2
  valid $? "Error: could not enter websocketpp-0.8.2!"

  mkdir cmake-build
  cd cmake-build

791
  cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE="Release" -DCMAKE_INSTALL_PREFIX=${TERRALIB_DEPENDENCIES_DIR} -DBOOST_ROOT:PATH=${TERRALIB_DEPENDENCIES_DIR} -DENABLE_CPP11:BOOL=ON -DBUILD_TESTS:BOOL=OFF -DBUILD_EXAMPLES:BOOL=OFF .. > /dev/null 2>> ../build.log
792 793
  valid $? "Error: could not configure WebSocket!"

794
  make install > /dev/null 2>> ../build.log
795 796 797 798 799 800 801 802 803 804 805 806 807 808
  valid $? "Error: Could not install WebSocket"

  cd ../../
fi


#
# CppRestSDK 2.10.16
#
if [ ! -f "$TERRALIB_DEPENDENCIES_DIR/lib/libcpprest.dylib" ]; then
  echo "installing CppRestSDK..."
  echo ""
  sleep 1s

809
  tar xzvf cpprestsdk-2.10.16.tar.gz  > /dev/null 2>> ../build.log
810 811 812 813 814 815 816 817
  valid $? "Error: could not uncompress cpprestsdk-2.10.16.tar.gz!"

  cd cpprestsdk-2.10.16
  valid $? "Error: could not enter cpprestsdk-2.10.16!"

  mkdir cmake-build
  cd cmake-build

818
  cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE="Release" -DCMAKE_INSTALL_PREFIX=${TERRALIB_DEPENDENCIES_DIR} -DCMAKE_PREFIX_PATH=${TERRALIB_DEPENDENCIES_DIR}  -DBOOST_ROOT:PATH=${TERRALIB_DEPENDENCIES_DIR} -DBUILD_TESTS:BOOL=OFF -DBUILD_SAMPLES:BOOL=OFF .. > /dev/null 2>> ../build.log
819 820
  valid $? "Error: could not configure CppRestSDK"

821
  make -j $THREADS > /dev/null 2>> ../build.log
822 823
  valid $? "Error: could not make CppRestSDK"
  
824
  make install > /dev/null 2>> ../build.log
825 826 827 828 829 830
  valid $? "Error: Could not install CppRestSDK"

  cd ../../
fi


Carolina Galvão committed
831
#
832
# PostgreSQL version 9.6.12
Carolina Galvão committed
833 834 835
#
if [ ! -f "$TERRALIB_DEPENDENCIES_DIR/pgsql/lib/libpq.dylib" ]; then
  echo "installing PostgreSQL..."
raphael.costa committed
836
  log_lib "PostgreSQL"
Carolina Galvão committed
837 838 839

  sleep 1s

840 841
  tar xjvf postgresql-9.6.12.tar.bz2 > /dev/null 2> /dev/null
  valid $? "Error: could not uncompress postgresql-9.6.12.tar.bz2!"
Carolina Galvão committed
842

843 844
  cd postgresql-9.6.12 > /dev/null
  valid $? "Error: could not enter postgresql-9.6.12!"
Carolina Galvão committed
845 846 847 848 849 850 851 852 853 854 855

  CPPFLAGS="-I$TERRALIB_DEPENDENCIES_DIR/include -I$TERRALIB_DEPENDENCIES_DIR/include/libxml2" LDFLAGS="-lstdc++ -L$TERRALIB_DEPENDENCIES_DIR/lib" ./configure --with-libxml --with-libxslt --with-uuid=e2fs --prefix=$TERRALIB_DEPENDENCIES_DIR/pgsql --with-includes=$TERRALIB_DEPENDENCIES_DIR/include --with-libraries=$TERRALIB_DEPENDENCIES_DIR/lib > /dev/null 2>> ../build.log
  valid $? "Error: could not configure postgresql!"

  make -j 4 > /dev/null 2>> ../build.log
  valid $? "Error: could not make postgresql"

  make install > /dev/null 2>> ../build.log
  valid $? "Error: Could not install postgresql"

  cd contrib/uuid-ossp > /dev/null
856
  valid $? "Error: could not enter postgresql-9.6.12/contrib/uuid-ossp!"
Carolina Galvão committed
857 858

  make > /dev/null 2>> ../build.log
859
  valid $? "Error: could not make postgresql-9.6.12/contrib/uuid-ossp"
Carolina Galvão committed
860 861

  make install > /dev/null 2>> ../build.log
862
  valid $? "Error: Could not install postgresql-9.6.12/contrib/uuid-ossp"
Carolina Galvão committed
863 864 865 866 867 868

  cd ../../..
fi


#
869
# HDF4 version 4.2.15
Carolina Galvão committed
870 871 872
#
if [ ! -f "$TERRALIB_DEPENDENCIES_DIR/lib/libmfhdf.a" ]; then
  echo "installing HDF4..."
raphael.costa committed
873
  log_lib "HDF4"
Carolina Galvão committed
874 875 876

  sleep 1s

877 878
  tar xzvf hdf-4.2.15.tar.gz > /dev/null 2> /dev/null
  valid $? "Error: could not uncompress hdf-4.2.15.tar.gz!"
Carolina Galvão committed
879

880 881
  cd hdf-4.2.15 > /dev/null
  valid $? "Error: could not enter hdf-4.2.15!"
Carolina Galvão committed
882 883 884 885 886 887 888 889 890 891 892 893 894 895 896

  ./configure --prefix=$TERRALIB_DEPENDENCIES_DIR --with-szlib=$TERRALIB_DEPENDENCIES_DIR --with-zlib --with-jpeg=$TERRALIB_DEPENDENCIES_DIR --enable-netcdf --disable-fortran > /dev/null 2>> ../build.log
  valid $? "Error: could not configure hdf-4!"

  make -j 4 > /dev/null 2>> ../build.log
  valid $? "Error: could not make hdf-4"

  make install > /dev/null 2>> ../build.log
  valid $? "Error: Could not install hdf-4"

  cd .. > /dev/null
fi


#
Rodrigo Avancini committed
897
# SpatiaLite version 4.3.0a
Carolina Galvão committed
898 899 900 901 902
# Site: https://www.gaia-gis.it/fossil/libspatialite
# Obs.: In the future we should turn on libxml2 support.
#
if [ ! -f "$TERRALIB_DEPENDENCIES_DIR/lib/libspatialite.dylib" ]; then
  echo "installing SpatiaLite..."
raphael.costa committed
903
  log_lib "SpatiaLite"
Carolina Galvão committed
904 905 906

  sleep 1s

Rodrigo Avancini committed
907 908
  tar xzvf libspatialite-4.3.0a.tar.gz > /dev/null 2> /dev/null
  valid $? "Error: could not uncompress libspatialite-4.3.0a.tar.gz!"
Carolina Galvão committed
909

Rodrigo Avancini committed
910 911
  cd libspatialite-4.3.0a > /dev/null
  valid $? "Error: could not enter libspatialite-4.3.0a!"
Carolina Galvão committed
912

Rodrigo Avancini committed
913
  CPPFLAGS="-DACCEPT_USE_OF_DEPRECATED_PROJ_API_H -I$TERRALIB_DEPENDENCIES_DIR -I$TERRALIB_DEPENDENCIES_DIR/include -I$TERRALIB_DEPENDENCIES_DIR/include/libxml2 -I$TERRALIB_DEPENDENCIES_DIR/include/libxml2/libxml" LDFLAGS="-L$TERRALIB_DEPENDENCIES_DIR/lib"  ./configure --prefix=$TERRALIB_DEPENDENCIES_DIR --enable-proj --enable-geos --enable-geosadvanced --enable-iconv --enable-freexl --enable-geocallbacks --enable-epsg --enable-mathsql --enable-libxml2=no --enable-geopackage --with-geosconfig=$TERRALIB_DEPENDENCIES_DIR/bin/geos-config  > /dev/null  2>> ../build.log
Carolina Galvão committed
914 915 916 917 918 919 920 921 922 923 924
  valid $? "Error: could not configure libspatialite!"

  make -j 4 > /dev/null 2>> ../build.log
  valid $? "Error: could not make libspatialite"

  make install > /dev/null 2>> ../build.log
  valid $? "Error: Could not install libspatialite"

  cd .. > /dev/null
fi

Carolina Galvão committed
925

Carolina Galvão committed
926 927 928 929 930 931
#
# Uriparser version 0.8.4
# Site: https://sourceforge.net/projects/uriparser/files/Sources/0.8.4/
#
if [ ! -f "$TERRALIB_DEPENDENCIES_DIR/lib/liburiparser.dylib" ]; then
  echo "installing uriparser..."
raphael.costa committed
932
  log_lib "uriparser"
Carolina Galvão committed
933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959

  sleep 1s

  tar xzvf uriparser-0.8.4.tar.gz > /dev/null 2> /dev/null
  valid $? "Error: could not uncompress uriparser-0.8.4.tar.gz!"

  cd uriparser-0.8.4 > /dev/null
  valid $? "Error: could not enter uriparser!"

  CPPFLAGS=-I$TERRALIB_DEPENDENCIES_DIR/include LDFLAGS=-L$TERRALIB_DEPENDENCIES_DIR/lib ./configure --prefix=$TERRALIB_DEPENDENCIES_DIR --disable-test --disable-doc > /dev/null 2>> ../build.log
  valid $? "Error: could not configure uriparser!"

  make -j 4 > /dev/null 2>> ../build.log
  valid $? "Error: could not make uriparser"

  make install > /dev/null 2>> ../build.log
  valid $? "Error: Could not install uriparser"

  cd .. > /dev/null
fi

#
# Libkml version 1.3.1
# Site: https://github.com/libkml/libkml
#
if [ ! -f "$TERRALIB_DEPENDENCIES_DIR/lib/libkmlbase.dylib" ]; then
  echo "installing libkml..."
raphael.costa committed
960
  log_lib "libkml"
Carolina Galvão committed
961 962 963

  sleep 1s

964
  tar xzvf libkml-1.3.0.tar.gz > /dev/null 2> /dev/null
Carolina Galvão committed
965 966
  valid $? "Error: could not uncompress libkml-master.tar.gz!"

967
  cd libkml-1.3.0 > /dev/null
Carolina Galvão committed
968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983
  valid $? "Error: could not enter libkml-master!"

  cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE:STRING="Release" -DCMAKE_MACOSX_RPATH:BOOL=YES -DCMAKE_PREFIX_PATH:PATH=${TERRALIB_DEPENDENCIES_DIR} -DCMAKE_INSTALL_PREFIX:PATH=${TERRALIB_DEPENDENCIES_DIR} > /dev/null 2>> ../build.log
  valid $? "Error: could not configure libkml!"

  make -j 4 > /dev/null 2>> ../build.log
  valid $? "Error: could not make libkml"

  make install > /dev/null 2>> ../build.log
  valid $? "Error: Could not install libkml"

  cd .. > /dev/null

  fixRPath "`ls $TERRALIB_DEPENDENCIES_DIR/lib/libkml*.1.dylib`" > /dev/null

fi
Carolina Galvão committed
984 985

#
986
# GDAL/OGR version 3.1.2
Carolina Galvão committed
987
# Site: http://www.gdal.org
Carolina Galvão committed
988
# Obs.: in the future add a flag --with-php --with-python
Carolina Galvão committed
989
#
Carolina Galvão committed
990
if [ ! -f "$TERRALIB_DEPENDENCIES_DIR/lib/libgdal.dylib" ]; then
991 992
  echo "installing GDAL/OGR 3.1.2..."
  log_lib "GDAL/OGR 3.1.2"
Carolina Galvão committed
993 994 995

  sleep 1s

996 997
  tar xzvf gdal-3.1.2.tar.gz > /dev/null 2> /dev/null
  valid $? "Error: could not uncompress gdal-3.1.2.tar.gz!"
Carolina Galvão committed
998

999 1000
  cd gdal-3.1.2 > /dev/null
  valid $? "Error: could not enter gdal-3.1.2!"
Carolina Galvão committed
1001

1002 1003
  PKG_CONFIG_PATH="$TERRALIB_DEPENDENCIES_DIR/pgsql/lib/pkgconfig/:$TERRALIB_DEPENDENCIES_DIR/lib/pkgconfig/" CPPFLAGS="-I$TERRALIB_DEPENDENCIES_DIR/include -I$TERRALIB_DEPENDENCIES_DIR/include/libxml2" LDFLAGS=-L$TERRALIB_DEPENDENCIES_DIR/lib ./configure --with-libkml=$TERRALIB_DEPENDENCIES_DIR --with-pg=yes --with-png=$TERRALIB_DEPENDENCIES_DIR --with-libtiff=$TERRALIB_DEPENDENCIES_DIR --with-geotiff=$TERRALIB_DEPENDENCIES_DIR --with-jpeg=$TERRALIB_DEPENDENCIES_DIR  --with-gif --with-ecw=yes --with-xerces=$TERRALIB_DEPENDENCIES_DIR --with-expat=yes --with-openjpeg-2.0=$TERRALIB_DEPENDENCIES_DIR --with-curl=$TERRALIB_DEPENDENCIES_DIR/bin/curl-config --with-sqlite3=$TERRALIB_DEPENDENCIES_DIR --with-geos=$TERRALIB_DEPENDENCIES_DIR/bin/geos-config --with-threads --with-spatialite=$TERRALIB_DEPENDENCIES_DIR --with-hdf4=$TERRALIB_DEPENDENCIES_DIR --with-freexl=$TERRALIB_DEPENDENCIES_DIR --prefix=$TERRALIB_DEPENDENCIES_DIR --with-xml2=yes  --with-proj=$TERRALIB_DEPENDENCIES_DIR --without-python > /dev/null 2>> ../build.log
  valid $? "Error: could not configure gdal!"
Carolina Galvão committed
1004 1005

  make -j 4 > /dev/null 2>> ../build.log
1006
  valid $? "Error: could not make gdal"
Carolina Galvão committed
1007 1008

  make install > /dev/null 2>> ../build.log
1009
  valid $? "Error: Could not install gdal"
Carolina Galvão committed
1010 1011 1012 1013 1014 1015 1016 1017 1018 1019

  cd .. > /dev/null
fi


#
# CppUnit version 1.12.1
#
if [ ! -f "$TERRALIB_DEPENDENCIES_DIR/lib/libcppunit.dylib" ]; then
  echo "installing CppUnit.."
raphael.costa committed
1020
  log_lib "CppUnit"
Carolina Galvão committed
1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048

  sleep 1s

  tar xzvf cppunit-1.12.1.tar.gz > /dev/null 2> /dev/null
  valid $? "Error: could not uncompress cppunit-1.12.1.tar.gz!"

  cd cppunit-1.12.1 > /dev/null
  valid $? "Error: could not enter cppunit-1.12.1!"

  #LDFLAGS="-ldl" ./configure --prefix=$TERRALIB_DEPENDENCIES_DIR
  ./configure --prefix=$TERRALIB_DEPENDENCIES_DIR > /dev/null 2>> ../build.log
#  valid $? "Error: could not configure cppunit!"

  make -j 4 > /dev/null 2>> ../build.log
  valid $? "Error: could not make cppunit"

  make install > /dev/null 2>> ../build.log
  valid $? "Error: Could not install cppunit"

  cd .. > /dev/null
fi


#
# Qt Property Browser
#
if [ ! -f "$TERRALIB_DEPENDENCIES_DIR/lib/libqt_property_browser.dylib" ]; then
  echo "installing Qt Property Browser..."
raphael.costa committed
1049
  log_lib "Qt Property Browser"
Carolina Galvão committed
1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072

  sleep 1s

  tar xzvf qtpropertybrowser.tar.gz > /dev/null 2> /dev/null
  valid $? "Error: could not uncompress qtpropertybrowser.tar.gz!"

  cd qtpropertybrowser > /dev/null
  valid $? "Error: could not change dir to qtpropertybrowser!"

  qmake "TERRALIB_DIR=$TERRALIB_DEPENDENCIES_DIR" > /dev/null 2>> ../build.log
  valid $? "Error: could not run qmake for qt-property-browser!"

  make -j 4 > /dev/null 2>> ../build.log
  valid $? "Error: could not make qt-property-browser!"

  make install > /dev/null 2>> ../build.log
  valid $? "Error: Could not install qt-property-browser!"

  cd .. > /dev/null
fi


#
Matheus C. Zaglia committed
1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093
# QScintilla version 2.10
#
if [ ! -f "$TERRALIB_DEPENDENCIES_DIR/lib/libqscintilla2.dylib" ]; then
  echo "installing QScintilla..."
  sleep 1s

  tar xzvf QScintilla_gpl-2.10.tar.gz > /dev/null 2> /dev/null
  valid $? "Error: could not uncompress QScintilla_gpl-2.10.tar.gz!"

  cd QScintilla_gpl-2.10/Qt4Qt5 > /dev/null
  valid $? "Error: could not change dir to QScintilla_gpl-2.10/Qt4Qt5!"

  qmake "TERRALIB_DIR=$TERRALIB_DEPENDENCIES_DIR" > /dev/null 2>> ../build.log
  valid $? "Error: could not prepare QScintilla build with qmake!"

  make -j 4 > /dev/null 2>> ../build.log
  valid $? "Error: could not make QScintilla!"

  make install  > /dev/null 2>> ../build.log
  valid $? "Error: Could not install QScintilla!"

Matheus C. Zaglia committed
1094 1095
  fixRPath "$TERRALIB_DEPENDENCIES_DIR/lib/libqscintilla2.dylib"

Matheus C. Zaglia committed
1096 1097
  cd ../.. > /dev/null
fi
Carolina Galvão committed
1098 1099 1100


#
Carolina Galvão committed
1101
# Lua version 5.3.4
Carolina Galvão committed
1102
#
Carolina Galvão committed
1103
if [ ! -f "$TERRALIB_DEPENDENCIES_DIR/lib/liblua.dylib" ]; then
Carolina Galvão committed
1104
  echo "installing Lua..."
raphael.costa committed
1105
  log_lib "Lua"
Carolina Galvão committed
1106 1107 1108

  sleep 1s

Carolina Galvão committed
1109 1110
  tar xzvf lua-5.3.4.tar.gz > /dev/null 2> /dev/null
  valid $? "Error: could not uncompress lua-5.3.4.tar.gz!"
Carolina Galvão committed
1111

Carolina Galvão committed
1112 1113
  cd lua-5.3.4 > /dev/null
  valid $? "Error: could not change dir to lua-5.3.4!"
Carolina Galvão committed
1114

Carolina Galvão committed
1115 1116
  mkdir cmake-build > /dev/null
  cd cmake-build > /dev/null
Carolina Galvão committed
1117

Carolina Galvão committed
1118 1119
  cmake -G "Xcode" -DCMAKE_BUILD_TYPE="Release" -DCMAKE_INSTALL_PREFIX=${TERRALIB_DEPENDENCIES_DIR} -DINSTALL_INC=${TERRALIB_DEPENDENCIES_DIR}/include/lua .. > /dev/null 2>> ../build.log
  valid $? "Error: could not configure Lua!"
Carolina Galvão committed
1120

Carolina Galvão committed
1121
  cmake --build . --target install --config Release  > /dev/null 2>> ../build.log
Carolina Galvão committed
1122 1123
  valid $? "Error: could not install Lua!"

raphael.costa committed
1124
  cd ../.. > /dev/null
Carolina Galvão committed
1125 1126

  fixRPath "`ls $TERRALIB_DEPENDENCIES_DIR/lib/liblua.dylib`" > /dev/null
Carolina Galvão committed
1127
fi
Carolina Galvão committed
1128 1129


Carolina Galvão committed
1130
#
Carolina Galvão committed
1131
# QtLua version 2.0
Carolina Galvão committed
1132
#
Carolina Galvão committed
1133 1134 1135 1136
if [ ! -f "$TERRALIB_DEPENDENCIES_DIR/lib/libqtlua.dylib" ]; then
  echo "installing QtLua..."
  sleep 1s

Carolina Galvão committed
1137
  tar xzvf libqtlua-2.0.tar.gz > /dev/null 2> /dev/null
Carolina Galvão committed
1138 1139
  valid $? "Error: could not uncompress libqtlua-2.0.tar.gz!"

Carolina Galvão committed
1140
  cd libqtlua-2.0 > /dev/null
Carolina Galvão committed
1141
  valid $? "Error: could not change dir to libqtlua-2.0!"
raphael.costa committed
1142

Carolina Galvão committed
1143 1144
  mkdir cmake-build > /dev/null
  cd cmake-build > /dev/null
Carolina Galvão committed
1145

Carolina Galvão committed
1146
  cmake -G "Xcode" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${TERRALIB_DEPENDENCIES_DIR} -DLUA_LIBRARY=${TERRALIB_DEPENDENCIES_DIR}/lib/liblua.dylib -DLUA_INCLUDE_DIR=${TERRALIB_DEPENDENCIES_DIR}/include/lua .. > /dev/null 2>> ../build.log
Carolina Galvão committed
1147 1148
  valid $? "Error: could not configure QtLua!"

Carolina Galvão committed
1149
  cmake --build . --target install --config Release  > /dev/null 2>> ../build.log
Carolina Galvão committed
1150 1151
  valid $? "Error: could not install QtLua!"

Carolina Galvão committed
1152
  cd .. > /dev/null
Carolina Galvão committed
1153

Carolina Galvão committed
1154
  cp -r src/internal $TERRALIB_DEPENDENCIES_DIR/include/QtLua/ > /dev/null
Carolina Galvão committed
1155 1156 1157
  valid $? "Error: could not copy QtLua internal folder!"

  cd ..
Carolina Galvão committed
1158 1159

  fixRPath "`ls $TERRALIB_DEPENDENCIES_DIR/lib/libqtlua*.dylib`" > /dev/null
Carolina Galvão committed
1160 1161 1162 1163 1164 1165 1166 1167 1168 1169
fi


#
# QtLuaExtras
#
if [ ! -f "$TERRALIB_DEPENDENCIES_DIR/lib/qtluae.dylib" ]; then
  echo "installing QtLuaExtras..."
  sleep 1s

Carolina Galvão committed
1170
  tar xzvf qtluae.tar.gz > /dev/null 2> /dev/null
Carolina Galvão committed
1171 1172
  valid $? "Error: could not uncompress qtluae.tar.gz!"

Carolina Galvão committed
1173
  cd qtluae > /dev/null
Carolina Galvão committed
1174 1175
  valid $? "Error: could not change dir to qtluae!"

Carolina Galvão committed
1176 1177
  mkdir cmake-build > /dev/null
  cd cmake-build > /dev/null
Carolina Galvão committed
1178

Carolina Galvão committed
1179
  cmake -G "Xcode" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${TERRALIB_DEPENDENCIES_DIR} -DLUA_LIBRARY=${TERRALIB_DEPENDENCIES_DIR}/lib/liblua.dylib -DLUA_INCLUDE_DIR=${TERRALIB_DEPENDENCIES_DIR}/include/lua -DQTLUA_INCLUDE_DIR=${TERRALIB_DEPENDENCIES_DIR}/include -DQTLUA_LIBRARY=${TERRALIB_DEPENDENCIES_DIR}/lib/libqtlua.dylib ../build/cmake > /dev/null 2>> ../build.log
Carolina Galvão committed
1180 1181
  valid $? "Error: could not configure QtLuaExtras!"

Carolina Galvão committed
1182
  cmake --build . --target install --config Release > /dev/null 2>> ../build.log
Carolina Galvão committed
1183 1184
  valid $? "Error: could not install QtLuaExtras!"

Carolina Galvão committed
1185
  cp -a ${TERRALIB_DEPENDENCIES_DIR}/lib/libqtluae.dylib ${TERRALIB_DEPENDENCIES_DIR}/lib/qtluae.dylib > /dev/null
Carolina Galvão committed
1186 1187
  valid $? "Error: could not copy QtLuaExtras internal folder!"

Carolina Galvão committed
1188
  cd ../.. > /dev/null
Carolina Galvão committed
1189
fi
Carolina Galvão committed
1190 1191 1192


#
Carolina Galvão committed
1193
# Qwt version 6.1.2
Carolina Galvão committed
1194 1195 1196 1197
# Site: http://qwt.sourceforge.net
#
if [ ! -d "$TERRALIB_DEPENDENCIES_DIR/lib/qwt.framework" ]; then
  echo "installing Qwt..."
raphael.costa committed
1198
  log_lib "Qwt"
Carolina Galvão committed
1199 1200 1201 1202 1203 1204 1205 1206 1207

  sleep 1s

  tar xjvf qwt-6.1.2.tar.bz2 > /dev/null 2> /dev/null
  valid $? "Error: could not uncompress qwt-6.1.2.tar.bz2!"

  cd qwt-6.1.2 > /dev/null
  valid $? "Error: could not change dir to qwt-6.1.2!"

Carolina Galvão committed
1208
  qmake qwt.pro "QWT_INSTALL_PREFIX_TARGET=$TERRALIB_DEPENDENCIES_DIR"  > /dev/null 2>> ../build.log
Carolina Galvão committed
1209 1210 1211 1212 1213 1214 1215 1216 1217
  valid $? "Error: could not configure Qwt!"

  make -j 4  > /dev/null 2>> ../build.log
  valid $? "Error: could not make Qwt!"

  make install  > /dev/null 2>> ../build.log
  valid $? "Error: could not copy Qwt internal folder!"

  cd ..  > /dev/null
raphael.costa committed
1218

Carolina Galvão committed
1219 1220 1221 1222 1223 1224 1225 1226
  fixRPath "$TERRALIB_DEPENDENCIES_DIR/lib/qwt.framework/Versions/6/qwt"  > /dev/null
fi


#
# GTest and GMock
#
if [ ! -f "$TERRALIB_DEPENDENCIES_DIR/lib/libgmock.a" ]; then
Carolina Galvão committed
1227 1228 1229
  echo "installing GTest and GMock..."
  sleep 1s

Rodrigo Avancini committed
1230
  unzip -o googletest-master.zip > /dev/null 2> /dev/null
Carolina Galvão committed
1231
  valid $? "Error: could not uncompress googletest-master.zip!"
Carolina Galvão committed
1232

Carolina Galvão committed
1233 1234
  cd googletest-master/googletest > /dev/null
  valid $? "Error: could not enter googletestmaster!"
Carolina Galvão committed
1235

Carolina Galvão committed
1236 1237
  cmake . > /dev/null 2>> ../build.log
  valid $? "Error: could not configure googletest!"
Carolina Galvão committed
1238

Carolina Galvão committed
1239 1240
  make -j 4 > /dev/null 2>> ../build.log
  valid $? "Error: could not make googletest!"
Carolina Galvão committed
1241

Carolina Galvão committed
1242 1243
  cp libgtest.a $TERRALIB_DEPENDENCIES_DIR/lib/ > /dev/null
  valid $? "Error: could not copy libgtest.a!"
Carolina Galvão committed
1244

Carolina Galvão committed
1245 1246
  cp libgtest_main.a $TERRALIB_DEPENDENCIES_DIR/lib/ > /dev/null
  valid $? "Error: could not copy libgtest_main.a!"
Carolina Galvão committed
1247

Carolina Galvão committed
1248 1249
  cp -r include/gtest $TERRALIB_DEPENDENCIES_DIR/include/ > /dev/null
  valid $? "Error: could not copy include dir!"
Carolina Galvão committed
1250

Carolina Galvão committed
1251
  cd ../googlemock > /dev/null
Carolina Galvão committed
1252

Carolina Galvão committed
1253 1254
  cmake . > /dev/null 2>> ../build.log
  valid $? "Error: could not configure googlemock!"
Carolina Galvão committed
1255

Carolina Galvão committed
1256 1257
  make -j 4 > /dev/null 2>> ../build.log
  valid $? "Error: could not make googlemock!"
Carolina Galvão committed
1258

Carolina Galvão committed
1259 1260
  cp libgmock.a $TERRALIB_DEPENDENCIES_DIR/lib/ > /dev/null
  valid $? "Error: could not copy libgmock.a!"
Carolina Galvão committed
1261

Carolina Galvão committed
1262 1263
  cp libgmock_main.a $TERRALIB_DEPENDENCIES_DIR/lib/ > /dev/null
  valid $? "Error: could not copy libgmock_main.a!"
Carolina Galvão committed
1264

Carolina Galvão committed
1265 1266
  cp -r include/gmock $TERRALIB_DEPENDENCIES_DIR/include/ > /dev/null
  valid $? "Error: could not copy include dir!"
Carolina Galvão committed
1267

Carolina Galvão committed
1268 1269
  cd ../.. > /dev/null
fi
Carolina Galvão committed
1270

Carolina Galvão committed
1271
#
Carolina Galvão committed
1272
# Wtss-Cxx version 0.4.0
Carolina Galvão committed
1273
#
Carolina Galvão committed
1274
if [ ! -f "$TERRALIB_DEPENDENCIES_DIR/lib/libwtss_cxx_client.dylib" ]; then
Carolina Galvão committed
1275
  echo "installing Wtss-Cxx..."
raphael.costa committed
1276
  log_lib "Wtss-Cxx"
Carolina Galvão committed
1277 1278 1279 1280 1281 1282 1283 1284 1285

  sleep 1s

  tar xzvf wtss-cxx.tar.gz > /dev/null 2> /dev/null
  valid $? "Error: could not uncompress wtss-cxx.tar.gz!"

  cd wtss-cxx > /dev/null
  valid $? "Error: could not change dir to wtss-cxx!"

Carolina Galvão committed
1286
  cmake -G "Unix Makefiles" -DCMAKE_PREFIX_PATH:PATH=${TERRALIB_DEPENDENCIES_DIR} -DCMAKE_INSTALL_PREFIX:PATH=${TERRALIB_DEPENDENCIES_DIR} -DCMAKE_BUILD_TYPE:STRING="Release" build/cmake > /dev/null 2>> ../build.log
Carolina Galvão committed
1287 1288 1289 1290 1291 1292 1293 1294 1295
  valid $? "Error: could not configure Wtss-Cxx!"

  make -j 4  > /dev/null 2>> ../build.log
  valid $? "Error: could not make Wtss-Cxx!"

  make install  > /dev/null 2>> ../build.log
  valid $? "Error: could not copy Wtss-Cxx internal folder!"

  cd ..  > /dev/null
Carolina Galvão committed
1296 1297

  fixRPath "$TERRALIB_DEPENDENCIES_DIR/lib/libwtss_cxx_client.dylib"  > /dev/null
Carolina Galvão committed
1298 1299 1300
fi

#
Carolina Galvão committed
1301 1302 1303 1304
# GeographicLib version 1.48
#
if [ ! -f "$TERRALIB_DEPENDENCIES_DIR/lib/libGeographic.dylib" ]; then
  echo "installing GeographicLib..."
raphael.costa committed
1305
  log_lib "GeographicLib"
Carolina Galvão committed
1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329

  sleep 1s

  tar xzvf GeographicLib-1.48.tar.gz > /dev/null 2> /dev/null
  valid $? "Error: could not uncompress GeographicLib-1.48.tar.gz!"

  cd GeographicLib-1.48 > /dev/null
  valid $? "Error: could not change dir to GeographicLib-1.48!"

  cmake -G "Unix Makefiles" -DCMAKE_PREFIX_PATH:PATH=${TERRALIB_DEPENDENCIES_DIR} -DCMAKE_INSTALL_PREFIX:PATH=${TERRALIB_DEPENDENCIES_DIR} -DCMAKE_BUILD_TYPE:STRING="Release" > /dev/null 2>> ../build.log
  valid $? "Error: could not configure GeographicLib!"

  make -j 4  > /dev/null 2>> ../build.log
  valid $? "Error: could not make GeographicLib"

  make install  > /dev/null 2>> ../build.log
  valid $? "Error: could not copy GeographicLib internal folder!"

  cd ..  > /dev/null

  fixRPath "`ls $TERRALIB_DEPENDENCIES_DIR/lib/libGeographic*.dylib`" > /dev/null
fi

#
1330
# Gettext version 0.20.2
Carolina Galvão committed
1331 1332
# Site: https://ftp.gnu.org/pub/gnu/gettext/
#
Rodrigo Avancini committed
1333
if [ ! -f "$TERRALIB_DEPENDENCIES_DIR/lib/libgettextlib.dylib" ]; then
Carolina Galvão committed
1334
  echo "installing Gettext..."
raphael.costa committed
1335
  log_lib "gettext"
Carolina Galvão committed
1336 1337 1338

  sleep 1s

1339
  tar xzvf  gettext-0.20.2.tar.gz > /dev/null 2> /dev/null
Carolina Galvão committed
1340 1341
  valid $? "Error: could not uncompress gettext-latest.tar.gz!"

1342 1343
  cd gettext-0.20.2 > /dev/null
  valid $? "Error: could not enter gettext-0.20.2!"
Carolina Galvão committed
1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357

  CPPFLAGS=-I$TERRALIB_DEPENDENCIES_DIR/include LDFLAGS=-L$TERRALIB_DEPENDENCIES_DIR/lib ./configure --prefix=$TERRALIB_DEPENDENCIES_DIR > /dev/null 2>> ../build.log
  valid $? "Error: could not configure gettext!"

  make -j 4 > /dev/null 2>> ../build.log
  valid $? "Error: could not make gettext"

  make install > /dev/null 2>> ../build.log
  valid $? "Error: Could not install gettext"

  cd .. > /dev/null
fi

#
Carolina Galvão committed
1358 1359 1360 1361 1362 1363 1364 1365
# Finished!
#
clear
echo "****************************************"
echo "* TerraLib Installer for Mac OS Sierra *"
echo "****************************************"
echo ""
echo "finished successfully!"