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
Line 
1#!/bin/bash
2set -e
3
4
5## Constants
6#
7VER="6.5.0"
8
9PREFIX="${ISSM_DIR}/externalpackages/gmt/install"
10
11# Find certain libraries so we do not have to hardcode them
12#
13# TODO:
14# - Move this to etc/environment.sh
15#
16echo "Finding libgfortran..."
17LIBGFORTRAN=$(find /usr -name libgfortran.* 2>/dev/null | egrep -n libgfortran.a | sed "s/[0-9]*://g" | head -1)
18LIBGFORTRAN_ROOT=${LIBGFORTRAN%/*}
19
20# Environment
21#
22export CC=mpicc
23export CFLAGS="${CFLAGS} -w"
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
32rm -rf ${PREFIX} src
33mkdir -p ${PREFIX} src
34
35# Move source to 'src' directory
36mv gmt-${VER}/* src
37rm -rf gmt-${VER}
38
39# Copy custom configuration files to source
40cp ./src/cmake/ConfigUserAdvancedTemplate.cmake ./src/cmake/ConfigUser.cmake
41
42# Patch source
43patch ./src/cmake/ConfigUser.cmake < ./configs/${VER%.*}/cmake/ConfigUserAdvancedTemplate.cmake.patch
44
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 \
58 -DCMAKE_INSTALL_PREFIX="${PREFIX}" \
59 -DBLAS_LIBRARIES="-L${BLAS_ROOT}/lib;-lfblas;-L${LIBGFORTRAN_ROOT};-lgfortran" \
60 -DCURL_INCLUDE_DIR="${CURL_ROOT}/include" \
61 -DCURL_LIBRARY="-L${CURL_ROOT}/lib;-lcurl" \
62 -DLAPACK_LIBRARIES="-L${LAPACK_ROOT}/lib;-lflapack;-L${LIBGFORTRAN_ROOT};-lgfortran" \
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
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.