Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

build-gmt.sh 2.0 KB

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
  1. #!/usr/bin/env bash
  2. #
  3. # Build the GMT source codes of a specific branch or tag/release.
  4. #
  5. # Usage:
  6. #
  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]
  13. #
  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:
  18. #
  19. # curl https://raw.githubusercontent.com/GenericMappingTools/gmt/master/ci/build-gmt.sh | bash
  20. #
  21. set -x -e
  22. # Following variables can be modified via environment variables
  23. GMT_INSTALL_DIR=${GMT_INSTALL_DIR:-${HOME}/gmt-install-dir}
  24. if [ "X$1" = "X" ]; then
  25. GMT_GIT_REF=${GMT_GIT_REF:-master}
  26. else
  27. GMT_GIT_REF=$1
  28. fi
  29. # General settings
  30. GSHHG_VERSION="2.3.7"
  31. DCW_VERSION="1.1.4"
  32. GSHHG="gshhg-gmt-${GSHHG_VERSION}"
  33. DCW="dcw-gmt-${DCW_VERSION}"
  34. EXT="tar.gz"
  35. cwd=${PWD}
  36. # 1. Create temporary directory for building
  37. GMT_BUILD_TMPDIR=$(mktemp -d ${TMPDIR:-/tmp/}gmt.XXXXXX)
  38. cd ${GMT_BUILD_TMPDIR}
  39. # 2. Download GMT, GSHHG and DCW from GitHub
  40. git clone --depth=1 --single-branch --branch ${GMT_GIT_REF} https://github.com/GenericMappingTools/gmt
  41. curl -SLO https://github.com/GenericMappingTools/gshhg-gmt/releases/download/${GSHHG_VERSION}/${GSHHG}.${EXT}
  42. curl -SLO https://github.com/GenericMappingTools/dcw-gmt/releases/download/${DCW_VERSION}/${DCW}.${EXT}
  43. # 3. Extract tarballs
  44. tar -xvf ${GSHHG}.${EXT}
  45. tar -xvf ${DCW}.${EXT}
  46. mv ${GSHHG} gmt/share/gshhg-gmt
  47. mv ${DCW} gmt/share/dcw-gmt
  48. # 4. Configure GMT
  49. cd gmt/
  50. cat > cmake/ConfigUser.cmake << EOF
  51. set (CMAKE_INSTALL_PREFIX "${GMT_INSTALL_DIR}")
  52. set (CMAKE_C_FLAGS "-Wall -Wdeclaration-after-statement \${CMAKE_C_FLAGS}")
  53. set (CMAKE_C_FLAGS "-Wextra \${CMAKE_C_FLAGS}")
  54. EOF
  55. # 5. Build and install GMT
  56. mkdir build
  57. cd build
  58. cmake ..
  59. cmake --build .
  60. cmake --build . --target install
  61. # 6. Cleanup
  62. cd ${cwd}
  63. rm -rf ${GMT_BUILD_TMPDIR}
  64. set -x -e
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...