1
1
#! /usr/bin/env bash
2
2
#
3
- # Build the lastest GMT source codes.
3
+ # Build the GMT source codes of a specific branch or tag/release .
4
4
#
5
5
# Usage:
6
6
#
7
- # 1. Install GMT dependencies following the [wiki](https://github.com/GenericMappingTools/gmt/wiki)
8
- # 2. curl https://raw.githubusercontent.com/GenericMappingTools/gmt/master/ci/build-gmt-master.sh | bash
7
+ # bash build-gmt.sh [branch-or-tag]
8
+ #
9
+ # Environmental variables that controls the building process:
10
+ #
11
+ # - GMT_INSTALL_DIR : GMT installation location [$HOME/gmt-install-dir]
12
+ # - GMT_GIT_REF : branch name or tag/release [master if CLI argument isn't given]
9
13
#
10
- # Environmental variables that affect the building process:
14
+ # Notes for CI service users:
15
+ #
16
+ # 1. Install GMT dependencies following the [wiki](https://github.com/GenericMappingTools/gmt/wiki)
17
+ # 2. Run the following command to build the GMT source codes:
11
18
#
12
- # - GMT_INSTALL_DIR: GMT installation location
19
+ # curl https://raw.githubusercontent.com/GenericMappingTools/gmt/master/ci/build-gmt.sh | bash
13
20
#
14
21
15
22
set -x -e
16
23
17
24
# Following variables can be modified via environment variables
18
25
GMT_INSTALL_DIR=${GMT_INSTALL_DIR:- ${HOME} / gmt-install-dir}
26
+ if [ " X$1 " = " X" ]; then
27
+ GMT_GIT_REF=${GMT_GIT_REF:- master}
28
+ else
29
+ GMT_GIT_REF=$1
30
+ fi
19
31
20
32
# General settings
21
33
GSHHG_VERSION=" 2.3.7"
@@ -30,7 +42,7 @@ GMT_BUILD_TMPDIR=$(mktemp -d ${TMPDIR:-/tmp/}gmt.XXXXXX)
30
42
cd ${GMT_BUILD_TMPDIR}
31
43
32
44
# 2. Download GMT, GSHHG and DCW from GitHub
33
- git clone --depth 1 https://github.com/GenericMappingTools/gmt.git gmt
45
+ git clone --depth=1 --single-branch --branch ${GMT_GIT_REF} https://github.com/GenericMappingTools/gmt
34
46
curl -SLO https://github.com/GenericMappingTools/gshhg-gmt/releases/download/${GSHHG_VERSION} /${GSHHG} .${EXT}
35
47
curl -SLO https://github.com/GenericMappingTools/dcw-gmt/releases/download/${DCW_VERSION} /${DCW} .${EXT}
36
48
52
64
mkdir build
53
65
cd build
54
66
cmake ..
55
- make
56
- make install
67
+ cmake --build .
68
+ cmake --build . --target install
57
69
58
70
# 6. Cleanup
59
71
cd ${cwd}
0 commit comments