Skip to content

Commit e9dad2d

Browse files
authored
Enable the GMT build script to build any branches or tags (#3841)
1 parent 512176b commit e9dad2d

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

ci/build-gmt-master.sh renamed to ci/build-gmt.sh

+20-8
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,33 @@
11
#!/usr/bin/env bash
22
#
3-
# Build the lastest GMT source codes.
3+
# Build the GMT source codes of a specific branch or tag/release.
44
#
55
# Usage:
66
#
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]
913
#
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:
1118
#
12-
# - GMT_INSTALL_DIR: GMT installation location
19+
# curl https://raw.githubusercontent.com/GenericMappingTools/gmt/master/ci/build-gmt.sh | bash
1320
#
1421

1522
set -x -e
1623

1724
# Following variables can be modified via environment variables
1825
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
1931

2032
# General settings
2133
GSHHG_VERSION="2.3.7"
@@ -30,7 +42,7 @@ GMT_BUILD_TMPDIR=$(mktemp -d ${TMPDIR:-/tmp/}gmt.XXXXXX)
3042
cd ${GMT_BUILD_TMPDIR}
3143

3244
# 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
3446
curl -SLO https://github.com/GenericMappingTools/gshhg-gmt/releases/download/${GSHHG_VERSION}/${GSHHG}.${EXT}
3547
curl -SLO https://github.com/GenericMappingTools/dcw-gmt/releases/download/${DCW_VERSION}/${DCW}.${EXT}
3648

@@ -52,8 +64,8 @@ EOF
5264
mkdir build
5365
cd build
5466
cmake ..
55-
make
56-
make install
67+
cmake --build .
68+
cmake --build . --target install
5769

5870
# 6. Cleanup
5971
cd ${cwd}

0 commit comments

Comments
 (0)