84 lines
3.1 KiB
Ruby
84 lines
3.1 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.3.0/gmt-6.3.0-src.tar.xz"
|
|
mirror "https://mirrors.ustc.edu.cn/gmt/gmt-6.3.0-src.tar.xz"
|
|
sha256 "69e29b62ee802a3a64260d6a1e023f1350e3bf4070221aa1307bf8a9e56c1ee5"
|
|
license "LGPL-3.0-or-later"
|
|
revision 2
|
|
head "https://github.com/GenericMappingTools/gmt.git", branch: "master"
|
|
|
|
bottle do
|
|
sha256 arm64_big_sur: "d1cfd3579a7a02ef5d963f52249dcd2105a3a537f9ee11f2dfdfa3a02cf80613"
|
|
sha256 big_sur: "24ad3042ceaa926a51cbaa507840fd57f24dfb0b39790edc6fd671446cf9bc3a"
|
|
sha256 catalina: "e682f09222c89f5b3a99477f51c88bc83d02d6412ffd00db3bc6265c52de008e"
|
|
sha256 x86_64_linux: "cb04c9ba825b3a09f869b5ed06a78358561beacf15fbf3ddc54399517c59b0f9"
|
|
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.0/dcw-gmt-2.1.0.tar.gz"
|
|
mirror "https://mirrors.ustc.edu.cn/gmt/dcw-gmt-2.1.0.tar.gz"
|
|
sha256 "e810567cd474d5af9d84751938acb447a8612391ed66190d60d789974a1f9e29"
|
|
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
|