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.3.tar.gz" sha256 "c79fcfc291976466070e0da04c9ea57924feb7f41e4d89a27f313c465e42b381" bottle do cellar :any sha256 "ba0586276dcd8216c92e1b667664ecc485c91396caf761e094b7bfd1ace447a7" => :high_sierra sha256 "7de2fbd91043617bd1a5865bf9f7fbea5f2c82b99eae70989550b3eb8d49f6be" => :sierra sha256 "18bd84803a3021374a4f143a76fae14b6805d2c905fc8a26b3a7a06e275b86d8" => :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