source: issm/trunk-jpl/externalpackages/gmt/install-6-linux.sh

Last change on this file was 28197, checked in by jdquinn, 12 months ago

CHG: External package upgrades; fixes for distributables; cleanup

  • Property svn:executable set to *
File size: 1.9 KB
RevLine 
[25745]1#!/bin/bash
[28197]2set -e
[25745]3
4
5## Constants
6#
[28178]7VER="6.5.0"
[25745]8
[28178]9PREFIX="${ISSM_DIR}/externalpackages/gmt/install"
10
[28197]11# Find certain libraries so we do not have to hardcode them
[27202]12#
13# TODO:
14# - Move this to etc/environment.sh
15#
[27406]16echo "Finding libgfortran..."
[28197]17LIBGFORTRAN=$(find /usr -name libgfortran.* 2>/dev/null | egrep -n libgfortran.a | sed "s/[0-9]*://g" | head -1)
[27202]18LIBGFORTRAN_ROOT=${LIBGFORTRAN%/*}
19
[25745]20# Environment
21#
22export CC=mpicc
[28197]23export CFLAGS="${CFLAGS} -w"
[25745]24
25# Download source
26$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://issm.ess.uci.edu/files/externalpackages/gmt-${VER}.tar.gz" "gmt-${VER}.tar.gz"
27
28# Unpack source
29tar -zxvf gmt-${VER}.tar.gz
30
31# Cleanup
[25860]32rm -rf ${PREFIX} src
33mkdir -p ${PREFIX} src
[25745]34
35# Move source to 'src' directory
36mv gmt-${VER}/* src
37rm -rf gmt-${VER}
38
[28178]39# Copy custom configuration files to source
40cp ./src/cmake/ConfigUserAdvancedTemplate.cmake ./src/cmake/ConfigUser.cmake
[25745]41
[28178]42# Patch source
43patch ./src/cmake/ConfigUser.cmake < ./configs/${VER%.*}/cmake/ConfigUserAdvancedTemplate.cmake.patch
44
[25745]45# Configure
46cd src
47mkdir build
48cd build
49
50# NOTE:
51# - There is a CMake variable named CURL_ROOT in src/cmake/ConfigUser.cmake
52# that, ostensibly, allows for supplying the path to curl when it is in a
53# non-standard location. That said, newer versions of CMake will ignore said
54# variable and instead try to find curl itself. Passing in the two options
55# below overrides this behavior.
56#
57cmake \
[28178]58 -DCMAKE_INSTALL_PREFIX="${PREFIX}" \
[27202]59 -DBLAS_LIBRARIES="-L${BLAS_ROOT}/lib;-lfblas;-L${LIBGFORTRAN_ROOT};-lgfortran" \
[25745]60 -DCURL_INCLUDE_DIR="${CURL_ROOT}/include" \
[27202]61 -DCURL_LIBRARY="-L${CURL_ROOT}/lib;-lcurl" \
62 -DLAPACK_LIBRARIES="-L${LAPACK_ROOT}/lib;-lflapack;-L${LIBGFORTRAN_ROOT};-lgfortran" \
[25745]63 ..
64
65# Compile and install
66if [ $# -eq 0 ]; then
67 make
68 make install
69else
70 make -j $1
71 make -j $1 install
72fi
[25989]73
74# Make necessary link on RHEL
75if [[ -d ${PREFIX}/lib64 && ! -d ${PREFIX}/lib ]]; then
76 cd ${PREFIX}
77 ln -s ./lib64 ./lib
78fi
Note: See TracBrowser for help on using the repository browser.