85 lines
3.3 KiB
Ruby
85 lines
3.3 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"
|
|
head "https://github.com/GenericMappingTools/gmt.git", branch: "master"
|
|
|
|
bottle do
|
|
sha256 arm64_monterey: "049f3bbd857920614205a7680206e97fe757e2d3ee3f69e3a84c833abc7b6a7a"
|
|
sha256 arm64_big_sur: "4034c75ff52c4b2c539339a2e2129f80a4b841aa65169831d24b6de81747272e"
|
|
sha256 monterey: "fcd2a33c09b6c4f30b208f658ec5edf9036f54c7dc7ef5fb0ea9d68610930660"
|
|
sha256 big_sur: "b0187d3a3888c19665c0747a1e2d0dc3fafdc3600ac5a0b5b82d3e57c5907821"
|
|
sha256 catalina: "49b528a8402984592297ba31dbbf3c6c2a2fb214d18f67cfbb464aee5a963025"
|
|
sha256 x86_64_linux: "1dedbccfceb6e6e01a68f9725360cb5cd0d368ae02759ee06392e26991f1980b"
|
|
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 = 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["pcre2"].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", 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
|