homebrew-core/Formula/gmt.rb

83 lines
3.0 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.1.1/gmt-6.1.1-src.tar.xz"
mirror "https://mirrors.ustc.edu.cn/gmt/gmt-6.1.1-src.tar.xz"
sha256 "d476cba999340648146ef53ab4a3f64858cbd2f5511cdec9f7f06f3fb7896625"
license "LGPL-3.0-or-later"
revision 3
head "https://github.com/GenericMappingTools/gmt.git"
bottle do
sha256 big_sur: "938fd4d45e539dad96b0f8f12cec5d2a791e55ced1c2e027bdb970aed2e44ecf"
sha256 catalina: "894136f2754d3677ef41ac95d9087771a98502c8988a6742ce6c16832b873a92"
sha256 mojave: "5ec74190adc6306423223b377b20950c6343847c5620429b17aedf7dfdbe7327"
end
depends_on "cmake" => :build
depends_on "fftw"
depends_on "gdal"
depends_on "netcdf"
depends_on "pcre"
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/1.1.4/dcw-gmt-1.1.4.tar.gz"
mirror "https://mirrors.ustc.edu.cn/gmt/dcw-gmt-1.1.4.tar.gz"
sha256 "8d47402abcd7f54a0f711365cd022e4eaea7da324edac83611ca035ea443aad3"
end
def install
(buildpath/"gshhg").install resource("gshhg")
(buildpath/"dcw").install resource("dcw")
# GMT_DOCDIR and GMT_MANDIR must be relative paths
args = std_cmake_args.concat %W[
-DCMAKE_INSTALL_PREFIX=#{prefix}
-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
-DFFTW3_ROOT=#{Formula["fftw"].opt_prefix}
-DGDAL_ROOT=#{Formula["gdal"].opt_prefix}
-DNETCDF_ROOT=#{Formula["netcdf"].opt_prefix}
-DPCRE_ROOT=#{Formula["pcre"].opt_prefix}
-DFLOCK:BOOL=TRUE
-DGMT_INSTALL_MODULE_LINKS:BOOL=FALSE
-DGMT_INSTALL_TRADITIONAL_FOLDERNAMES:BOOL=FALSE
-DLICENSE_RESTRICTED:BOOL=FALSE
]
mkdir "build" do
system "cmake", "..", *args
system "make", "install"
end
inreplace bin/"gmt-config", "#{HOMEBREW_LIBRARY}/Homebrew/shims/mac/super/clang", "/usr/bin/clang"
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