class Nco < Formula desc "Command-line operators for netCDF and HDF files" homepage "https://nco.sourceforge.io/" url "https://downloads.sourceforge.net/project/nco/nco-4.7.4.tar.gz" sha256 "c9848ebb5f32ff6d74ba44906b226023fd9073a31bc40e719b1b71728d648632" bottle do cellar :any sha256 "a4480e701fbeb0f4ea8b0449f675d93dbf7df0ca9b4285bf57628a3b3274176f" => :high_sierra sha256 "6df3a9bc78d19e4d04129d6c1638ae6c949cb4d10d643163af040226483a2558" => :sierra sha256 "0d943fa7cccb711fff3cb3e5faaaa11263e00fd72fd5229b044cc6ee49f3c626" => :el_capitan end head do url "https://github.com/nco/nco.git" depends_on "autoconf" => :build depends_on "automake" => :build end depends_on "antlr@2" # requires C++ interface in Antlr2 depends_on "gsl" depends_on "netcdf" depends_on "texinfo" depends_on "udunits" resource("example_nc") do url "https://www.unidata.ucar.edu/software/netcdf/examples/WMI_Lear.nc" sha256 "e37527146376716ef335d01d68efc8d0142bdebf8d9d7f4e8cbe6f880807bdef" end def install system "./autogen.sh" if build.head? inreplace "configure" do |s| # The Antlr 2.x program installed by Homebrew is called antlr2 s.gsub! "for ac_prog in runantlr antlr", "for ac_prog in runantlr antlr2" end system "./configure", "--disable-dependency-tracking", "--prefix=#{prefix}", "--enable-netcdf4" system "make", "install" end test do testpath.install resource("example_nc") output = shell_output("#{bin}/ncks --json -M WMI_Lear.nc") assert_match "\"time\": 180", output end end