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

Last change on this file since 27700 was 27700, checked in by jdquinn, 2 years ago

CHG: Updating version

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