homebrew-core/Formula/gmt.rb

86 lines
3.4 KiB
Ruby

class Gmt < Formula
desc "Tools for manipulating and plotting geographic and Cartesian data"
homepage "https://www.generic-mapping-tools.org/"
url "https://github.com/GenericMappingTools/gmt/releases/download/6.4.0/gmt-6.4.0-src.tar.xz"
mirror "https://mirrors.ustc.edu.cn/gmt/gmt-6.4.0-src.tar.xz"
sha256 "b46effe59cf96f50c6ef6b031863310d819e63b2ed1aa873f94d70c619490672"
license "LGPL-3.0-or-later"
revision 4
head "https://github.com/GenericMappingTools/gmt.git", branch: "master"
bottle do
sha256 arm64_ventura: "ef346c91b4746fe412b740f56606bc61afc97843bba5ae5d6f6f2c4b460b6b4e"
sha256 arm64_monterey: "3d3a53e59e45440e3457b968066219257fae08ce1f0c77eba2863d2cfcc022c8"
sha256 arm64_big_sur: "c3d71a33976ce3de1aac6c85964616afeffa0c52da93018d93dbd0ec1cf98688"
sha256 ventura: "684a63e7c272a9132f8b060b3c43cca5644073329ae7399e7e19492ee0ab3fa3"
sha256 monterey: "e286b1e74ef3807ee30fffb5a14d31da77ac0499298016b261358ded33fe4c4e"
sha256 big_sur: "f8a0ae2f0768d89603bef339b72aabc6bfc2c1dcd57ea67906d569d950b3e9f5"
sha256 x86_64_linux: "21669e720a1f23b9d285d338d680a47b56d6a05e2c3fdba35305295668051591"
end
depends_on "cmake" => :build
depends_on "fftw"
depends_on "gdal"
depends_on "netcdf"
depends_on "pcre2"
resource "gshhg" do
url "https://github.com/GenericMappingTools/gshhg-gmt/releases/download/2.3.7/gshhg-gmt-2.3.7.tar.gz"
mirror "https://mirrors.ustc.edu.cn/gmt/gshhg-gmt-2.3.7.tar.gz"
sha256 "9bb1a956fca0718c083bef842e625797535a00ce81f175df08b042c2a92cfe7f"
end
resource "dcw" do
url "https://github.com/GenericMappingTools/dcw-gmt/releases/download/2.1.1/dcw-gmt-2.1.1.tar.gz"
mirror "https://mirrors.ustc.edu.cn/gmt/dcw-gmt-2.1.1.tar.gz"
sha256 "d4e208dca88fbf42cba1bb440fbd96ea2f932185c86001f327ed0c7b65d27af1"
end
def install
(buildpath/"gshhg").install resource("gshhg")
(buildpath/"dcw").install resource("dcw")
# GMT_DOCDIR and GMT_MANDIR must be relative paths
args = %W[
-DGMT_DOCDIR=share/doc/gmt
-DGMT_MANDIR=share/man
-DGSHHG_ROOT=#{buildpath}/gshhg
-DCOPY_GSHHG:BOOL=TRUE
-DDCW_ROOT=#{buildpath}/dcw
-DCOPY_DCW:BOOL=TRUE
-DPCRE_ROOT=FALSE
-DFFTW3_ROOT=#{Formula["fftw"].opt_prefix}
-DGDAL_ROOT=#{Formula["gdal"].opt_prefix}
-DNETCDF_ROOT=#{Formula["netcdf"].opt_prefix}
-DPCRE2_ROOT=#{Formula["pcre2"].opt_prefix}
-DFLOCK:BOOL=TRUE
-DGMT_INSTALL_MODULE_LINKS:BOOL=FALSE
-DGMT_INSTALL_TRADITIONAL_FOLDERNAMES:BOOL=FALSE
-DLICENSE_RESTRICTED:BOOL=FALSE
]
system "cmake", "-S", ".", "-B", "build", *args, *std_cmake_args
system "cmake", "--build", "build"
system "cmake", "--install", "build"
inreplace bin/"gmt-config", Superenv.shims_path/ENV.cc, DevelopmentTools.locate(ENV.cc)
end
def caveats
<<~EOS
GMT needs Ghostscript for the 'psconvert' command to convert PostScript files
to other formats. To use 'psconvert', please 'brew install ghostscript'.
GMT needs FFmpeg for the 'movie' command to make movies in MP4 or WebM format.
If you need this feature, please 'brew install ffmpeg'.
GMT needs GraphicsMagick for the 'movie' command to make animated GIFs.
If you need this feature, please 'brew install graphicsmagick'.
EOS
end
test do
system "#{bin}/gmt pscoast -R0/360/-70/70 -Jm1.2e-2i -Ba60f30/a30f15 -Dc -G240 -W1/0 -P > test.ps"
assert_predicate testpath/"test.ps", :exist?
end
end