[25745] | 1 | #!/bin/bash
|
---|
| 2 | set -eu
|
---|
| 3 |
|
---|
| 4 |
|
---|
| 5 | ## Constants
|
---|
| 6 | #
|
---|
[27700] | 7 | VER="6.4.0"
|
---|
[25745] | 8 |
|
---|
[27202] | 9 | # Find libgfortran so that we do not have to hardcode it.
|
---|
| 10 | #
|
---|
| 11 | # TODO:
|
---|
| 12 | # - Move this to etc/environment.sh
|
---|
| 13 | #
|
---|
[27406] | 14 | echo "Finding libgfortran..."
|
---|
[27397] | 15 | LIBGFORTRAN=$(find /usr -name libgfortran* 2>/dev/null | egrep -n libgfortran.a | sed "s/[0-9]*://g" | head -1)
|
---|
[27202] | 16 | LIBGFORTRAN_ROOT=${LIBGFORTRAN%/*}
|
---|
| 17 |
|
---|
[25745] | 18 | # Environment
|
---|
| 19 | #
|
---|
| 20 | export CC=mpicc
|
---|
[25860] | 21 | export 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.
|
---|
[25745] | 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
|
---|
| 27 | tar -zxvf gmt-${VER}.tar.gz
|
---|
| 28 |
|
---|
| 29 | # Cleanup
|
---|
[25860] | 30 | rm -rf ${PREFIX} src
|
---|
| 31 | mkdir -p ${PREFIX} src
|
---|
[25745] | 32 |
|
---|
| 33 | # Move source to 'src' directory
|
---|
| 34 | mv gmt-${VER}/* src
|
---|
| 35 | rm -rf gmt-${VER}
|
---|
| 36 |
|
---|
| 37 | # Copy custom configuration files
|
---|
[27592] | 38 | cp ./configs/6.0/linux/cmake/ConfigUser.cmake ./src/cmake
|
---|
[25745] | 39 |
|
---|
| 40 | # Configure
|
---|
| 41 | cd src
|
---|
| 42 | mkdir build
|
---|
| 43 | cd 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 | #
|
---|
| 52 | cmake \
|
---|
[27202] | 53 | -DBLAS_LIBRARIES="-L${BLAS_ROOT}/lib;-lfblas;-L${LIBGFORTRAN_ROOT};-lgfortran" \
|
---|
[25745] | 54 | -DCURL_INCLUDE_DIR="${CURL_ROOT}/include" \
|
---|
[27202] | 55 | -DCURL_LIBRARY="-L${CURL_ROOT}/lib;-lcurl" \
|
---|
| 56 | -DLAPACK_LIBRARIES="-L${LAPACK_ROOT}/lib;-lflapack;-L${LIBGFORTRAN_ROOT};-lgfortran" \
|
---|
[25745] | 57 | ..
|
---|
| 58 |
|
---|
| 59 | # Compile and install
|
---|
| 60 | if [ $# -eq 0 ]; then
|
---|
| 61 | make
|
---|
| 62 | make install
|
---|
| 63 | else
|
---|
| 64 | make -j $1
|
---|
| 65 | make -j $1 install
|
---|
| 66 | fi
|
---|
[25989] | 67 |
|
---|
| 68 | # Make necessary link on RHEL
|
---|
| 69 | if [[ -d ${PREFIX}/lib64 && ! -d ${PREFIX}/lib ]]; then
|
---|
| 70 | cd ${PREFIX}
|
---|
| 71 | ln -s ./lib64 ./lib
|
---|
| 72 | fi
|
---|